Closed Bug 1695346 Opened 4 years ago Closed 4 years ago

Discarded hidden tab's URL is "about:blank" after moving the tab to a new window

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(firefox89 fixed)

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

Attachments

(2 files)

See:

STR:

  1. Install the attached extension at about:debugging
  2. Follow all steps starting from step 2 at https://bugzilla.mozilla.org/show_bug.cgi?id=1694699#c20 . The expectation and actual behavior is identical.

This is not a recent regression (unlike that other bug).

Severity: -- → S3
Priority: -- → P3

The relevant stack trace is at https://bugzilla.mozilla.org/show_bug.cgi?id=1694699#c21

This bug happens because hideTab is called as part of the tab adoption in a new window (<browser> from old to new window) at https://searchfox.org/mozilla-central/rev/2b99ea2e97eef00a8a1c7e24e5fe51ab5304bc42/browser/components/sessionstore/SessionStore.jsm#4477-4491

... but before the tab's URL was restored several lines later, at https://searchfox.org/mozilla-central/rev/2b99ea2e97eef00a8a1c7e24e5fe51ab5304bc42/browser/components/sessionstore/SessionStore.jsm#4565,4604-4622

Consequently, when browser.currentURI is accessed, the incorrect (about:blank) URL is used.

To fix this in extension code, I suggest that we ignore tabs that are being adopted. To fix this more generally, the tabData should be restored as much as possible before methods are called that may invoke external callers. The latter will also fix the extension-specific case.

See Also: → 1698192

swapBrowsersAndCloseOther calls SessionStore.setTabState, but the
latter may trigger several tab events before the tab has fully been
restored. This results in duplicate tabs.onUpdated events and in
unexpected access to properties of the tab/browser (which in turn
triggers the reported bug).

Fix this specific case by ignoring events that happen while the tab is
amidst a restoration.

Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/bf8b505e273d Skip tabs amidst restoration in tabs.onUpdated r=Gijs,rpl
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: