Add --allow-scripting-gallery command line switch to allow extensions
and scripts to run on the Chrome Extensions Gallery site. There are
security concerns in enabling this and so it remains off by default,
but this is needed for automation testing of the gallery.
Cleanup: Have UserScriptSlave::InjectScripts() return void instead of a bogus bool.
TEST=Visit http://chrome.google.com/extensions, check that content scripts work when the command-line switch is given, and are not injected when the switch is not given.
BUG=none
Review URL: http://codereview.chromium.org/2912002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51977 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 78c600f..9a915333 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -720,7 +720,9 @@
std::string* error) const {
// No extensions are allowed to execute script on the gallery because that
// would allow extensions to manipulate their own install pages.
- if (url.host() == GURL(Extension::ChromeStoreURL()).host()) {
+ if (url.host() == GURL(Extension::ChromeStoreURL()).host()
+ && !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAllowScriptingGallery)) {
if (error)
*error = errors::kCannotScriptGallery;
return false;