2012-07-23 4 views

答えて

28

TL; DRは、ウェブストアは、拡張子によってスクリプト、および以前にあなたが(--allow-scripting-galleryhas been removed in Chrome 35ことを行うことが許さフラグすることはできません。

Chrome拡張機能では、コンテンツスクリプトの実行/ CSSのChromeウェブストアの挿入はできません。これは、the source codeの関数IsScriptableURLで明示的に定義されています(前のリンクをクリックすると完全なロジックが表示されます)。

// 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; 
    } 

manifest_errors::kCannotScriptGalleryhereが定義されています

const char kCannotScriptGallery[] = 
    "The extensions gallery cannot be scripted."; 

あなたがウェブストア]タブでスクリプトを注入するchrome.tabs.executeScriptを使用するときにエラーが背景ページのコンソールで表示することができます。例えば、https://chrome.google.com/webstore/オープン、その後、(ライブデバッグ用のコンソールを介して)延長の背景ページに次のスクリプトを実行します。

chrome.tabs.query({url:'https://chrome.google.com/webstore/*'}, function(result) { 
    if (result.length) chrome.tabs.executeScript(result[0].id, {code:'alert(0)'}); 
}); 
+0

[OK]をコンテンツスクリプトが動作しない、背景ページを経由して道多分あるのでしょうか? これを実行する方法はありません(コマンドラインパラメータ経由以外) – chingo

+0

これ以上動作していないようです(Chrome 31)。私はバグを提出しました - https://code.google.com/p/chromium/issues/detail?id=342090 – kzahel

+2

@kzahelバグを修正しました。あなたは '--allow-scripting-gallery'を(少なくともカナリアのビルドで)使うことができるはずです。 –

関連する問題