WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 85709
Web Inspector: [JSC] support JS execution in the context of an isolated world
https://bugs.webkit.org/show_bug.cgi?id=85709
Summary
Web Inspector: [JSC] support JS execution in the context of an isolated world
Yury Semikhatsky
Reported
2012-05-05 07:22:47 PDT
Web Inspector should allow console evals in isolated worlds.
Attachments
Patch
(1.93 KB, patch)
2012-07-03 19:04 PDT
,
Peter Wang
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2012-05-05 10:19:27 PDT
Can you explain what this actually means?
Yury Semikhatsky
Comment 2
2012-05-05 23:37:49 PDT
After
https://bugs.webkit.org/show_bug.cgi?id=85612
is landed it should be possible to select exact JS context in which snippets entered in Web Inspector console should be executed. At the moment it is only possible to select a frame and evaluation will be performed in the main world context of that. This bug is about adding an option to specify exact isolated world in which to perform the evaluation. Most of the stuff will be added once fix for 85612 is landed and the only remaining part will be to provide information about non-main-world contexts from JS bindings to the inspector code. I was going to take a look at this when
https://bugs.webkit.org/show_bug.cgi?id=85612
is fixed.
Yury Semikhatsky
Comment 3
2012-05-22 02:30:29 PDT
I'm trying to figure out what can be used to discriminate between different DOMWrapperWorlds on a given Frame. In V8 bindings each isolated context has its own security origin which is used in the inspector front-end as the context name. I don't see similar API in the JS bindings and it looks to me that in case of JSC all isolated contexts will have same security origin as the DOMWindow. Can someone familiar with the JS bindings enlighten me on this?
Geoffrey Garen
Comment 4
2012-05-22 11:58:02 PDT
(In reply to
comment #3
)
> I'm trying to figure out what can be used to discriminate between different DOMWrapperWorlds on a given Frame.
Inside WebCore, we use a DOMWrapperWorld pointer. See WebCore::ScriptController::evaluateInWorld(). To map the current execution context to the current DOMWrapperWorld, we use WebCore::currentWorld(): inline DOMWrapperWorld* currentWorld(JSC::ExecState* exec) { return JSC::jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->world(); }
Yury Semikhatsky
Comment 5
2012-05-22 22:53:59 PDT
(In reply to
comment #4
)
> (In reply to
comment #3
) > > I'm trying to figure out what can be used to discriminate between different DOMWrapperWorlds on a given Frame. > > Inside WebCore, we use a DOMWrapperWorld pointer.
It is still not clear to me how we can represent the world to the user in the inspector UI. In V8 bindings each V8IsolatedContext (a counterpart of JSDOMWindowShell in case of non-main world as I understand) will have its own security origin which is basically a URL of the extension which created that context. In the inspector UI we have a combobox with URLs of all the extensions that have content scripts in the selected Frame. The URLs are quite convenient for specifying a context where the console evaluation should happen. The problem is that DOMWrapperWorld doesn't provide access to such URL. I didn't find a good identifier(which could be used in the inspector UI) on JSDOMWindowShell either.
Geoffrey Garen
Comment 6
2012-05-22 23:17:21 PDT
(In reply to
comment #5
)
> In the inspector UI we have a combobox with URLs of all the extensions that have content scripts in the selected Frame.
Which URL do you use? The content script URL? Global page URL? Something else? In WebKit, DOMWrapperWorld doesn't require an associated URL or domain, so it doesn't have one to display. Perhaps you could infer a URL for display simply by recording the first URL passed to ScriptController::evaluateInWorld() for any give DOMWrapperWorld.
Yury Semikhatsky
Comment 7
2012-05-22 23:39:32 PDT
(In reply to
comment #6
)
> (In reply to
comment #5
) > > In the inspector UI we have a combobox with URLs of all the extensions that have content scripts in the selected Frame. > > Which URL do you use? The content script URL? Global page URL? Something else? >
The URL of an extension that created the context and will evaluate all content scripts in it. As I understand this URL is used for security checks when the content script sends XHR for example(a counterpart of DOMWindow::securityOrigin for isolated world).
> In WebKit, DOMWrapperWorld doesn't require an associated URL or domain, so it doesn't have one to display. Perhaps you could infer a URL for display simply by recording the first URL passed to ScriptController::evaluateInWorld() for any give DOMWrapperWorld.
This sounds reasonable, given that DOMWrapperWorld doesn't require an associated URL or domain I don't think we can come up with a better solution in this case.
Peter Wang
Comment 8
2012-06-26 03:48:10 PDT
Is someone working on it now? If not, I'd like to have a try.
Timothy Hatcher
Comment 9
2012-06-28 10:20:49 PDT
I don't think anyone is.
Peter Wang
Comment 10
2012-07-03 19:04:23 PDT
Created
attachment 150707
[details]
Patch
Gavin Barraclough
Comment 11
2012-07-04 23:52:39 PDT
Comment on
attachment 150707
[details]
Patch Looks good to me.
Leo Yang
Comment 12
2012-07-05 00:21:50 PDT
Comment on
attachment 150707
[details]
Patch Sending to cq.
WebKit Review Bot
Comment 13
2012-07-05 01:20:05 PDT
Comment on
attachment 150707
[details]
Patch Clearing flags on attachment: 150707 Committed
r121891
: <
http://trac.webkit.org/changeset/121891
>
WebKit Review Bot
Comment 14
2012-07-05 01:20:12 PDT
All reviewed patches have been landed. Closing bug.
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