I have addon which creates new tab when I click on element. In the new tab I load html page inspector.html which loads page script inspector.js:
chrome.runtime.onMessage.addListener(
function (package){
if (package.command !== "add" )
return false;
$("div#content").append(package.innerhtml);
}
);
So when I clicked in the original tab, message has been send:
if (make_it_easy.tabOpened)
browser.runtime.sendMessage(
{ message:“add”,
subject: “innerhtml”,
innerhtml: innnerhtml,
target: { tab: { id: make_it_easy.tabID } }
// sender:{id:tabs[0].id }
});
Which sends message with innerHTML. However I cannot intercept the message in the page script in the tab. Where is problem? Is the message sent to all existing tabs or to tabs of the addon? I added breakpoint to the line with if (package.command !== "add" )
but the code is not paused on the line when I click element. Notice: when I click the element, the new tab exists but is not selected nor active.