Messages send from a background-script to a content-script are not received in the content-script in ff on android.
content script
var myPort = browser.runtime.connect({name:"port-from-cs"});
myPort.postMessage({greeting: "hello from content script"});
myPort.onMessage.addListener(function(m) {
console.log("In content script, received message from background script: "); // never fires
console.log(m.greeting); // never fires
});
document.body.addEventListener("click", function() {
myPort.postMessage({greeting: "they clicked the page!"});
});
background script
var portFromCS;
function connected(p) {
portFromCS = p;
console.log("post message from background") // ok
portFromCS.postMessage({greeting: "hi there content script!"}); // never received
portFromCS.onMessage.addListener(function(m) {
console.log("In background script, received message from content script")
console.log(m.greeting); // ok
console.log(portFromCS); // ok
console.log(portFromCS.name) // ok
portFromCS.postMessage({greeting: "hi there FROM BACKROUND script!"}); // never received
});
On firefox on windows, things work, on android, the messages to the content-script are lost in the void
Is this a known bug, and are there any known solutions?