Bug 20385 - REGRESSION (r35676): Firebug command line extensions interfere with existing objects
Summary: REGRESSION (r35676): Firebug command line extensions interfere with existing ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Normal
Assignee: Nobody
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2008-08-14 13:10 PDT by Brian Mitchell
Modified: 2008-08-14 17:00 PDT (History)
3 users (show)

See Also:


Attachments
quick fix (3.17 KB, patch)
2008-08-14 16:07 PDT, Keishi Hattori
no flags Details | Formatted Diff | Diff
the better one (1.69 KB, patch)
2008-08-14 16:48 PDT, Keishi Hattori
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Mitchell 2008-08-14 13:10:02 PDT
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.
Comment 1 Brian Mitchell 2008-08-14 13:34:14 PDT
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.
Comment 2 Adam Roben (:aroben) 2008-08-14 13:41:58 PDT
<rdar://problem/6150581>
Comment 3 Keishi Hattori 2008-08-14 16:07:49 PDT
Created attachment 22801 [details]
quick fix
Comment 4 Timothy Hatcher 2008-08-14 16:13:18 PDT
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.
Comment 5 Keishi Hattori 2008-08-14 16:22:41 PDT
(In reply to comment #4)
>         expression = "with (window._inspectorCommandLineAPI) { with (window) {
> " + expression + " } }";

That's much better...
Comment 6 Timothy Hatcher 2008-08-14 16:24:53 PDT
(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
Comment 7 Keishi Hattori 2008-08-14 16:48:22 PDT
Created attachment 22802 [details]
the better one

It worked. I'm not sure if this is what you meant for a test case.
Comment 8 Timothy Hatcher 2008-08-14 16:50:05 PDT
Comment on attachment 22802 [details]
the better one

Yep, looks good!
Comment 9 Timothy Hatcher 2008-08-14 16:57:37 PDT
Landed in r35769.
Comment 10 Timothy Hatcher 2008-08-14 17:00:34 PDT
Thanks for the bug report Brian!