Open
Bug 1409375
Opened 7 years ago
Updated 2 years ago
Should we support window.close() for closing extensions pages?
Categories
(WebExtensions :: General, enhancement, P3)
WebExtensions
General
Tracking
(Not tracked)
NEW
People
(Reporter: mkaply, Unassigned)
References
Details
Sometimes extensions use a standard web page as their options page.
To do this, they display their page and then close the options page.
This is allows on Chrome. It should be allowed on Firefox.
Comment 1•7 years ago
|
||
It can call browser.tab.close() I believe? Presumably you want to call window.close()?
Reporter | ||
Comment 2•7 years ago
|
||
> It can call browser.tab.close() I believe?
Well there's browser.tabs.remove, but you have to pass a tab ID. There's not an easy way to just close the tab you are in.
> Presumably you want to call window.close()?
Yes. In migrating Chrome code, you have the ability to use window.close() to close your own options page.
Reporter | ||
Comment 3•7 years ago
|
||
The specific error is "Scripts may not close windows that were not opened by script." which is not correct.
This also happens when you try to close your own new tab page (which again works on Chrome).
Reporter | ||
Comment 4•7 years ago
|
||
So you are correct. Querying current tab and removing works. So I guess the question is should we support window.close or require that people change to tabs.remove.
Should this move to untriaged?
Component: WebExtensions: General → WebExtensions: Untriaged
Summary: A WebExtension should be able to close its own Options Page → Should we support window.close() for closing extensions pages?
Comment 5•7 years ago
|
||
See also bug 1301227, that lets you enable window.close() when creating a new window with browser.windows.create(). It doesn't handle the options page though. Options pages are kind of a mess though, what do we do if an extension calls window.close() on an inline options page?
Updated•7 years ago
|
status-firefox57:
--- → wontfix
Priority: -- → P3
Comment 6•7 years ago
|
||
Actually, this is more about tabs created with browser.tabs.create() - closing these via window.close() still isn't possible as of current Firefox 57 nightly. The solution is sending a message to the background page that will give you your tabId back, then calling browser.tabs.remove().
Updated•7 years ago
|
Blocks: webext-port-abp
Updated•7 years ago
|
Product: Toolkit → WebExtensions
Comment 8•6 years ago
|
||
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
status-firefox57:
wontfix → ---
Component: Untriaged → General
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•