Open Bug 1843388 Opened 1 years ago Updated 1 years ago

WebExtensions: onMoved event fired before onCreated when recently closed tab (from Firefox history menu) is opened with middle click.

Categories

(WebExtensions :: General, defect, P5)

Firefox 116
defect

Tracking

(firefox115 affected, firefox116 affected, firefox117 affected)

Tracking Status
firefox115 --- affected
firefox116 --- affected
firefox117 --- affected

People

(Reporter: maxbadryzlov, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0

Steps to reproduce:

(async () => {
  // Create tab
  const tab = await browser.tabs.create({ url: 'https://example.com', active: false })
  
  // Wait
  await new Promise(done => setTimeout(done, 2000))

  // Close tab
  await browser.tabs.remove(tab.id)

  // Create new tab (it will force Firefox to move the reopened tab to previous position)
  await browser.tabs.create({ active: false })

  // Listen
  browser.tabs.onCreated.addListener(tab => console.log('TAB CREATED, id:', tab.id))
  browser.tabs.onMoved.addListener(id => console.log('TAB MOVED, id:', id))

  // Then open Menu / History / Recently closed tabs
  // And middle-click on the first "Example Domain" item
})()

Actual results:

Console output:

TAB MOVED, id: 7
TAB CREATED, id: 7

Expected results:

Console output:

TAB CREATED, id: 7
TAB MOVED, id: 7

Hello,

I reproduced the issue on the latest Nightly (117.0a1/20230716213402), Beta (116.0b6/20230716180334) and Release (115.0.2/20230710165010) under Windows 10 x64 and macOS 11.3.1.

Proceeding with the STR, the console output first logs TAB MOVED and then TAB CREATED. Opposite of what the expected results should be, as per Comment 0.

Fore more details, see the attached screenshot.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached image 2023-07-17_10h56_02.png

FYI: This is not the only bug where onCreated behaves unexpectedly - see bug 1763927 for another example.

Severity: -- → S4
Priority: -- → P5
See Also: → 1763927
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: