Open
Bug 1296882
Opened 8 years ago
Updated 9 months ago
WebExtensions should not be subject to the popup blocker
Categories
(WebExtensions :: General, defect, P3)
Tracking
(Not tracked)
REOPENED
People
(Reporter: dteviot, Unassigned)
References
Details
(Whiteboard: [design-decision-approved]triaged)
Attachments
(1 file)
2.54 KB,
application/zip
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Steps to reproduce: I have a Web Extension. If I call Window.open() in response to a user clicking a button, it works. If I call Window.open() in the callback to, say, chrome.tabs.query() no window opens. Example code ```javascript function onOpenWindowWithClickButton() { let url = chrome.extension.getURL("tab.html"); window.open(url, "_blank"); } function onOpenWindowWithCallbackButton() { chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) { onOpenWindowWithClickButton(); }); } // actions to do when window opened window.onload = function () { // add onClick event handlers document.getElementById("openWindowWithClickButton").onclick = onOpenWindowWithClickButton; document.getElementById("openWindowWithCallbackButton").onclick = onOpenWindowWithCallbackButton; } ``` Attached is minimal extension to demonstrate behaviour. Problem occurs on both Firefox 48 and 50. Actual results: No window appears when call Window.open in callback. Expected results: Window should be created
Updated•8 years ago
|
Component: Untriaged → WebExtensions
Product: Firefox → Toolkit
Comment 1•8 years ago
|
||
This is because the popup blocker only allows window.open to be called in direct response to user interaction. If you want to open a window asynchronously, you can use browser.windows.create or browser.tabs.create.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Updated•8 years ago
|
Status: RESOLVED → REOPENED
Component: WebExtensions → WebExtensions: General
Ever confirmed: true
Resolution: INVALID → ---
Summary: Window.open() does not work from callback in WebExtension. → WebExtensions should not be subject to the popup blocker
Whiteboard: [design-decision-needed]
Updated•8 years ago
|
Priority: -- → P2
Whiteboard: [design-decision-needed] → [design-decision-approved]triaged
Updated•7 years ago
|
Priority: P2 → P3
Updated•6 years ago
|
Product: Toolkit → WebExtensions
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•