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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 2028833002: [Extensions] Expand capabilities to about:blank iframes within a page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/content_capabilities/foo.example.com.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 422c0aeed949defc7e3d78c9e362369afa03ac0e..f78382297e1c39fe5935a3bbb5078202decf166b 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -1449,9 +1449,15 @@ void Dispatcher::UpdateContentCapabilities(ScriptContext* context) {
APIPermissionSet permissions;
for (const auto& extension :
*RendererExtensionRegistry::Get()->GetMainThreadExtensionSet()) {
+ blink::WebLocalFrame* web_frame = context->web_frame();
+ GURL url = context->url();
+ // We allow about:blank pages to take on the privileges of their parents if
+ // they aren't sandboxed.
+ if (web_frame && !web_frame->getSecurityOrigin().isUnique())
+ url = ScriptContext::GetEffectiveDocumentURL(web_frame, url, true);
const ContentCapabilitiesInfo& info =
ContentCapabilitiesInfo::Get(extension.get());
- if (info.url_patterns.MatchesURL(context->url())) {
+ if (info.url_patterns.MatchesURL(url)) {
APIPermissionSet new_permissions;
APIPermissionSet::Union(permissions, info.permissions, &new_permissions);
permissions = new_permissions;
« no previous file with comments | « chrome/test/data/extensions/content_capabilities/foo.example.com.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698