Support pageAction.openPopup() without user gesture like browserAction.openPopup() (and fix a few bugs)
Categories
(WebExtensions :: General, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: robwu, Unassigned)
References
Details
(Whiteboard: [addons-jira])
The action.openPopup and browserAction.openPopup methods have evolved, but the pageAction.openPopup() method has not:
- In bug 1755763,
action.openPopupstopped requiring a user gesture, with the requirement being dropped in bug 1799344. - The same bug introduced support for the
windowIdparameter. In practice only the active window is supported, however (bug 2011516).
In the implementation, the popup instance is assigned to popupNode, a per-extension variable. In practice, only one popup exists per window. But in rare cases (e.g. when "Disable Popup Auto-hide" is enabled in the devtools), it is possible for more than one popup to be open. The logic there is not prepared for it.
Additionally, a few lines later, popupNode is cleared when the popup is hiding. But a few lines later, after an await this.popupNode.contentReady, popupNode is used again. This could potentially be the wrong popupNode, and either result in a thrown error (if popupNode is cleared), or in the new panel to be closed. Additionally stopwatchFinish call could be skipped due to the thrown error.
I spotted these issues while developing a patch for bug 1799347, but to keep the scope small I ignored the pre-existing issues. Luca also noticed the flaw of the per-window issue in a review comment at https://phabricator.services.mozilla.com/D280519#inline-1530181
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Description
•