Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Issue 7071025: Use WebFrame::setIsolatedWorldSecurityOrigin to allow cross-origin XHRs in content scripts. (Closed)

Created:
9 years, 7 months ago by Mihai Parparita -not on Chrome
Modified:
9 years, 6 months ago
CC:
chromium-reviews, Erik does not do reviews, Paweł Hajdan Jr., pam+watch_chromium.org, brettw-cc_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Use WebFrame::setIsolatedWorldSecurityOrigin to allow cross-origin XHRs in content scripts. http://trac.webkit.org/changeset/87423 adds the ability to associated a security origin with an isolated world. Use that to make content script isolated worlds use the extension's origin, and whitelist that origin in the page's renderer process for the host permissions in the manifest. BUG=18857 TEST=no R=mpcomplete@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=87114

Patch Set 1 #

Patch Set 2 : Tweak whitespace. #

Total comments: 1

Patch Set 3 : Fix leaking of whitelist origin entries #

Patch Set 4 : Remove ExtensionOriginEntry #

Total comments: 1

Patch Set 5 : Switch to whitelisting effective permissions. #

Total comments: 2

Patch Set 6 : Remove isolated worlds when extension is unloaded #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+181 lines, -80 lines) Patch
M chrome/browser/extensions/cross_origin_xhr_apitest.cc View 1 2 1 chunk +9 lines, -3 lines 0 comments Download
M chrome/common/extensions/extension_messages.cc View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M chrome/renderer/extensions/extension_dispatcher.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 1 comment Download
M chrome/renderer/extensions/user_script_idle_scheduler.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/extensions/user_script_slave.h View 1 2 3 4 5 5 chunks +16 lines, -2 lines 0 comments Download
M chrome/renderer/extensions/user_script_slave.cc View 1 2 3 4 5 3 chunks +55 lines, -8 lines 2 comments Download
A + chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/manifest.json View 0 chunks +-1 lines, --1 lines 0 comments Download
A + chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/test.html View 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/content_script.js View 1 2 1 chunk +29 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/manifest.json View 1 2 3 4 5 1 chunk +5 lines, -1 line 0 comments Download
A chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/test.html View 1 chunk +65 lines, -0 lines 0 comments Download
D chrome/test/data/extensions/api_test/cross_origin_xhr/manifest.json View 1 chunk +0 lines, -7 lines 0 comments Download
D chrome/test/data/extensions/api_test/cross_origin_xhr/test.html View 1 chunk +0 lines, -59 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Mihai Parparita -not on Chrome
9 years, 7 months ago (2011-05-26 22:14:39 UTC) #1
Matt Perry
http://codereview.chromium.org/7071025/diff/1001/chrome/renderer/extensions/user_script_slave.cc File chrome/renderer/extensions/user_script_slave.cc (right): http://codereview.chromium.org/7071025/diff/1001/chrome/renderer/extensions/user_script_slave.cc#newcode78 chrome/renderer/extensions/user_script_slave.cc:78: WebSecurityPolicy::addOriginAccessWhitelistEntry( note that we never clear the origin access ...
9 years, 7 months ago (2011-05-26 22:39:48 UTC) #2
Mihai Parparita -not on Chrome
On 2011/05/26 22:39:48, Matt Perry wrote: > chrome/renderer/extensions/user_script_slave.cc:78: > WebSecurityPolicy::addOriginAccessWhitelistEntry( > note that we never ...
9 years, 7 months ago (2011-05-27 02:03:00 UTC) #3
Matt Perry
http://codereview.chromium.org/7071025/diff/4001/chrome/renderer/extensions/user_script_slave.cc File chrome/renderer/extensions/user_script_slave.cc (right): http://codereview.chromium.org/7071025/diff/4001/chrome/renderer/extensions/user_script_slave.cc#newcode79 chrome/renderer/extensions/user_script_slave.cc:79: void UserScriptSlave::InitializeIsolatedWorld( This seems like a lot of effort ...
9 years, 7 months ago (2011-05-27 19:10:54 UTC) #4
Mihai Parparita -not on Chrome
On Fri, May 27, 2011 at 12:10 PM, <mpcomplete@chromium.org> wrote: > I'm still of the ...
9 years, 7 months ago (2011-05-27 20:44:34 UTC) #5
Matt Perry
> The only thing that this doesn't handle is an extension getting > reloaded with ...
9 years, 7 months ago (2011-05-27 20:55:28 UTC) #6
Mihai Parparita -not on Chrome
On Fri, May 27, 2011 at 1:55 PM, <mpcomplete@chromium.org> wrote: > EXTENSION_UNLOADED isn't fired in ...
9 years, 7 months ago (2011-05-27 22:00:36 UTC) #7
Matt Perry
Cool, LGTM. Now that content scripts can XHR to content_script hosts, we should change it ...
9 years, 7 months ago (2011-05-27 22:14:35 UTC) #8
Aaron Boodman
http://codereview.chromium.org/7071025/diff/7007/chrome/renderer/extensions/user_script_slave.cc File chrome/renderer/extensions/user_script_slave.cc (right): http://codereview.chromium.org/7071025/diff/7007/chrome/renderer/extensions/user_script_slave.cc#newcode85 chrome/renderer/extensions/user_script_slave.cc:85: extension->GetEffectiveHostPermissions().patterns(); Sorry for butting in, but it seems unexpected ...
9 years, 7 months ago (2011-05-29 04:44:09 UTC) #9
Matt Perry
http://codereview.chromium.org/7071025/diff/7007/chrome/renderer/extensions/user_script_slave.cc File chrome/renderer/extensions/user_script_slave.cc (right): http://codereview.chromium.org/7071025/diff/7007/chrome/renderer/extensions/user_script_slave.cc#newcode85 chrome/renderer/extensions/user_script_slave.cc:85: extension->GetEffectiveHostPermissions().patterns(); On 2011/05/29 04:44:09, Aaron Boodman wrote: > Sorry ...
9 years, 6 months ago (2011-05-31 18:13:32 UTC) #10
Aaron Boodman
On Tue, May 31, 2011 at 12:13 PM, <mpcomplete@chromium.org> wrote: > > http://codereview.chromium.org/7071025/diff/7007/chrome/renderer/extensions/user_script_slave.cc > File ...
9 years, 6 months ago (2011-05-31 23:50:16 UTC) #11
Matt Perry
On 2011/05/31 23:50:16, Aaron Boodman wrote: > On Tue, May 31, 2011 at 12:13 PM, ...
9 years, 6 months ago (2011-06-01 00:27:48 UTC) #12
Aaron Boodman
9 years, 6 months ago (2011-06-01 14:23:30 UTC) #13
On Tue, May 31, 2011 at 6:27 PM,  <mpcomplete@chromium.org> wrote:
> OK, that's a good point. We still can't avoid the issue of content scripts
> sometimes getting access to other origins in content_scripts.urls (if other
> scripts happen to be running in those origins). But maybe that's unlikely in
> practice and not as big a deal.

I think that the behavior before this change was that content scripts
could only XHR to the origin of the frame they were running in
(because the isolated world had the same origin has the frame). So it
seems you could lock the behavior down to XHR being allowed to (the
extension's origin, the frame's origin, any origins in the extension's
host permissions). That would remove all the ambiguity.

- a

Powered by Google App Engine
This is Rietveld 408576698