Bug 19872 - Inspector should allow evaluating expressions in iframes
Summary: Inspector should allow evaluating expressions in iframes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Yury Semikhatsky
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-07-03 06:41 PDT by Keishi Hattori
Modified: 2011-07-27 14:41 PDT (History)
9 users (show)

See Also:


Attachments
Patch (26.44 KB, patch)
2011-07-27 02:51 PDT, Yury Semikhatsky
no flags Details | Formatted Diff | Diff
Screenshot with the patch applied (74.28 KB, image/png)
2011-07-27 04:25 PDT, Yury Semikhatsky
no flags Details
Patch (26.00 KB, patch)
2011-07-27 05:52 PDT, Yury Semikhatsky
no flags Details | Formatted Diff | Diff
Patch (25.23 KB, patch)
2011-07-27 06:21 PDT, Yury Semikhatsky
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keishi Hattori 2008-07-03 06:41:01 PDT
Inspector should support cd(window) in the command line for Firebug parity.
Comment 1 Adam Roben (:aroben) 2008-07-11 14:07:30 PDT
<rdar://problem/6070219>
Comment 2 Yury Semikhatsky 2011-07-27 02:51:17 PDT
Created attachment 102113 [details]
Patch
Comment 3 WebKit Review Bot 2011-07-27 02:54:43 PDT
Attachment 102113 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/http..." exit_code: 1

Source/WebCore/inspector/InspectorRuntimeAgent.h:57:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorRuntimeAgent.cpp:62:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Yury Semikhatsky 2011-07-27 04:25:24 PDT
Created attachment 102121 [details]
Screenshot with the patch applied
Comment 5 Pavel Feldman 2011-07-27 05:03:15 PDT
Comment on attachment 102113 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102113&action=review

> LayoutTests/http/tests/inspector/console-cd.html:11
> +    WebInspector.drawer.immediatelyFinishAnimation();

This is worth a separate InspectorTest.showConsole() function.

> Source/WebCore/inspector/Inspector.json:262
> +                    { "name": "type", "type": "string", "enum": ["frame"], "description": "Type of the context." },

Context id should not be composite (or at least should be opaque to the front-end side).

> Source/WebCore/inspector/Inspector.json:275
> +                    { "name": "context", "$ref": "ContextId", "optional": true, "description": "Specifies in which context to perform evaluation" }

Can we use frame id here instead?

> Source/WebCore/inspector/front-end/ConsoleView.js:195
> +    get _currentEvaluationContextId()

We generally don't do private getters.

> Source/WebCore/inspector/front-end/ContextManager.js:1
> +/*

The name is too generic. JavaScriptWorldManager? How does this correlate with the workers contexts? DebuggerModel?
Comment 6 Yury Semikhatsky 2011-07-27 05:52:51 PDT
Created attachment 102136 [details]
Patch
Comment 7 Yury Semikhatsky 2011-07-27 05:53:50 PDT
(In reply to comment #5)
> (From update of attachment 102113 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=102113&action=review
> 
> > LayoutTests/http/tests/inspector/console-cd.html:11
> > +    WebInspector.drawer.immediatelyFinishAnimation();
> 
> This is worth a separate InspectorTest.showConsole() function.
> 
Done.

> > Source/WebCore/inspector/Inspector.json:262
> > +                    { "name": "type", "type": "string", "enum": ["frame"], "description": "Type of the context." },
> 
> Context id should not be composite (or at least should be opaque to the front-end side).
> 
Replaced with frameId as discussed offline.

> > Source/WebCore/inspector/Inspector.json:275
> > +                    { "name": "context", "$ref": "ContextId", "optional": true, "description": "Specifies in which context to perform evaluation" }
> 
> Can we use frame id here instead?
> 
Done.

> > Source/WebCore/inspector/front-end/ConsoleView.js:195
> > +    get _currentEvaluationContextId()
> 
> We generally don't do private getters.
> 
Fixed.

> > Source/WebCore/inspector/front-end/ContextManager.js:1
> > +/*
> 
> The name is too generic. JavaScriptWorldManager? How does this correlate with the workers contexts? DebuggerModel?
Renamed to JavaScriptContextManager.js
Comment 8 WebKit Review Bot 2011-07-27 05:56:43 PDT
Attachment 102136 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/http..." exit_code: 1

Source/WebCore/inspector/InspectorRuntimeAgent.h:57:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorRuntimeAgent.cpp:62:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Pavel Feldman 2011-07-27 06:07:12 PDT
Comment on attachment 102136 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102136&action=review

> Source/WebCore/inspector/InspectorRuntimeAgent.cpp:66
> +        if (!m_pageAgent) {

You should implement an abstract method fetching evaluation context instead.
Comment 10 Yury Semikhatsky 2011-07-27 06:21:43 PDT
Created attachment 102138 [details]
Patch
Comment 11 Pavel Feldman 2011-07-27 06:25:23 PDT
Comment on attachment 102138 [details]
Patch

Please add the new file to the vcproj.
Comment 12 WebKit Review Bot 2011-07-27 06:25:39 PDT
Attachment 102138 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/http..." exit_code: 1

Source/WebCore/inspector/InspectorRuntimeAgent.h:56:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorRuntimeAgent.cpp:60:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 18 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Yury Semikhatsky 2011-07-27 06:37:31 PDT
Committed r91839: <http://trac.webkit.org/changeset/91839>
Comment 14 Adam Roben (:aroben) 2011-07-27 07:23:50 PDT
Why was this bug repurposed? This bug was specifically about supporting the cd(window) command-line API from Firebug.
Comment 15 Pavel Feldman 2011-07-27 14:37:22 PDT
(In reply to comment #14)
> Why was this bug repurposed? This bug was specifically about supporting the cd(window) command-line API from Firebug.

I filed a new issue for it: https://bugs.webkit.org/show_bug.cgi?id=65285.

Overall, cd(frame) does not sound like a great idea. Imagine several cd() calls within single evaluated expression, especially crossing origin boundaries. So chances are high it will stay open for quite some time.
Comment 16 Adam Roben (:aroben) 2011-07-27 14:41:31 PDT
Thanks for filing the new bug.