Hi,
I have developed an IE extension which implements the firebug "console" feature under IE : Companion.JS (http://www.my-debugbar.com/wiki/CompanionJS/HomePage) (free tool).
The "console" is implemented as a C++ object injected into the IE window object.
So using "console.log('test')" is working, but the syntax "if (console['log'])" or "if (console.log)" is not working and generates a javascript error.
A possible syntax that is working is "if ("log" in console)". The test for "window.console" is working anyway :
"if (window.console)" is working.
So, as some js Dojo code is testing "console" methods, maybe you could change the code to handle Companion.JS case.
This problem has been reported on the forum by a user : http://www.my-debugbar.com/forum/t21-Dojo-1.0.x-doesn't-work-with-CompanionJS.html
On another thread, I also proposed to add some properties to the "console" object (for Companion.JS), so it could be easier on javascript side to check which "console" provider is defined :
http://www.my-debugbar.com/forum/p576-Today-12%3A56%3A13.html#p576
You can reproduce the problem on the following page (with Companion.JS installed of course) :
http://dojocampus.org/explorer/
Feel free to contact me for any other information.
Thank you.
JFR

It is curious that
It is curious that "if(console.log)" fails but "if('log' in console)" works fine. Is it possible that Companion.JS needs to set some sort of ActiveX property to allow "if(console.log)" to work?
Even if Dojo were to change its code, doing an "if(console.log)" test seems like a natural test other JS code may do. It seems worthwhile for Companion.JS to fix it somehow in the Companion.JS code, since other, non-Dojo code may try to do the same test.
Yes, that seems strange.
Yes, that seems strange. Maybe this is because it is a C++ object. Maybe because I missed some interface or COM attribute so Javascript cannot fully get object definition.
I will check on my side (re-read COM documentation...) and will keep you informed through the forum if I can correct this problem from my code.
Well... I could inject a
Well... I could inject a consoleNative object (instead of 'console'), and then inject some basic js code to create a 'console' javascript object that will wrap the consoleNative methods. In this case, "if (console.log)" will work.
But I don't like the idea of injecting some piece of javascript into a page, seems intrusive to me :-O Maybe this is ok as greasemonkey is doing this all the time :-O.
If you like this idea I may implement this option. This will be invisible for the javascript users and they will have a real javascript object they can handle.
If you think that is the
If you think that is the implementation best plan for your code, go for it. It just seemed important that the object you are injecting into the javascript space allowed for that type of very common if test.
Hi, I have change "console"
Hi,
I have change "console" implementation on Companion.JS 0.4.1. This is now a javascript object so using "if (console.log)" syntax is working !
Hope Dojo community will like it ;-)
Thanks for your feedback.
JFR