browser.extension.getViews does not return extension popups from private windows

NEW
Unassigned

Status

defect
P3
normal
2 years ago
Last year

People

(Reporter: mauriciosimoeso, Unassigned)

Tracking

(Blocks 2 bugs)

54 Branch
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [extension])

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.46

Steps to reproduce:

When calling browser.extension.getViews({type: "popup"}) from a background page the popups on private pages are not listed.

The documentation about the function (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/extension/getViews) says nothing about any restrictions on the page context (Private or non private).

I've seen another bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1309620) that may be related to this one, but I'm not sure. In this bug is said that private windows cannot access content on non-private windows, but the background page is something different.

This function on chrome does return all popups, even the ones in a private window.


Actual results:

The function returned an empty list.


Expected results:

The function should return a list with all popup windows open in that moment.
Component: Untriaged → WebExtensions: General
Product: Firefox → Toolkit
Priority: -- → P3
Whiteboard: [extension]
(In reply to Maurício Simões de Oliveira from comment #0)
> This function on chrome does return all popups, even the ones in a private
> window.

In Chrome, all extension pages run in normal browsing mode by default.
Incognito access is disabled by default too; If the user opts in to enabling the extension in incognito mode, then the popup will still be shown in normal browsing mode.
An extension can set "incognito":"split" in manifest.json to render the popup of incognito windows in an incognito profile.

Firefox does not support split incognito mode, and renders the popup in normal or private browsing mode, depending on the window.
In the past, Firefox also included the private popup window in getViews(), but it was not accessible to the background page (throwing a security error upon trying): bug 1309620 (the bug you linked).

We could do any of the following here:
- Not change anything and mark this bug as WONTFIX + document this difference in private browsing handling on MDN

- If incognito:"spanning" is used, always render popups in the non-private-browsing profile.
  (this should be done if we want compatibility with Chrome).


Test case for QA:
1. Install any extension with an extension popup, e.g. uBlock Origin.
2. Open the debugger for the extension, via the steps at https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Debugging#The_Add-on_Debugger
3. Ensure that the popup stays open, via the steps at https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Debugging#Debugging_popups
4. Open a Private browsing window (Ctrl-Shift-P)
5. Click on the extension popup.
6. Open the console of the debugger from step 2, and type: browser.extension.getViews({type:'popup'})

Expected: an array with one window: [window]
Actual  : [] (empty array)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: browser.extension.getViews → browser.extension.getViews does not return extension popups from private windows
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.