Closed Bug 1488026 Opened Last year Closed Last year

onAttached fired before onDetached for the last tab

Categories

(WebExtensions :: Frontend, enhancement)

enhancement
Not set

Tracking

(firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: Oriol, Assigned: Oriol)

Details

Attachments

(1 file)

Run this code:

  browser.tabs.onAttached.addListener(function(...args) {
    console.log("onAttached", ...args);
  });
  browser.tabs.onDetached.addListener(function(...args) {
    console.log("onDetached", ...args);
  });

If you drag a tab between windows, you will see first an onDetached event and then the onAttached one.

However, if the dragged tab is the last one in its old window, that window will close, and onAttached will appear first.

This is not supposed to happen: https://searchfox.org/mozilla-central/rev/c8483bebfa09173b1db5590b3c19f42270d819c9/browser/components/extensions/parent/ext-browser.js#508-509

Chrome does it right.
Comment on attachment 9005909 [details]
Bug 1488026 - Always fire onDetached event before onAttached. r=mixedpuppy

Shane Caraveo (:mixedpuppy) has approved the revision.
Attachment #9005909 - Flags: review+
Keywords: checkin-needed
Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f7bddc0708f1
Always fire onDetached event before onAttached. r=mixedpuppy
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f7bddc0708f1
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Hello, I've attempted to validate this bug using the above info, but the code shown does not seem to yield any result, could you please clarify the STR or if manual testing is not required set the “qe-verify -“ flag.

Thanks!
Flags: needinfo?(oriol-bugzilla)
The output appears in the console. Covered by automated tests anyway
Flags: needinfo?(oriol-bugzilla) → qe-verify-
You need to log in before you can comment on or make changes to this bug.