Previous URL lost in tabs history after using tabs.update to update URL.
Categories
(WebExtensions :: General, defect, P2)
Tracking
(firefox-esr115 unaffected, firefox-esr128 unaffected, firefox-esr140 affected, firefox136 wontfix, firefox137 wontfix, firefox138 wontfix, firefox139 wontfix, firefox140 wontfix)
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr128 | --- | unaffected |
| firefox-esr140 | --- | affected |
| firefox136 | --- | wontfix |
| firefox137 | --- | wontfix |
| firefox138 | --- | wontfix |
| firefox139 | --- | wontfix |
| firefox140 | --- | wontfix |
People
(Reporter: anonymous30901032, Unassigned, NeedInfo)
References
(Regression)
Details
(Keywords: regression)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0
Steps to reproduce:
-
Click 'Inspect' on an extension in about:debugging to open its Console.
-
Run the following code in the console to create a new tab and get its id:
browser.tabs.create({active: true}).then(t => console.log("tab id: " + t.id));
-
Load 'https://www.apple.com' in the tab that was just created.
-
After the tab has finished loading, load 'https://addons.mozilla.org' in the same tab.
-
Run the following code in the console, replacing 'id' with the id showing in the console:
browser.tabs.update(id, {url: "https://duckduckgo.com"});
-
Right click on the back button to view the tabs history.
Actual results:
In this case, 'Add-ons for Firefox' did not appear in the tabs history.
Expected results:
The URL that was previously loaded should appear in a tabs history after using tabs.update to update the URL (when 'loadReplace' is not used).
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•1 year ago
|
Comment 2•1 year ago
|
||
Hello,
I reproduced the issue on the latest Nightly (138.0a1/20250304213504), Beta (137.0b1/20250303103151) and Release (136.0/20250227124745) under Windows 11 and Ubuntu 24.04 LTS.
The issue occurs as described in Comment 0, “Add-ons for Firefox” not appearing in the tabs history.
Comment 3•1 year ago
|
||
Thanks Alex, I think Firefox had an intervention recently to deal with pages spamming history, and this might be a side-effect from that.
Can you please do a bisection for a regression range?
Comment 4•1 year ago
|
||
There was recently a bug report on the absence of history entries when history.pushState is used in an extension popup, at bug 1935935, which in turn is caused by bug 1924861. Does setting browser.navigation.requireUserInteraction to false in about:config solve the issue?
I do expect tabs.update to add history entries though, independently of the pref.
Comment 5•1 year ago
|
||
@Rob in Comment 4:
Setting browser.navigation.requireUserInteraction to false in about:config does solve the issue. As per the STR, with the pref set to false, I get “Add-ons for Firefox” showing in the tabs history.
@Tomislav in Comment 3:
Regression range:
Bug 1734181 - Part 5: Re-enable back button intervention in Nightly. r=peterv,dom-core
Differential Revision: https://phabricator.services.mozilla.com/D216829
Comment 6•1 year ago
|
||
Set release status flags based on info from the regressing bug 1734181
:avandolder, since you are the author of the regressor, bug 1734181, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•1 year ago
|
Comment 7•1 year ago
|
||
This behaviour does appear to be the back-button intervention working as intended.
(In reply to Rob Wu [:robwu] from comment #4)
I do expect
tabs.updateto add history entries though, independently of the pref.
Currently, there is no special handling for tabs.update, so while it adds history entries, the back-button intervention makes it so those entries are only available if they have been interacted with. It may be possible to add such functionality if that's what is needed.
Comment 8•11 months ago
|
||
The severity field is not set for this bug.
:willdurand, could you have a look please?
For more information, please visit BugBot documentation.
Comment 9•11 months ago
|
||
(In reply to Adam Vandolder [:avandolder] from comment #7)
This behaviour does appear to be the back-button intervention working as intended.
(In reply to Rob Wu [:robwu] from comment #4)
I do expect
tabs.updateto add history entries though, independently of the pref.Currently, there is no special handling for
tabs.update, so while it adds history entries, the back-button intervention makes it so those entries are only available if they have been interacted with. It may be possible to add such functionality if that's what is needed.
The tabs.update method does explicitly provide a loadReplace option and so extensions may be actually expect that history entries are being created unless they passed loadReplace explicitly set to true.
would it be possible to still support that by special handling tabs.update? any concern in considering to do that?
Comment 10•11 months ago
|
||
Set release status flags based on info from the regressing bug 1734181
Comment 11•11 months ago
|
||
The pref is now enabled by default since Firefox 136 (bug 1939691).
Comment 12•10 months ago
|
||
:avandolder any update
Updated•10 months ago
|
Updated•9 months ago
|
Updated•8 months ago
|
| Reporter | ||
Comment 13•8 months ago
|
||
It looks like tabs.update with loadReplace is also not working correctly at times with the back button intervention.
Steps to reproduce:
- Open an extensions Console in about:debugging.
- Run the following code in the Console: browser.tabs.create({url: "about:blank"}).then((tab) => console.log("tab id: " + tab.id))
- Load 'https://www.bing.com/' in the tab.
- Load 'https://duckduckgo.com/' in the tab.
- Load 'https://www.google.com/' in the tab.
- Click the back button to view the DuckDuckGo page.
- Run the following code in the extensions Console, first replacing 'id' with the new tabs id: browser.tabs.update(id, {url: "https://search.brave.com/", loadReplace: true})
- Press the forward button to view the Google page.
- Press the back button once (sometimes the Brave page will be missing and the Bing page will appear).
- Repeat steps 2-9 until the Brave page is lost in the tabs history.
If browser.navigation.requireUserInteraction is set to false, then the Brave page will never be lost. Note that window.location.replace used instead of tabs.update (with loadReplace set to true) will also have the same issue. This is somewhat different than this bug where window.location.assign, window.location.href, etc... are still working correctly and tabs.update (without loadReplace) is not. Should I create a separate bug for this?
Description
•