Closed Bug 1465828 Opened 6 years ago Closed 2 years ago

Navigations in discarded tabs via tabs.update are undone when that tab is activated again

Categories

(WebExtensions :: Android, defect, P3)

60 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1583281

People

(Reporter: robwu, Unassigned)

References

(Blocks 2 open bugs)

Details

I attached the WebIDE debugger (F8) to a Firefox Beta for Android instance (Firefox 61, buildID 20180514150347), inspected the main process and switched the context to an extension (with the tabs permission so I can see the URL, e.g. uBlock). In the browser all tabs except for the last one were zombified/"discarded" (I guess that you can trigger this by causing memory pressure, e.g. by opening another app that uses lots of memory). browser.tabs.query({ discarded: true, }).then(tabs => console.log(tabs[0].id)); Then I triggered a navigation, e.g. browser.tabs.update(4, { url: 'https://example.com', }); I can see that the tab has navigated. However, when I query the tab info, then the tab is still in the "discarded" state: browser.tabs.get(4).then(console.log); // { ... discarded: true ..., url: "https://example.com/" ...} When I switch to the tab, the original URL is restored. What I expected is: - After navigating by tabs.update, tab.discarded should be false. - After tapping on the navigated tab, the tab should not be "restored", but stay at the changed location. The implementation of tabs.update calls nativeTab.browser.loadURI : https://searchfox.org/mozilla-central/rev/83a923ef7a3b95a516f240a6810c20664b1e0ac9/mobile/android/components/extensions/ext-tabs.js#306,318 The zombie restoration logic scattered over: - https://searchfox.org/mozilla-central/rev/83a923ef7a3b95a516f240a6810c20664b1e0ac9/mobile/android/chrome/content/browser.js#3922-3963 - https://searchfox.org/mozilla-central/rev/83a923ef7a3b95a516f240a6810c20664b1e0ac9/mobile/android/components/SessionStore.js#846-859,1462-1480 (Search for "pending" (including the quotes or __SS to find relevant code). It seems that the tab management implementation does not account for navigating a zombified tab.
Priority: -- → P2
Product: Toolkit → WebExtensions
Conversely, tabs.update() shouldn't be stomping over the session history of a discarded tab, though. In principle, the tab needs to be restored first before we can load a new URL the normal way, although a naive implementation would trigger an additional, unneeded load of the previously loaded URL, which isn't ideal. I wonder what Desktop does here?

It seems that the tab management implementation does not account for navigating a zombified tab.

If the platform doesn't support it, we should just throw an error.

Since this is android, lowering priority.

Priority: P2 → P3
Severity: normal → S3

The severity field for this bug is relatively low, S3. However, the bug has 11 votes.
:robwu, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(rob)

The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.

Flags: needinfo?(rob)

Since there is no support for discarded tabs, I am marking this bug as a dup of Bug 1583281.

Status: NEW → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1583281
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.