m90 m90 - 7 months ago 36
Javascript Question

Using chrome.runtime.sendMessage does not yield a response in Firefox Web Extension

I'm trying to write a cross browser extension that is using a background script and a popup that cross-communicate:

In the background script:

class Listener{
chrome.runtime.onMessage.addListener((transmission, sender, messageResponseFn) => {
cb(transmission, messageResponseFn);
return true;

export default new Listener();

In the popup:

class Emitter{
send(message, payload){
return new Promise((resolve, reject) => {
chrome.runtime.sendMessage({ message, payload }, (responseMessage) => {

export default new Emitter();

This works as expected in Chrome, yet in Firefox the sent response (the function is called correctly and does not throw) will never arrive in my
. Am I using this API wrong? Are there any differences between Firefox and Chrome that I am not aware of? From what I read in the docs the
API should be fully supported.

FWIW, here's an example repository demonstrating the issue: https://github.com/m90/firefox-webextension-issue

m90 m90

This is a confirmed bug in the WebExtension API so there's not much to do about it.