バックグラウンドスクリプト内のイベントにアクセスできません。 (私はすべての私の他の拡張を無効にしている、Chromeバージョン:バージョン59.0.3071.115(公式ビルド)(64ビット)バックグラウンドスクリプトで、chrome.runtimeが定義されていません
が、これがまた同じ問題が動作しない、拡張子zipファイルをダウンロード https://drive.google.com/file/d/0B2PMiyi-mpArcmlwVTl0UUFjNTA/view?usp=sharing
。マニフェスト:
"background": {
"page": "client_base/host/chrome/index.html",
"persistent": true
},
"content_scripts": [
{
"matches": [
"*://mail.google.com/*"
],
"css": [
"/gmail_ext/content_script.css"
],
"js": [
"/gmail_ext/loader.js"
],
"run_at": "document_end"
}
],
コンテンツスクリプト:
var getContactsPort = chrome.runtime.connect('getContacts');
getContactsPort.postMessage({greeting: "hello"});
getContactsPort.onMessage.addListener(function (message, sender) {
alert(message);
});
背景スクリプト(スクリプトトンでページから呼び出されます道場経由AG、)として未定義chrome.runtime
を示す
chrome.runtime.onConnect.addListener(function (getContactsPort) {
getContactsPort.onMessage.addListener(function (msg) {
console.log(msg);
getContactsPort.postMessage({status: msg.greeting + ' world'});
});
});
デベロッパーツール:おそらく手遅れ
私はGIF動画を共有します必要な場合は、単一のファイルではなく、Dojoプロジェクト全体を共有することはできません – STEEL
@wOxxOm zipファイルhttps://drive.google.com/file/d/0B2PMiyi-mpA rcmlwVTl0UUFjNTA/view?usp = sharing – STEEL
私はバックグラウンドページのdevtoolsデバッガが開かれたときしか再現できません。この問題は、devtoolsのSourcesパネルで通常のブレークポイントを使用することで回避できます。 BTWでは、https://crbug.comでバグレポートを提出できます。再現するのに必要な正確な手順や拡張機能については忘れないでください。 – wOxxOm