browser.windows.create() fails when there are no windows
Categories
(WebExtensions :: General, defect, P3)
Tracking
(firefox119 fixed)
Tracking | Status | |
---|---|---|
firefox119 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
Details
(Whiteboard: [addons-jira])
browser.windows.create()
fails to open a window when there are no browser windows.
STR:
- Open the Browser Console.
- Close all browser windows.
- In the Browser Console, switch to Multiprocess and inspect any of the extensions (there are some built-ins ones, so even if you don't inspect any, there is one).
- Run:
browser.windows.create({})
- Run:
browser.windows.create({url: "https://example.com"})
Expected:
- Step 4 should open a browser window.
- Step 5 should open a browser window with example.com loaded.
Actual:
- Step 4 does not open a window.
- Step 5 works as expected.
Closing an re-opening the Browser Console shows the following error from step 4:
window is null ext-windows.js:163
getTriggeringPrincipalForUrl
chrome://browser/content/parent/ext-windows.js:163
create
chrome://browser/content/parent/ext-windows.js:346
The issue happens because when url
is not set, then the implementation attempts to determine whether the "current window" is a private browsing window in order to choose the right origin attributes as needed. But when there are no windows (or similarly, if the extension is not allowed access to private windows and the only active window is a private window), then the failure happens because this window
will be null: https://searchfox.org/mozilla-release/rev/c916c520d3573ff1935fba2af55bffc375ff7890/browser/components/extensions/parent/ext-windows.js#155
Updated•1 years ago
|
Updated•1 years ago
|
Updated•1 years ago
|
Assignee | ||
Comment 1•1 year ago
|
||
I'm fixing this in another patch.
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Description
•