The extension messaging stopped working on our app after we've updated to version 144.
While the changelog doesnt include anything relevant Gemini said this:
In Chrome 144:
Chrome now supports returning a Promise directly from the listener.
The Problem: If a library uses an async function for a listener (which implicitly returns a Promise) but also tries to use return true (or just falls through without returning a value), Chrome 144 sees the implicit Promise, waits for it to resolve (often to undefined), and immediately sends null back to the sender, closing the channel.
The Result: Your UI calls a function in the background, the background starts working, but the browser "hangs up" the phone immediately, causing the UI to receive null or an error instead of the actual wallet data.
We managed to patch it for now by editing the extension.ts like this:
diff --git a/lib/index.js b/lib/index.js
index 53af202d3facd4b7e326672c99f56767626bada7..c13e634f465e038bb7dc5272126c7ec476a0b7d9 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -21,11 +21,22 @@ function defineExtensionMessaging(config) {
);
},
addRootListener(processMessage) {
- const listener = (message, sender) => {
- if (typeof message === "object")
- return processMessage(__spreadProps(__spreadValues({}, message), { sender }));
- else
- return processMessage(message);
+ // Chrome 144 fix: Use synchronous listener with sendResponse callback pattern
+ const listener = (message, sender, sendResponse) => {
+ // Chrome 144 fix: Check message format synchronously
+ if (typeof message !== "object" || message === null) {
+ return false; // Let other listeners handle non-object messages
+ }
+ const enrichedMessage = __spreadProps(__spreadValues({}, message), { sender });
+ const result = processMessage(enrichedMessage);
+ // Chrome 144 fix: If no handler matched (undefined), return false synchronously
+ // This allows other listeners (like @webext-core/proxy-service) to handle the message
+ if (result === undefined) {
+ return false;
+ }
+ // Handler matched - result is a Promise, use sendResponse callback pattern
+ result.then(response => sendResponse(response)).catch(() => sendResponse(undefined));
+ return true; // Signal async response
};
Browser.runtime.onMessage.addListener(listener);
return () => Browser.runtime.onMessage.removeListener(listener);
The extension messaging stopped working on our app after we've updated to version 144.
While the changelog doesnt include anything relevant Gemini said this:
We managed to patch it for now by editing the
extension.tslike this: