windows.create() promise will never be fulfilled
Categories
(WebExtensions :: General, defect)
Tracking
(firefox70 affected, firefox71 affected, firefox72 affected)
People
(Reporter: mrsndmn46, Unassigned)
References
Details
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0
Steps to reproduce:
I installed window-manipulator extension from webextensions-examples. And pushed a "window-create-normal" button
https://github.com/mdn/webextensions-examples/tree/master/window-manipulator
Actual results:
New window was created but no log message has been shown. creating
promise was not fulfilled ( https://github.com/mdn/webextensions-examples/blob/master/window-manipulator/window.js#L30 )
Examples from MDN shouldn work too.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/create#Examples
Expected results:
Log message should be shown.
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Hello,
I have managed to reproduce the issue based on the provided STR on the latest Nightly (72.0a1/ 20191104214406), Beta (71.0b7/20191104135555) and Release (70.0.1/20191030021342) under Ubuntu 18.04.3 LTS and MacOS Catalina 10.15.
On MacOS and Ubuntu, the log message will not be displayed upon clicking the Create Normal Window button provided by the extension.
Also attempted to reproduce the issue on Windows 10 Pro 64-bit, however with no success, as the log message is properly displayed on all tested versions of Firefox.
Comment 2•5 years ago
|
||
I'm closing this as invalid, because the described behavior looks the expected one:
In the webextension example linked in comment 0, windows.create is being called from a browserAction popup which is automatically closed when the popup loses focus and so the caller wouldn't be able to log the console message when the windows.create
promise is resolved after the popup has been destroyed.
The following log is also emitted in the browser console:
Cannot send function call result: other side closed connection (call data: ({path:"windows.create", args:[{allowScriptsToClose:null, cookieStoreId:null, height:null, incognito:null, left:null, state:null, tabId:null, titlePreface:null, top:null, type:null, url:null, width:null}]}))
which confirms that the window.create result was resolved as expected, but too late to be received and handled by the caller.
An extension that wants to wait for and use the value resolved from calling windows.create
should call windows.create
from an extension context that isn't automatically destroyed when it loses focus (e.g. a background page, a sidebar page or a extension tab page etc.).
Comment 3•5 years ago
|
||
As a side note, we should update the webextension-example to do not "suggest" that the browserAction popup window is going to be able to process the value resolved by the promise returned from windows.create
, given that it cannot work consistently due to a race between "the popup losing the focus and being destroyed" vs "the promise returned window.create being resolved" .
I'm adding a note about it in the github issue filed upstream at https://github.com/mdn/webextensions-examples/issues/431
Description
•