Closed Bug 1926373 Opened 3 months ago Closed 3 months ago

Calling window.close() from an "WebExtension"-registered devtools panel shouldn't close the browser chrome window

Categories

(WebExtensions :: Developer Tools, defect, P3)

defect

Tracking

(firefox134 fixed)

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: rpl, Assigned: rking)

References

Details

Attachments

(2 files)

While testing out a corner case related to WebExtensions-registered devtools panel as part of reviewing the patch attached to Bug 1921631, Becca and I have noticed that when window.close was being called from a WebExtensions-registered devtools panel while there is only one tab open in a Firefox browser window, that window was closed as a side-effect of that (and the entire browser shutdown if that was the only Firefox window open).

The issue can be hit with the test extension I'm attaching to this bug (and without any of the changes from the patch attached to Bug 1921631) using the following STR:

  • Open a Firefox instance with only one Firefox window and one tab open
  • load about:debugging in the only tab, and install temporarily the test extension attached to this bug
  • While only one Firefox tab is open, open the devtools toolbox in that tab, select the custom devtools panel registered by the extension
  • Click on the button inside the WebExtension-registered devtools panel
  • Actual Behavior: Firefox window (and tab) is closed
  • Expected Behavior: the Firefox window (and tab) to stay open

The issue seems to be due to the DOMWindowClose event bubbling up from the browser element nested inside the devtools toolbox where the extension page providing the custom devtools panel is being loaded, up to being then handled by the DOMWindowClose event listener registered from inside the gBrowser's _setupEventListeners method here:

Severity: -- → S4
Priority: -- → P3
Assignee: nobody → rking
Pushed by luca.greco@alcacoop.it: https://hg.mozilla.org/integration/autoland/rev/fdb6d0d7d849 Calling window.close from a Web Extension-registered devtools panel shouldn't close the browser chrome window r=rpl
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: