Closed Bug 1504775 Opened 2 years ago Closed 1 year ago

Index is wrong for restored tabs

Categories

(Firefox :: Tabbed Browser, defect, P3)

63 Branch
defect

Tracking

()

RESOLVED FIXED
Firefox 68
Tracking Status
firefox-esr60 --- unaffected
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: code, Assigned: dao)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

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

Steps to reproduce:

Open tab A. Open tab B. Open tab C. Close tab C. Close tab B. Run `browser.sessions.getRecentlyClosed(tabs => browser.sessions.restore(tabs[1].tab.sessionId))` and then `browser.tabs.query({}).then(console.log)`.


Actual results:

Tab C is restored with index 3.


Expected results:

Tab C should be restored with index 2.
Component: Untriaged → General
Product: Firefox → WebExtensions
I don't understand what you're reporting here. How many tabs were open to begin with? Are the tabs restored in the expected order and reporting the wrong index, or restored in the wrong order and reporting the correct index?
Flags: needinfo?(code)
>How many tabs were open to begin with?

A single tab was open before running the reproduction steps.

>Are the tabs restored in the expected order and reporting the wrong index, or restored in the wrong order and reporting the correct index?

Correct order, wrong index. Here's what happens in more detail:

Original tab: index 0
[Open tab A]
Original tab: index 0
Tab A: index 1
[Open tab B]
Original tab: index 0
Tab A: index 1
Tab B: index 2
[Open tab C]
Original tab: index 0
Tab A: index 1
Tab B: index 2
Tab C: index 3
[Close tab C]
Original tab: index 0
Tab A: index 1
Tab B: index 2
[Close tab B]
Original tab: index 0
Tab A: index 1
[Restore tab C (browser.sessions.getRecentlyClosed(tabs => browser.sessions.restore(tabs[1].tab.sessionId)))]
Original tab: index 0
Tab A: index 1
Tab C: index 3
Flags: needinfo?(code)
OK. This is probably a session restore or tabbrowser bug, then. We get the tab index from a property on the browser tab.
Component: General → Tabbed Browser
Product: WebExtensions → Firefox
Priority: -- → P3
Status: UNCONFIRMED → NEW
Ever confirmed: true

I believe bug 1449700 broke this.

Keywords: regression
Regressed by: 1449700
Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Pushed by dgottwald@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cbf847b4007c
Ensure externally provided addTab index is within bounds. r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68

This bug looks to break the compatibility of WebExtensions API with Chromium: the bug 1541748.

Flags: in-testsuite+
Regressions: 1541748
Blocks: 1541748
No longer regressions: 1541748
You need to log in before you can comment on or make changes to this bug.