The web inspector's console allows evaluation of code within the context of the inspected document. In many cases these pages have a number of javascript functions setup using common names like $. The firebug compatible functions override these calls causing many expressions to fail to evaluate in cases where different behavior was provided in those names under those calls. I would propose that the script check for predefined values before overriding with its own. I would also encourage having some of this functionality available via an isolated module (maybe $inspector would be an appropriate name) so those who want access to both behaviors can use the adjusted name.
I've checked firebug's behavior with this. Firebug does not override any of the pages functions if they exist with the same name. This allows the original functions to be used as expected.
<rdar://problem/6150581>
Created attachment 22801 [details] quick fix
A better fix might be a simple as: expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; The window object will be picked first, then _inspectorCommandLineAPI, then the global (window) object again.
(In reply to comment #4) > expression = "with (window._inspectorCommandLineAPI) { with (window) { > " + expression + " } }"; That's much better...
(In reply to comment #5) > (In reply to comment #4) > > expression = "with (window._inspectorCommandLineAPI) { with (window) { > > " + expression + " } }"; > > That's much better... > Did it work? I have not tested it. You should make a test case to land with your change. Put it in WebCore/manual-tests/inspector
Created attachment 22802 [details] the better one It worked. I'm not sure if this is what you meant for a test case.
Comment on attachment 22802 [details] the better one Yep, looks good!
Landed in r35769.
Thanks for the bug report Brian!