Index is wrong for restored tabs

RESOLVED FIXED in Firefox 68

Status

()

defect
P3
normal
RESOLVED FIXED
7 months ago
a month ago

People

(Reporter: code, Assigned: dao)

Tracking

(Regression, {regression})

63 Branch
Firefox 68
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox-esr60 unaffected, firefox66 wontfix, firefox67 wontfix, firefox68 fixed)

Details

Attachments

(1 attachment)

Reporter

Description

7 months ago
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.
Reporter

Updated

7 months ago
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)
Reporter

Comment 2

7 months ago
>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
Assignee

Updated

2 months ago
Priority: -- → P3
Assignee

Updated

2 months ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee

Comment 4

2 months ago

I believe bug 1449700 broke this.

Keywords: regression
Regressed by: 1449700
Assignee

Updated

2 months ago
Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED

Comment 6

2 months ago
Pushed by dgottwald@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cbf847b4007c
Ensure externally provided addTab index is within bounds. r=mixedpuppy

Comment 7

2 months ago
bugherder
Status: ASSIGNED → RESOLVED
Last Resolved: 2 months 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
Assignee

Updated

a month ago
Blocks: 1541748
No longer regressions: 1541748
You need to log in before you can comment on or make changes to this bug.