Closed Bug 1799347 Opened 3 years ago Closed 2 months ago

Consider `browserAction.openPopup` behaviour when a popup is already open

Categories

(WebExtensions :: General, task, P3)

task

Tracking

(firefox149 fixed)

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: oliver, Assigned: robwu)

References

Details

(Whiteboard: [wecg][addons-jira])

Attachments

(1 file, 1 obsolete file)

In https://phabricator.services.mozilla.com/D139796 I have been updating the browserAction.openPopup API. One question which came up as part of this is what the behaviour should be when a popup (either from the same addon or another) is already open.

Currently:

  • If the popup is already open for the same addon in a given window, that window is simply focused and the call silently returns.
  • If another addon has a popup open, the popup for the addon calling the API is opened in addition to this.

In each case we have a few different options:

  • Focus the window and show the popup if it is not already showing.
  • Do nothing.
  • Throw an exception.

In the case where the current addon already has a popup open in the given window, my initial preference is to simply focus the window. This matches the behaviour in Safari (https://github.com/w3c/webextensions/issues/160#issuecomment-1127042759). It also makes the most sense to me because without an easy way of detecting if the popup is open (you can use getViews but that's a little hidden) we otherwise risk lots of "errors" in background logs for something which isn't really causing any harm. Chrome currently does throw an error but I suspect this is a bug, since it is not about the popup already being open but instead that there is no active window to show the popup for.

In the case where another addon has a popup open, I suggest that is closed. Arguably this could lead to data loss but I feel that avoiding stacking is desirable and there is already an understanding that the popup can close at any time because this happens as soon as the user focuses another window.

I plan to update this bug soon with more information about the behaviour when multiple addons are showing popups across browsers.

Blocks: 1799344

I've updated the WECG issue with some more information on this.

In Chrome, this always throws. If no windowId is specified the error is about there being no active window. If a windowId is specified, there is instead an error about failing to open the popup.

In Safari, any popups from other extensions are closed and the extension calling the API has its popup shown.

If something unambiguously meaningful can be done, then we should do that. But otherwise we should throw IMO.

I'll continue the discussion in the WECG issue.

Severity: -- → N/A
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [wecg]
Attachment #9384306 - Attachment is obsolete: true
Whiteboard: [wecg] → [wecg][addons-jira]
See Also: → 1967196
Assignee: nobody → rob
Status: NEW → ASSIGNED
See Also: → 2013250
Attachment #9540218 - Attachment description: Bug 1799347 - Reject openPopup() if already open → Bug 1799347 - Reject openPopup() if already open r=rpl
See Also: → 2015895
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch
Flags: needinfo?(rob)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: