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

Unified Diff: chrome/renderer/extensions/extension_dispatcher.cc

Issue 8659009: Consider the origin when computing extension permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
Index: chrome/renderer/extensions/extension_dispatcher.cc
===================================================================
--- chrome/renderer/extensions/extension_dispatcher.cc (revision 112565)
+++ chrome/renderer/extensions/extension_dispatcher.cc (working copy)
@@ -25,6 +25,7 @@
#include "content/public/renderer/render_thread.h"
#include "grit/renderer_resources.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
@@ -41,6 +42,7 @@
using extensions::MiscellaneousBindings;
using extensions::SchemaGeneratedBindings;
using WebKit::WebDataSource;
+using WebKit::WebDocument;
using WebKit::WebFrame;
using WebKit::WebSecurityPolicy;
using WebKit::WebString;
@@ -273,8 +275,9 @@
// Extension-only bindings should be restricted to content scripts and
// extension-blessed URLs.
if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS ||
- extensions_.ExtensionBindingsAllowed(
- UserScriptSlave::GetLatestURLForFrame(frame))) {
+ extensions_.ExtensionBindingsAllowed(ExtensionURLInfo(
+ frame->document().securityOrigin(),
+ UserScriptSlave::GetDataSourceURLForFrame(frame)))) {
return true;
}
@@ -289,8 +292,9 @@
} else if (world_id != 0) {
extension_id = user_script_slave_->GetExtensionIdForIsolatedWorld(world_id);
} else {
- GURL frame_url = UserScriptSlave::GetLatestURLForFrame(frame);
- extension_id = extensions_.GetIdByURL(frame_url);
+ GURL frame_url = UserScriptSlave::GetDataSourceURLForFrame(frame);
+ extension_id = extensions_.GetIdByURL(
+ ExtensionURLInfo(frame->document().securityOrigin(), frame_url));
}
ChromeV8Context* context =
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_extension.cc ('k') | chrome/renderer/extensions/extension_resource_request_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698