Bug 86361 - Web Inspector: [Extensions API] allow extensions to evaluate in the context of their content scripts
Summary: Web Inspector: [Extensions API] allow extensions to evaluate in the context o...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andrey Kosyakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-14 05:19 PDT by Andrey Kosyakov
Modified: 2012-05-14 09:34 PDT (History)
9 users (show)

See Also:


Attachments
Patch (19.48 KB, patch)
2012-05-14 05:25 PDT, Andrey Kosyakov
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Kosyakov 2012-05-14 05:19:04 PDT
This exposes additional options to inspectedWindow.eval() and SidebarPane.setExpression() that allow extensions to specify that evaluation should be performed in the context of the content script of those extensions.
Comment 1 Andrey Kosyakov 2012-05-14 05:25:14 PDT
Created attachment 141700 [details]
Patch
Comment 2 Yury Semikhatsky 2012-05-14 07:27:43 PDT
Comment on attachment 141700 [details]
Patch

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

> Source/WebCore/inspector/front-end/ExtensionAPI.js:419
> +        var callback = extractCallbackArgument(arguments);

Can we avoid this and have callback at a fixed position? Probably do it by passing an arguments map as the firs parameter instead of expression string as you suggested?

> Source/WebCore/inspector/front-end/ExtensionServer.js:729
> +     * @param {Object} options

Please keep parameter annotations in the same order as the parameters.

> Source/WebCore/inspector/front-end/JavaScriptContextManager.js:208
> +        function comparator(securityOrigin, context)

I'd rather use a linear search here.

> Source/WebCore/inspector/front-end/JavaScriptContextManager.js:216
> +            return this._isolatedContexts[index];

Pleas add explicit return statement for the case when there is no context matching that security origin.
Comment 3 Andrey Kosyakov 2012-05-14 09:26:44 PDT
Comment on attachment 141700 [details]
Patch

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

>> Source/WebCore/inspector/front-end/ExtensionAPI.js:419
>> +        var callback = extractCallbackArgument(arguments);
> 
> Can we avoid this and have callback at a fixed position? Probably do it by passing an arguments map as the firs parameter instead of expression string as you suggested?

As discussed offline -- we'd like expression to appear on its own as it's a mandatory parameter.

>> Source/WebCore/inspector/front-end/ExtensionServer.js:729
>> +     * @param {Object} options
> 
> Please keep parameter annotations in the same order as the parameters.

Fixed!

>> Source/WebCore/inspector/front-end/JavaScriptContextManager.js:208
>> +        function comparator(securityOrigin, context)
> 
> I'd rather use a linear search here.

Done!

>> Source/WebCore/inspector/front-end/JavaScriptContextManager.js:216
>> +            return this._isolatedContexts[index];
> 
> Pleas add explicit return statement for the case when there is no context matching that security origin.

Done.
Comment 4 Andrey Kosyakov 2012-05-14 09:34:56 PDT
Committed r116957: <http://trac.webkit.org/changeset/116957>