Closed Bug 1419713 Opened 8 years ago Closed 8 years ago

openPopup resolves before popup opens

Categories

(WebExtensions :: Frontend, defect)

57 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: hanu6, Unassigned)

Details

Attachments

(1 file)

1012 bytes, application/x-zip-compressed
Details
Attached file test-1.0.zip
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20100101 Steps to reproduce: Open popup window with browser.browserAction.openPopup() and then try to get a reference to it with browser.extension.getViews. try the test-1.0.zip. If put in a delay before you getView then it works. There is a big difference in delay if the toolbar button is hidden in the overflow menu. Uncomment the .then(() => wait... lines if you want to see it. Actual results: openPopup resolves before the popup is open, so then getViews returns nothing. Expected results: I'd hope openPopup should resolve after the popup opens.
Component: Untriaged → WebExtensions: Frontend
Product: Firefox → Toolkit
We generally avoid making APIs wait for things like this if there is another way to get that information. In this case you can listen for the "load" event in the popup page and then send a message to the background script indicating that the popup is loaded.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
How do I know when the popup has opened if it opens a webpage I have no control over. I.e. I use browser.browserAction.setPopup({"popup": "https://www.google.com"}) before openPopup(). I can't listen for a load event then? How do I get around this? I wish to inject CSS, and because the timings are different depending on the button location it's gonna be clunky to use setTimeouts
Loading web pages into these frames is not the intended use case. We probably should actually prevent that.
Using an iframe in the popup may be of help my case. Is that not an intended use case either, then? Loading pages in the popup is pretty useful; doesn't break the flow while browsing.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: