Closed Bug 1655898 Opened 4 years ago Closed 4 years ago

Creating named windows to an extension URL opens duplicate tabs

Categories

(WebExtensions :: Compatibility, defect)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1655903

People

(Reporter: pbone, Unassigned, NeedInfo)

References

Details

Attachments

(1 file)

Reported by CoolCmd as part of Bug 1653537, opening named windows to an extension URL will open duplicate windows, rather than refocusing the previously opened window.

Steps to reproduce:

install attached extension.
open https://example.com/
click the page. a new tab should open.
switch to this tab.

Actual results:

2 clicks open 2 tabs.

Expected results:

2 clicks should open 1 tab (like in Chrome 84).

Depends on Bug 1653537 because you'll likely need that fixed to fix this.

Attached file bug2.zip

The relevant code in the extension is:

document.addEventListener('click', e => {   
    e.preventDefault();
    window.open(chrome.runtime.getURL('coolcmd.html'), 'bug2');
});

See https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-names step 7. The browsing context of the example.com tab might not be "familiar with" the browsing context of the opened, named extension tab. I don't know enough about web stuff to interpret the rules for familiar with, so I don't know if Firefox is correct or not.

Bug 1599579 is possibly also related.

See Also: → 1599579

This is very likely caused by bug 1599579, as we currently throw away information like context names when switching browsing context groups. I'm not sure how easily this can be fixed now, as previously the pop-up with the extension URI would be loaded in the same BCG as the opener content script, whereas now it would be opened in a different group, as we can't have it be in the same group as the content page.

ni? for :zombie and :kmag who might have thoughts about what behaviour we want here.

Flags: needinfo?(tomica)
Flags: needinfo?(kmaglione+bmo)

Even when the name is preserved (by the work around in Bug 1653537) it looks like the link between the windows is broken, because a second window is opened, but "window.name" in the console gives the correct name. So I don't know if it's correct to open two or one windows when the linked URL is a web extension.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(kmaglione+bmo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: