New tab and restored tab notified via tabs.onCreated can have invalid (too large) index
Categories
(WebExtensions :: Compatibility, defect, P3)
Tracking
(firefox68 verified)
Tracking | Status | |
---|---|---|
firefox68 | --- | verified |
People
(Reporter: yuki, Assigned: yuki)
References
Details
Attachments
(2 files)
Firefox notifies new tab or restored tab to listeners of tabs.onCreated
, but the notified tab can have invalid index which is different from actual index on the tab bar.
Steps to reproduce
- Register an listener to
tabs.onCreated
, like:
chrome.tabs.onCreated.addListener(tab => console.log(tab))
- Open new tab with too larget index, like:
chrome.tabs.create({ index: 9999999 })
- Open four ore more tabs.
- Close all tabs opened at the step 3, with the reversed order they were opened.
(In other words, close tabs from the last, to the first.) - Open the history menu and restore the initially closed and last opened tab.
Actual result
Both tabs have their index
larger than tabs.length - 1
.
The tab opened at the step 2 has 9999999
.
The tab restored at the step 5 has the index
same to the one when it was closed.
Expected result
Both tabs have their index
same to tabs.length - 1
.
Environment
- Nightly 68.0a1 on Ubuntu 16.04LTS
- Firefox 66.0.2 on Ubuntu 16.04LTS
Additional information
Google Chrome (Chromium) works as expected. I've attached a testcase extension, and I got a console output like:
opened with index 2
there are 3 tabs
opened with index 2
there are 3 tabs
On the other hand, Firefox reports:
opened with index 9999999 <= larger than tabs.length-1
there are 3 tabs
opened with index 4 <= larger than tabs.length-1
there are 3 tabs
Assignee | ||
Comment 2•6 years ago
•
|
||
The bug 1504775 looked to cause this. But the patch contains changes only on the XUL layer, and there is no guarantee about compatibility with Chromeium's extensions API. One more automated test on the WebExtensions API layer looks better for more clear compatibility.
Comment 3•6 years ago
|
||
Are you saying that this behavior started after the patch from bug 1504775? I don't see how that is logically possible.
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Shane Caraveo (:mixedpuppy) from comment #3)
Are you saying that this behavior started after the patch from bug 1504775?
No, I meant its opposite. I think that the patch coincidentally fixes this WebExtensions API compatibility bug, and a new test to verify the compatibility is required. Thus I'm trying to write a patch for future consistency. Is such a "only including test" patch acceptable?
Updated•6 years ago
|
Assignee | ||
Comment 5•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fd7d4206ad59
Add tests to verify WebExtensions API compatibility around new tab index r=mixedpuppy
Comment 7•6 years ago
|
||
bugherder |
Comment 8•6 years ago
|
||
This issue is verified as fixed on Firefox 68.0a1 (20190508111321) under Win 7 64-bit and Mac OS X 10.14.1
I have used the test add-on from the attachment and the issue is no longer reproducing. The following is displayed in the console:
opened with index 2
there are 3 tabs
Description
•