A tab discarded immediately after creation, loaded, and then discarded again has an incorrect URL when queried.
Categories
(Firefox :: Session Restore, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox88 | --- | fixed |
People
(Reporter: anonymous30901032, Assigned: robwu)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
Steps to reproduce:
1) In about:debugging, open a console by clicking 'Debug' on an extension like uBlock Origin that can 'Access browser tabs'.
2) Input the following code:
browser.tabs.create({
url: "https://www.google.com",
active: false
}).then(tab => {
browser.tabs.discard(tab.id);
console.log("tab id = " + tab.id);
console.log("tab index = " + tab.index);
});
3) Select the new tab, let it finish loading, and then deselect it.
4) Replace tabIndex with the index of the new tab and run the next line:
browser.tabs.query({
index: tabIndex,
currentWindow: true
}).then(tabs => console.log("tab url = " + tabs[0].url));
5) Replace tabId with the id of the new tab and run the next line:
browser.tabs.discard(tabId);
6) Repeat step 4 (the url should be "about:blank").
***
This bug seems to be related to https://bugzilla.mozilla.org/show_bug.cgi?id=1422588
Updated•3 years ago
|
Comment 1•2 years ago
|
||
(In reply to anon from comment #0)
- Repeat step 4 (the url should be "about:blank").
I'm not sure why you expect this. about:blank isn't loaded there, in fact nothing at all is loaded, so I think we want to return the URL that's going to be loaded when selecting the tab.
Sorry, I didn't explain it correctly. On step 6, the url that is returned is "about:blank". I expected it to be "https://www.google.com".
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Comment 5•3 months ago
|
||
While investigating a different bug, I found a typo in the code that causes this bug (and the other duplicates).
From https://bugzilla.mozilla.org/show_bug.cgi?id=1694699#c21:
currentURIusually returns the tab's URL, but in the case of discarded tabs, a value is fetched from SessionStore and cached as_cachedCurrentURI. This getter assumes that the following three values are equivalent (and synchronized):
browser._cachedCurrentURISessionStore.getLazyTabValue(aTab, "url")browser.currentURI(non-lazy version)(...)
- When undiscarding a tab, the cached value is not correctly erased (so when the tab is discarded again, an incorrect value may be used). In
_insertBrowserin tabbrowser.js,aTabshould bebrowser.
| Assignee | ||
Comment 6•3 months ago
|
||
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/9ce142e600af Correctly delete _cachedCurrentURI r=Gijs
Comment 8•3 months ago
|
||
Backed out 2 changesets (bug 1498432, bug 1680279) for causing bc failures in browser_ext_tabs_discard_reversed.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/ab3f023535ea70eaa8dd35b3c4833db2a7fa480e
Push with failures, failure log.
| Assignee | ||
Comment 9•3 months ago
|
||
It's a Fission-only bug; I've skipped the test (filed bug 1696815) and am going to reland without fixing that unrelated issue. The depth of the bug stack is already much more than I signed up for when I optimistically started with fixing one small thing.
Comment 10•3 months ago
|
||
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/c021c6541346 Correctly delete _cachedCurrentURI r=Gijs
Comment 11•3 months ago
|
||
| bugherder | ||
Description
•