I'm working in a Chrome extension. At some point, in a script called CLAWS_Sem_Imagens_Script.js, I send a message from an Iframe inside the page to my background-page with the following line:
chrome.runtime.sendMessage({type:"execution order",sendToContentScript:true, data:"show"});
It works most of the times. However, sometimes, javascript throws the error Cannot read property "name" of undefined, at the line 316 of @extensions::messaging:
if (port.name != kNativeMessageChannel)...
The full call stack is:
sendMessageImpl @ extensions::messaging:316
(anonymous function) @ extensions::runtime:115
target.(anonymous function) @ extensions::SafeBuiltins:19
(anonymous function) @ extensions::binding:57
target.(anonymous function) @ extensions::SafeBuiltins:19
(anonymous function) @ extensions::binding:385
enviaPalavraAoBackgroundPageImagem @ CLAWS_Sem_Imagens_Script.js:66
Do someone has any guess? Please ask me for any additional info you need.
EDIT: My manifest:
{
"manifest_version": 2,
"name": "name",
"description": "description",
"version": "1.0",
"permissions": [
"tabs",
"activeTab",
"https://google.com.br/",
"http://localhost/*",
"https://localhost/*"
],
"background": {"scripts":["background.js"]},
"content_scripts": [
{
"js": ["CLAWS_Content_Script.js", "jquery.js", "Caixas_De_Texto_Dos_Botoes.js"],
"css": ["CLAWS_Content_Script_CSS.css"],
"matches": ["<all_urls>"]
}
],
"web_accessible_resources": [
"iframe.html",
"icon.png",
"Caixas_De_Texto_Dos_Botoes.js",
"search.png"
]
}
"persistent": false)? Where is that error displayed (webpage console or background page console)? And just in case add your manifest.json to the question.