Bug 1761828 Comment 4 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Hey Luca, can you look into this error? One of my extensions is doing what basically amounts to this:
```
browser.windows.onFocusChanged.addListener(
  async (updateTabInfo) => await browser.tabs.getCurrent()
);
```
And the extension is working perfectly fine but it's logging errors when I focus a window:
```
NS_ERROR_XPC_SECURITY_MANAGER_VETO: ExtensionChild.jsm:629
    callAsyncFunction resource://gre/modules/ExtensionChild.jsm:629
    stub resource://gre/modules/Schemas.jsm:2847
    loadLatestData moz-extension://e158f52d-b5db-4594-9757-1e526a5df811/newtab.js:187
    apply self-hosted:2719
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:693
    fire resource://gre/modules/ExtensionChild.jsm:838
    recvRunListener resource://gre/modules/ExtensionChild.jsm:842
    recvRunListener self-hosted:1165
    _recv resource://gre/modules/ConduitsChild.jsm:82
    receiveMessage resource://gre/modules/ConduitsChild.jsm:188
    (Async: JSActor query)
    _send resource://gre/modules/ConduitsChild.jsm:65
    _send resource://gre/modules/ConduitsParent.jsm:290
    _send self-hosted:1269
    listener resource://gre/modules/ExtensionParent.jsm:1081
    apply self-hosted:2719
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:693
    applySafe resource://gre/modules/ExtensionParent.jsm:553
    async resource://gre/modules/ExtensionCommon.jsm:2577
    (Async: promise callback)
    async resource://gre/modules/ExtensionCommon.jsm:2574
    listener chrome://browser/content/parent/ext-windows.js:66
    (Async: promise callback)
    listener chrome://browser/content/parent/ext-windows.js:59
    (Async: EventListener.handleEvent)
    _addWindowListener chrome://extensions/content/parent/ext-tabs-base.js:1853
    addListener chrome://extensions/content/parent/ext-tabs-base.js:1788
    onFocusChanged chrome://browser/content/parent/ext-windows.js:72
    onFocusChanged self-hosted:1165
    registerEventListener resource://gre/modules/ExtensionCommon.jsm:413
    register resource://gre/modules/ExtensionCommon.jsm:2253
    addListener resource://gre/modules/ExtensionCommon.jsm:2653
    addListener resource://gre/modules/ExtensionCommon.jsm:2717
    recvAddListener resource://gre/modules/ExtensionParent.jsm:1127
    InterpretGeneratorResume self-hosted:1472
    AsyncFunctionNext self-hosted:682
    (Async: async)
    recvAddListener self-hosted:1165
    _recv resource://gre/modules/ConduitsChild.jsm:82
    receiveMessage resource://gre/modules/ConduitsParent.jsm:450
```
which I guess the exception is sanitized and reported further downstream:
```
InvalidStateError: An exception was thrown newtab.js:187
```
Anyway, that ExtensionChild.jsm:629 is this line:
```
    const isHandlingUserInput =
      context.contentWindow?.windowUtils?.isHandlingUserInput;
```
Such a strange coincidence that I would just happen to notice this myself haha
Hey Luca, can you look into this error? One of my extensions is doing what basically amounts to this:
```
browser.windows.onFocusChanged.addListener(
  async (updateTabInfo) => await browser.tabs.getCurrent()
);
```
And the extension is working perfectly fine but it's logging errors when I focus a window:
```
NS_ERROR_XPC_SECURITY_MANAGER_VETO: ExtensionChild.jsm:629
    callAsyncFunction resource://gre/modules/ExtensionChild.jsm:629
    stub resource://gre/modules/Schemas.jsm:2847
    loadLatestData moz-extension://e158f52d-b5db-4594-9757-1e526a5df811/newtab.js:187
    apply self-hosted:2719
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:693
    fire resource://gre/modules/ExtensionChild.jsm:838
    recvRunListener resource://gre/modules/ExtensionChild.jsm:842
    recvRunListener self-hosted:1165
    _recv resource://gre/modules/ConduitsChild.jsm:82
    receiveMessage resource://gre/modules/ConduitsChild.jsm:188
    (Async: JSActor query)
    _send resource://gre/modules/ConduitsChild.jsm:65
    _send resource://gre/modules/ConduitsParent.jsm:290
    _send self-hosted:1269
    listener resource://gre/modules/ExtensionParent.jsm:1081
    apply self-hosted:2719
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:693
    applySafe resource://gre/modules/ExtensionParent.jsm:553
    async resource://gre/modules/ExtensionCommon.jsm:2577
    (Async: promise callback)
    async resource://gre/modules/ExtensionCommon.jsm:2574
    listener chrome://browser/content/parent/ext-windows.js:66
    (Async: promise callback)
    listener chrome://browser/content/parent/ext-windows.js:59
    (Async: EventListener.handleEvent)
    _addWindowListener chrome://extensions/content/parent/ext-tabs-base.js:1853
    addListener chrome://extensions/content/parent/ext-tabs-base.js:1788
    onFocusChanged chrome://browser/content/parent/ext-windows.js:72
    onFocusChanged self-hosted:1165
    registerEventListener resource://gre/modules/ExtensionCommon.jsm:413
    register resource://gre/modules/ExtensionCommon.jsm:2253
    addListener resource://gre/modules/ExtensionCommon.jsm:2653
    addListener resource://gre/modules/ExtensionCommon.jsm:2717
    recvAddListener resource://gre/modules/ExtensionParent.jsm:1127
    InterpretGeneratorResume self-hosted:1472
    AsyncFunctionNext self-hosted:682
    (Async: async)
    recvAddListener self-hosted:1165
    _recv resource://gre/modules/ConduitsChild.jsm:82
    receiveMessage resource://gre/modules/ConduitsParent.jsm:450
```
which I guess the exception is sanitized and reported further downstream:
```
InvalidStateError: An exception was thrown newtab.js:187
```
Anyway, that ExtensionChild.jsm:629 is this line:
```
    const isHandlingUserInput =
      context.contentWindow?.windowUtils?.isHandlingUserInput;
```
Such a strange coincidence that I would just happen to notice this myself haha.

[Here's the addon](https://github.com/wildskyf/tab-notes) if that helps.

Back to Bug 1761828 Comment 4