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

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

Issue 169053005: Allow cross-origin XHR in unblessed extension context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove curly braces Created 6 years, 10 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/renderer/extensions/dispatcher.h ('k') | chrome/renderer/extensions/user_script_slave.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/dispatcher.cc
diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc
index efec6f00ec2d69b78286151e5e256552e423d5b4..97f25ca0ab1d4d56bc34127298f36d57e32e0b30 100644
--- a/chrome/renderer/extensions/dispatcher.cc
+++ b/chrome/renderer/extensions/dispatcher.cc
@@ -529,7 +529,6 @@ void Dispatcher::WebKitInitialized() {
iter != active_extension_ids_.end(); ++iter) {
const Extension* extension = extensions_.GetByID(*iter);
CHECK(extension);
- InitOriginPermissions(extension);
}
EnableCustomElementWhiteList();
@@ -1133,6 +1132,9 @@ void Dispatcher::DidCreateScriptContext(
new ChromeV8Context(v8_context, frame, extension, context_type);
v8_context_set_.Add(context);
+ if (extension)
+ InitOriginPermissions(extension, context_type);
+
{
scoped_ptr<ModuleSystem> module_system(new ModuleSystem(context,
&source_map_));
@@ -1341,17 +1343,18 @@ void Dispatcher::OnActivateExtension(const std::string& extension_id) {
UpdateActiveExtensions();
if (is_webkit_initialized_) {
- InitOriginPermissions(extension);
DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId,
extension_id);
}
}
-void Dispatcher::InitOriginPermissions(const Extension* extension) {
+void Dispatcher::InitOriginPermissions(const Extension* extension,
+ Feature::Context context_type) {
// TODO(jstritar): We should try to remove this special case. Also, these
// whitelist entries need to be updated when the kManagement permission
// changes.
- if (extension->HasAPIPermission(APIPermission::kManagement)) {
+ if (context_type == Feature::BLESSED_EXTENSION_CONTEXT &&
+ extension->HasAPIPermission(APIPermission::kManagement)) {
WebSecurityPolicy::addOriginAccessWhitelistEntry(
extension->url(),
WebString::fromUTF8(content::kChromeUIScheme),
@@ -1362,7 +1365,7 @@ void Dispatcher::InitOriginPermissions(const Extension* extension) {
AddOrRemoveOriginPermissions(
UpdatedExtensionPermissionsInfo::ADDED,
extension,
- extension->GetActivePermissions()->explicit_hosts());
+ PermissionsData::GetEffectiveHostPermissions(extension));
}
void Dispatcher::AddOrRemoveOriginPermissions(
« no previous file with comments | « chrome/renderer/extensions/dispatcher.h ('k') | chrome/renderer/extensions/user_script_slave.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698