Open Bug 1949069 Opened 1 month ago Updated 22 days ago

switchToTabHavingURI does not replace query on yet-to-be-restored tab

Categories

(Firefox :: Tabbed Browser, defect)

defect

Tracking

()

People

(Reporter: skhamis, Unassigned, NeedInfo)

References

Details

When trying to debug Bug 1942333. Turns out the issue was browser.loadURI in switchToTabHavingURI causing issues when switching to an unloaded tab with query params.

STR:
Have a tab open to about:preferences#general
Have another tab focused.
Restart the browser - this will load the other tab, while the about:preferences#general tab will be in an unloaded state.
Open the avatar menu and click Sync Settings

Expected:

about:preferences?entrypoint=fxa_avatar_menu#sync

Actual:

about:preferences#sync

The above is just an example STR, I would postulate anything using switchToTabHavingURI with query params and replacing is running into this issue.


A longer breakdown is in the previous bug, was something like:

window.switchToTabHavingURI(
    "about:preferences?action=pair#sync",
            true,
            {
              ignoreQueryString: true,
              replaceQueryString: true,
              adoptIntoActiveWindow: true,
              ignoreFragment: "whenComparing",
              triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
            }
);

would correctly find the existing about:preferences tab, even unloaded, but then the console would produce:

[bug 1345098] Lazy browser prematurely inserted via 'loadURI' property access:
getter@chrome://browser/content/tabbrowser/tabbrowser.js:2341:61
switchIfURIInWindow@chrome://browser/content/browser.js:6423:11
switchToTabHavingURI@chrome://browser/content/browser.js:6446:26

which is triggered only in nightly via https://searchfox.org/mozilla-central/source/browser/components/tabbrowser/content/tabbrowser.js#2320

however, Firefox will correctly move to the tab it found, however it does not seem to replace the query or fragment. For example if I had about:preferences?entrypoint=fxa_avatar_menu#general opened and unloaded, it would not replace the query with ?action=pair, thus causing the original bug 1942333.

No longer depends on: 1942333
See Also: → 1942333

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.

Component: General → Tabbed Browser

The severity field is not set for this bug.
:dwalker, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(dwalker)
You need to log in before you can comment on or make changes to this bug.