Event registration with proxied APIs is asynchronous. This leads to missing events when a WebExtension API is used with other APIs that would trigger the event. In the next example, I expect an onRemoved event, but I did not receive any, probably because window.close() uses higher-priority IPC than the WebExtensions event implementation. var win = window.open("http://example.com"); // Wait until the window opens and then run the following: browser.tabs.onRemoved(tabId => console.log("Removed tab" + tabId)); win.close();
This test: http://searchfox.org/mozilla-central/rev/950e13cca1fda6507dc53c243295044e8eda4493/toolkit/components/extensions/test/mochitest/test_ext_tab_teardown.html#119 fails because the (extension) tab is hosted in the main process, and calling window.close() synchronously triggers http://searchfox.org/mozilla-central/rev/950e13cca1fda6507dc53c243295044e8eda4493/browser/base/content/tabbrowser.xml#4694 ... so the tab is closed before the asynchronous tabs.onRemoved.addListener event has had a chance to run.
Component: WebExtensions: Untriaged → WebExtensions: General
Summary: Events in ChildAPIManager + ParentAPIManager are out of sync with non-WebExtension APIs → addListener methods should return a promise
You need to log in before you can comment on or make changes to this bug.