Closed Bug 1400264 Opened 7 years ago Closed 6 years ago

WebExtensions browser.tabs.create() creates extra tabs in popup windows when it shouldn't (Screenshots links in a popup window open in the popup)

Categories

(WebExtensions :: Frontend, enhancement, P3)

enhancement

Tracking

(firefox57 affected)

RESOLVED DUPLICATE of bug 1415913
Tracking Status
firefox57 --- affected

People

(Reporter: mkaply, Unassigned)

References

Details

(Whiteboard: [tabs])

If you open a popup window (gmail compose->shift on arrow is easiest) and then use screenshots (My shots or save), you get a new tab in the popup window.

It should open in the main window (we shouldn't do tabs in popup windows).
Blocks: 1366041
Component: General → Screenshots
Product: Firefox → Cloud Services
Version: Trunk → unspecified
AFAICT this is using browser.tabs.create() in the backend (cf. https://github.com/mozilla-services/screenshots/blob/ae5ac734d03cceb40ff7d1511e967f040a4b2a13/addon/webextension/background/main.js#L208 , https://github.com/mozilla-services/screenshots/blob/ae5ac734d03cceb40ff7d1511e967f040a4b2a13/addon/webextension/background/takeshot.js#L57 , etc.). That should be doing the right thing.

Andy, can we get this prioritized within webextensions? This likely affects other add-ons as well.
Component: Screenshots → WebExtensions: Frontend
Flags: needinfo?(amckay)
Product: Cloud Services → Toolkit
Summary: Screenshots links in a popup window open up a new tab in the popup window → WebExtensions browser.tabs.create() creates extra tabs in popup windows when it shouldn't (Screenshots links in a popup window open in the popup)
Can it check https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/windows/WindowType and see if the type it popup before deciding where to open the tab? Presumably it could ask the screenshots content script what window is the opener and then open the window there.

I'll file a bug on github for that: https://github.com/mozilla-services/screenshots/issues/3507

Because there's a workaround, I'm not setting this too high a priority.
Flags: needinfo?(amckay)
Priority: -- → P3
Whiteboard: [tabs]
Also running into this problem with Mailvelope. I see the workaround in comment #2 but I just want to mention that the behavior of browser.tabs.create() in Firefox is currently not compatible to Chrome. When you call chrome.tabs.create() with an active popup window, Chrome will still open a new tab in the opener window.
According to my tests this is fixed in Firefox 59.0b9.
(In reply to Thomas Oberndörfer from comment #4)
> According to my tests this is fixed in Firefox 59.0b9.

Good catch, this was fixed in bug 1415913.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.