Closed Bug 2071626 Opened 2 months ago Closed 2 months ago

Tab that changed content process while in the background stays blank or shows the spinner forever when selected

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 155
defect

Tracking

()

VERIFIED FIXED
158 Branch
Tracking Status
firefox158 --- verified
firefox159 --- verified

People

(Reporter: rath, Assigned: dao)

References

(Blocks 3 open bugs)

Details

Attachments

(1 file, 1 external file, 3 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:155.0) Gecko/20100101 Firefox/155.0

Steps to reproduce:

  1. Drag a word from a web page onto the empty area of the tab strip.
  2. Click the new tab.
  3. Content not shown.

Actual results:

The content area stays grey. The page itself loaded (the Inspector shows its DOM).
Reloading and switching to another tab and back do not help. Only opening a new tab does.

State of the stuck tab (Browser Console):

  • browser: pendingpaint=true, opacity 0, renderLayers=false, hasLayers=false, docShellIsActive=false
  • gBrowser._switcher: still alive, getTabState(tab)=1 (STATE_LOADING), requestedTab=tab, spinnerTab=tab, loadingTab=null, loadTimer=null, windowHidden=false

Running gBrowser.selectedBrowser.docShellIsActive = true makes the content appear immediately.

Expected results:

The page should be displayed once it has loaded.

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: Untriaged → Tabbed Browser

Can you give us your profile info from about:support so we can see what preferences have been modified? Instructions are here: https://support.mozilla.org/en-US/kb/use-troubleshooting-information-page-fix-firefox

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(rath)
Summary: new Tab stays grey forever, content is newer shown → new Tab stays grey forever, content is never shown

Attached it here

Flags: needinfo?(rath)

Reproduced on Nightly 158 (Linux, Fission). Three things line up.

  1. ChromeUtils.predictRemoteTypeForURI("hello") returns webIsolated=http://hello - the search term is read as a hostname. The dropped-text tab is therefore created in a throwaway process, and the keyword-fixed-up search URL forces a process switch.

  2. Hovering the new tab warms it. AsyncTabSwitcher.setTabState's STATE_LOADING branch sets renderLayers = true but deliberately leaves docShellIsActive false for a warming tab.

  3. The process switch lands on that state before the tab has presented. Tabbrowser's WillChangeBrowserRemoteness handler ends didChange with browser.docShellIsActive = browser.docShellIsActive, which reads false and writes false onto the new frameloader; that setter also clears renderLayers. onRemotenessChange repairs only a tab in STATE_LOADED, so a tab in STATE_LOADING keeps the recorded state with neither flag set.

Nothing gets it back out. setTabState returns early when the state is unchanged, so loadRequestedTab() on selection is a no-op; unloadNonRequiredTabs only demotes STATE_LOADED tabs, so switching away and back doesn't reset it either. numPending stays at 1, finish() never runs, and updateDisplay keeps the spinner up.

Repro: a local server holding its response 900ms, a tab whose predicted remote type is wrong for what it loads, gBrowser.warmupTab(tab) fired a few ms after the response arrives, then select the tab. 2 of 10 offsets across that window reproduce the reported state exactly - getTabState 1, spinnerTab set, loadTimer and loadingTab null, pendingpaint, and renderLayers/hasLayers/docShellIsActive all false. With browser.tabs.remote.warmup.enabled=false, 0 of 10.

The fix belongs in onRemotenessChange: a tab in STATE_LOADING needs renderLayers re-applied to the new frameloader, the same way a tab in STATE_LOADED is put back into STATE_LOADING today.

The remote type prediction looks like a separate bug worth filing - every keyword drop on the tab strip launches a throwaway webIsolated=http://<term> process and guarantees a process switch.

The reported hang is the STATE_LOADING case; STATE_UNLOADING has the same shape and leaves the switcher unable to finish, but I have no repro for it.

The BrowsingContext keeps its active state across the swap, but renderLayers, layer preservation and the priority hint live on the BrowserParent and were lost, and the destroyed BrowserParent skips its MozLayerTreeCleared, so AsyncTabSwitcher could wait forever on a warmed or unloading tab.

Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED

The frameloader replacement now carries the layer state over itself; the self-assign turned rendering off again for a warmed tab.

Attachment #9642592 - Attachment is obsolete: true
Attachment #9642591 - Attachment is obsolete: true
Component: Tabbed Browser → DOM: Core & HTML
Product: Firefox → Core
Attachment #9644463 - Attachment is obsolete: true
Attachment #9644462 - Attachment description: Bug 2071626 - Carry layer state over a frameloader replacement and report the old layers cleared. r?#dom-core! → Bug 2071626 - Carry layer state over a frameloader replacement and report the change in the browser's layers. r?#dom-core!
Summary: new Tab stays grey forever, content is never shown → Tab that changed content process while in the background stays blank or shows the spinner forever when selected
Blocks: 1871524
Blocks: 2003852
Severity: -- → S3
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1e59f0c34214 https://hg.mozilla.org/integration/autoland/rev/95a6f34dcac2 Carry layer state over a frameloader replacement and report the change in the browser's layers. r=dom-core-reviewers,tabbrowser-reviewers,jsudiaman,smaug
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
QA Whiteboard: [qa-triage-done-c159/b158][qa-ver-needed-c159/b158]
Flags: qe-verify+

I was able to reproduce the issue on Ubuntu 24.04 using Firefox build 158.01a.
Verified as fixed on Ubuntu 24.04 using Firefox build 159.0a1 and 158.0b2.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triage-done-c159/b158][qa-ver-needed-c159/b158] → [qa-triage-done-c159/b158][qa-ver-done-c159/b158]
Flags: qe-verify+
QA Contact: mchiorean
Duplicate of this bug: 2068194
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: