私のマニフェスト:
{
"name":"name",
"version":"0.1",
"manifest_version":2,
"description":"name app",
"background":{
"scripts":[
"scripts/modernizr.min.js",
"scripts/background.js"
],
"persistent": false
},
"content_scripts": [
{
"matches": ["https://*/*", "http://*/*"],
"js": ["scripts/content.js"],
"run_at": "document_end"
}
],
"permissions":[
"contextMenus",
"tabs",
"http://*/*",
"https://*/*"
],
"icons":{
"16":"images/icon_16.png",
"128":"images/icon_128.png"
}
}
Background.js には次の関数があります。
chrome.contextMenus.onClicked.addListener( function( info, tab )
{
... stuff ...
chrome.tabs.sendMessage( tab.id, { action: "showLibraryUI", library: library }, function( response ){} );
} );
content.js にはリッスンする関数がありますが、呼び出されることはありません。
chrome.runtime.onMessage.addListener( function( request, sender, sendResponse )
{
...stuff...
} );
拡張機能の _generated_background_page.html には、次のように表示されます。
ポート: 接続を確立できませんでした。受信側が存在しません。lastError:29 set lastError:29 dispatchOnDisconnect その他のバインディング:259
ここSOの他の投稿では、マニフェスト> 2.0の解決策が見つかりませんでした。