Open Bug 1529411 Opened 5 years ago Updated 2 years ago

onRemoved for last tab dispatched before onCreated with browser.tabs.closeWindowWithLastTab=false

Categories

(WebExtensions :: Frontend, defect, P3)

defect

Tracking

(Not tracked)

REOPENED

People

(Reporter: Oriol, Assigned: Oriol)

References

Details

Attachments

(1 file)

  1. Set browser.tabs.closeWindowWithLastTab=false
  2. Let a window have 1 tab
  3. Close the tab
  4. browser.tabs.onRemoved fires earlier than browser.tabs.onCreated

This is bad because:

  • Can make extensions think the number of tabs has reached 0 and the window is closing
  • Does not reflect internal reality. "TabOpen" is dispatched earlier than "TabClose". If you check gBrowser.tabs.length, it increases from 1 to 2 and then goes back to 1. But what webextensions detect is 1 decreasing to 0 and going back to 1.

This is a side-effect of awaiting a tick before calling emitCreated, which was needed because

We need to delay sending this event until the next tick, since the tab could have been created with a lazy browser but still not have been assigned a SessionStore tab state with the URL and title.

But this shouldn't be necessary after bug 1446426.

Keywords: checkin-needed

Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5570cf4346a8
Fire onCreated before onRemoved when closing last tab with browser.tabs.closeWindowWithLastTab=false. r=mixedpuppy

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Depends on: 1538378

Backed out in bug 1538378.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla67 → ---
Priority: -- → P3
No longer depends on: 1538378
Regressions: 1538378
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: