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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 1025613003: Fix for ERROR:url_pattern_set.cc(240)] Invalid url pattern: chrome://print/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding exception for component extensions. Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 87ea7bcffdb2f02ea9e7533792d6e17ea644af20..e62c0850c048bcc1fe9f05506e61f0be1b881d0b 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -563,7 +563,8 @@ bool ExtensionPrefs::ReadPrefAsBooleanAndReturn(
PermissionSet* ExtensionPrefs::ReadPrefAsPermissionSet(
const std::string& extension_id,
const std::string& pref_key) {
- if (!GetExtensionPref(extension_id))
+ const base::DictionaryValue* extensions = GetExtensionPref(extension_id);
+ if (!extensions)
return NULL;
// Retrieve the API permissions. Please refer SetExtensionPrefPermissionSet()
@@ -597,9 +598,17 @@ PermissionSet* ExtensionPrefs::ReadPrefAsPermissionSet(
// Retrieve the scriptable host permissions.
URLPatternSet scriptable_hosts;
- ReadPrefAsURLPatternSet(
- extension_id, JoinPrefs(pref_key, kPrefScriptableHosts),
- &scriptable_hosts, UserScript::ValidUserScriptSchemes());
+ int location_value;
+ int valid_schemes = UserScript::ValidUserScriptSchemes();
+ // Adding CHROMEUI scheme in valid schemes mask if extension is component
+ // extension.
+ if (extensions->GetInteger(kPrefLocation, &location_value) &&
+ Manifest::COMPONENT == static_cast<Manifest::Location>(location_value)) {
Ken Rockot(use gerrit already) 2015/03/24 16:49:09 nit: Please swap the operand order here. i.e.: st
+ valid_schemes |= URLPattern::SCHEME_CHROMEUI;
+ }
+ ReadPrefAsURLPatternSet(extension_id,
+ JoinPrefs(pref_key, kPrefScriptableHosts),
+ &scriptable_hosts, valid_schemes);
return new PermissionSet(
apis, manifest_permissions, explicit_hosts, scriptable_hosts);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698