deanishe / alfred-firefox

Search and control Firefox from Alfred
Other
345 stars 19 forks source link

remove promise chain in sendNative -- postMessage does not return anything #24

Open brttbndr opened 3 years ago

brttbndr commented 3 years ago

During normal use of the extension, I noticed error-like output in the browser console (Cmd-Shift-J)

After poking around with the debugger and reading up on native messaging, I've concluded that postMessage does not return anything (and in particular, not a promise that can chain then and catch).

Without this change, each call from receiveNative to sendNative posts a message, raises a TypeError, which ends up calling sendNative again via sendError

With this change, the errors are eliminated, and the sent message is logged.

Before

image

After

image