WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
53072
Web Inspector: evaluate in console may not work when window.console is substituted
https://bugs.webkit.org/show_bug.cgi?id=53072
Summary
Web Inspector: evaluate in console may not work when window.console is substi...
Pavel Podivilov
Reported
2011-01-25 02:41:56 PST
Web Inspector: evaluate in console may not work when window.console is substituted Initial bug -
http://code.google.com/p/chromium/issues/detail?id=70629
.
Attachments
Patch.
(1.39 KB, patch)
2011-01-25 02:42 PST
,
Pavel Podivilov
no flags
Details
Formatted Diff
Diff
Added test.
(4.54 KB, patch)
2011-01-25 07:18 PST
,
Pavel Podivilov
no flags
Details
Formatted Diff
Diff
Patch.
(4.45 KB, patch)
2011-01-26 01:45 PST
,
Pavel Podivilov
pfeldman
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Pavel Podivilov
Comment 1
2011-01-25 02:42:48 PST
Created
attachment 80039
[details]
Patch.
Yury Semikhatsky
Comment 2
2011-01-25 04:24:10 PST
Comment on
attachment 80039
[details]
Patch. Can you provide a test for this?
Yury Semikhatsky
Comment 3
2011-01-25 04:27:19 PST
Comment on
attachment 80039
[details]
Patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=80039&action=review
> Source/WebCore/inspector/InjectedScriptSource.js:261 > + expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}";
If .console is undefined then this method will fail at line 256 and not get here: inspectedWindow.console._commandLineAPI = this._commandLineAPI;
Pavel Podivilov
Comment 4
2011-01-25 05:03:19 PST
(In reply to
comment #3
)
> (From update of
attachment 80039
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=80039&action=review
> > > Source/WebCore/inspector/InjectedScriptSource.js:261 > > + expression = "with ((window && window.console && window.console._commandLineAPI) || {}) {\n" + expression + "\n}"; > > If .console is undefined then this method will fail at line 256 and not get here: > > inspectedWindow.console._commandLineAPI = this._commandLineAPI;
Not undefined, but substituted. In any case this patch looks safe and fixes the problem.
Pavel Podivilov
Comment 5
2011-01-25 07:18:30 PST
Created
attachment 80063
[details]
Added test.
Yury Semikhatsky
Comment 6
2011-01-25 08:01:51 PST
Comment on
attachment 80063
[details]
Added test. View in context:
https://bugs.webkit.org/attachment.cgi?id=80063&action=review
> LayoutTests/inspector/console-substituted.html:21 > + InspectorTest.evaluateInConsole("setTimeout(deleteConsole, 0)", step1);
Why do you need setTimeout here?
> LayoutTests/inspector/console-substituted.html:31 > + InspectorTest.evaluateInConsole("setTimeout(substituteConsole, 0)", step3);
The same question for this call.
> Source/WebCore/inspector/InjectedScriptSource.js:261 > + expression = "with (window || {}) {\n" + expression + "\n} ";
is there a real scenario when there are no window?
Pavel Podivilov
Comment 7
2011-01-25 08:08:26 PST
(In reply to
comment #6
)
> (From update of
attachment 80063
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=80063&action=review
> > > LayoutTests/inspector/console-substituted.html:21 > > + InspectorTest.evaluateInConsole("setTimeout(deleteConsole, 0)", step1); > > Why do you need setTimeout here? > > > LayoutTests/inspector/console-substituted.html:31 > > + InspectorTest.evaluateInConsole("setTimeout(substituteConsole, 0)", step3); > > The same question for this call. > > > Source/WebCore/inspector/InjectedScriptSource.js:261 > > + expression = "with (window || {}) {\n" + expression + "\n} "; > > is there a real scenario when there are no window?
Sure, you may be inside a closure created in function with "window" argument, which is not used by that closure. In that case "window" will be undefined (v8 will drop it).
Pavel Podivilov
Comment 8
2011-01-26 01:45:05 PST
(In reply to
comment #6
)
> (From update of
attachment 80063
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=80063&action=review
> > > LayoutTests/inspector/console-substituted.html:21 > > + InspectorTest.evaluateInConsole("setTimeout(deleteConsole, 0)", step1); > > Why do you need setTimeout here?
Replaced with direct call.
> > > LayoutTests/inspector/console-substituted.html:31 > > + InspectorTest.evaluateInConsole("setTimeout(substituteConsole, 0)", step3); > > The same question for this call.
Replaced with direct call.
> > > Source/WebCore/inspector/InjectedScriptSource.js:261 > > + expression = "with (window || {}) {\n" + expression + "\n} "; > > is there a real scenario when there are no window?
Fixed. Since this is behind !isEvalOnCallFrame, there is probably no such scenario.
Pavel Podivilov
Comment 9
2011-01-26 01:45:57 PST
Created
attachment 80176
[details]
Patch.
Pavel Feldman
Comment 10
2011-01-26 02:16:59 PST
Comment on
attachment 80176
[details]
Patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=80176&action=review
> Source/WebCore/inspector/InjectedScriptSource.js:257 > + inspectedWindow.console._commandLineAPI = this._commandLineAPI;
Nit: defining non-enumerable property would be even better.
Pavel Podivilov
Comment 11
2011-01-26 10:26:09 PST
Committed
r76699
: <
http://trac.webkit.org/changeset/76699
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug