是否有允许 content/background 脚本在 chrome 网上商店中打开时执行的解决方法?

Is there a work-around for allowing content/background scripts to execute while open in the chrome web store?

我花了几个小时试图弄清楚为什么我的 Chrome 扩展程序没有工作,因为它应该只是发现 Google Chrome 网上商店显然可以不允许扩展在打开时做某些事情。

我已经在 SO 上阅读了这个帖子,虽然它现在已有 2 年历史并且发布的解决方案对我不起作用:

我在 OS X Yosemite 上 运行 宁 Chrome 版本 41.0.2272.118 (64-bit)。 正如建议的回复之一,我已经 运行 命令 open /Applications/Google\ Chrome.app --args --allow-scripting-gallery; 但我的扩展程序的内容脚本仍然不会 运行 在网上商店中。我要做的就是使用 chrome.runtime.sendMessagechrome.runtime.onMessage 在内容脚本和后台脚本之间进行通信。

Google 是否已决定完全删除这些功能,或者现在是否有新命令?

是的,他们已经删除了它。估计是被虐了。

您可以在 chrome://flags

上查阅当前支持的标志列表

或者,有一个列表,直接从源代码中提取,位于 http://peter.sh/experiments/chromium-command-line-switches/

P.S。要获得更多证据,这里是同一源文件的 newer version

bool ChromeExtensionsClient::IsScriptableURL(
    const GURL& url, std::string* error) const {
  // The gallery is special-cased as a restricted URL for scripting to prevent
  // access to special JS bindings we expose to the gallery (and avoid things
  // like extensions removing the "report abuse" link).
  // TODO(erikkay): This seems like the wrong test.  Shouldn't we we testing
  // against the store app extent?
  GURL store_url(extension_urls::GetWebstoreLaunchURL());
  if (url.host() == store_url.host()) {
    if (error)
      *error = manifest_errors::kCannotScriptGallery;
    return false;
  }
  return true;
}

如您所见,任何基于开关的逻辑都不再存在; CWS URL 总是被认为是不可编写脚本的。