Open Bug 2090083 Opened 19 days ago Updated 15 days ago

store.google.com - Unresponsive or very slow when browsing the page

Categories

(Core :: Performance: General, defect)

Desktop
macOS
defect

Tracking

()

Webcompat Priority P1
Webcompat Score 7
Tracking Status
firefox162 --- affected

People

(Reporter: ctanase, Unassigned)

References

()

Details

(Keywords: webcompat:needs-diagnosis, webcompat:site-report, Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success])

User Story

autowebcompat-repro-status:success
autowebcompat-repro-chrome-mask-fixed:false
autowebcompat-repro-channels:stable,esr
autowebcompat-repro-report-os:macos,linux
autowebcompat-diagnosis-status:success
platform:windows,mac,linux,android
impact:site-broken
configuration:common
affects:all
branch:release
diagnosis-team:dom
user-impact-score:750

Attachments

(2 files)

Environment:
Operating system: Mac OS X 10.15
Firefox version: Firefox 158.0/159/162

Steps to reproduce:

  1. Go to https://store.google.com
  2. Click on any of the products devices on the page.
  3. Observe the behavior.

Expected Behavior:
The pages load.

Actual Behavior:
Unresponsive/stuck loading/ slow load.

Notes:

  • I couldn't reproduce on Windows
  • Reproduces regardless of the status of ETP
  • Reproduces in firefox-nightly, and firefox-release
  • Does not reproduce in chrome

Created from https://github.com/webcompat/web-bugs/issues/239268

Performance profile: https://share.firefox.dev/4jVwv23

Component: Site Reports → General
Product: Web Compatibility → Core
Whiteboard: [webcompat-source:web-bugs] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:reproduction-in-progress]

The Bugbug bot thinks this bug should belong to the 'Core::Performance: General' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Performance: General
User Story: (updated)
Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:reproduction-in-progress] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnose]

In Firefox on Linux, store.google.com hangs. The home page never finishes loading and the page stops responding, so even simple scripts run in the page time out, and product pages can't be reached. Other sites such as google.com load normally in the same Firefox. In Chrome the home page and product pages (e.g. Pixel 11 Pro) load fully and stay responsive.

User Story: (updated)
Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnose] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnosis-in-progress]
See Also: → 2087787

Root cause analysis generated by autowebcompat bot:

The store's CSS has several rules whose :has() argument depends on the style attribute of the element or any ancestor. For example: body:not(:has([data-disable-navbar-position-requests="true"]:not([style*="display: none"]):not([style*="display: none"] *)…)):has([data-request-navbar-position="overlap"]:not([style*="display: none"] *)…) .PQHu1b. There are about 12 such rules, on body and :root.

While the page boots, a scrollbar-width component (_.rAf.observe → qAf) calls el.style.setProperty("--scrollbar-width", "15px") on about 50 <section> elements. Each call changes the style attribute. In Firefox, each change synchronously runs Stylo's relative-selector (:has()) invalidation inside setProperty(): Servo_StyleSet_MaybeInvalidateRelativeSelectorAttributeDependency → RelativeSelectorInvalidator::invalidate_relative_selectors_for_this → TreeStyleInvalidator::invalidate_dom_descendants_of → handle_anchor → invalidate_upwards → matches_compound_selector_from.

Because of the [style*=…] * part, the invalidator visits every descendant of the mutated element. For each descendant it walks back up the ancestors and re-matches the :has() selectors. The cost grows much faster than the DOM size and ends up blocking the main thread. On the real page (about 7000 elements) the content process spends tens of seconds in this loop, so the home page and product pages never finish loading and page script does not respond.

Chrome's :has() invalidation does not do this work synchronously during the attribute mutation (and is much cheaper), so the same calls take well under 1 ms. The site sends the same CSS and JS to both browsers; this is a Gecko engine performance problem, not UA sniffing. Spec: https://drafts.csswg.org/selectors-4/#relational

Evidence:

Firefox profile of the hung home page (Isolated Web Content main thread): 20,552 of 24,180 samples (about 20 s) are under CSSStyleDeclaration.setProperty, called from qAf/observe in the boq-gstore JS bundle. Symbolicated frames below it: nsStyledElement::SetInlineStyleDeclaration → Element::SetAttrAndNotify → MutationObservers::NotifyAttributeChanged → Servo_StyleSet_MaybeInvalidateRelativeSelectorAttributeDependency → RelativeSelectorInvalidator::{invalidate_relative_selectors_for_this, invalidate_upwards, handle_anchor} → TreeStyleInvalidator::invalidate_dom_descendants_of → selectors::matching::matches_compound_selector_from.

In Chrome the page loads normally: 51 sections end up with style="--scrollbar-width: 15px", the DOM has about 6,900 elements, and the stylesheets contain 143 :has() rules, 12 of which use [style*="display: none"] * inside :has(). The reproduction script times out in Firefox in all 3 runs (home load times out after 45 s, and a page evaluate times out after 10 s); it passes in Chrome.

Reduced testcase: 5 of the site's :has() rules, 50 sections of 85 nested divs each (4,260 elements), and one style.setProperty("--scrollbar-width", …) per section. Firefox: 13,613 ms (13,960 ms in a second run). Chrome: 0.1–0.2 ms. With 17k elements Firefox did not finish within 120 s; Chrome still took 0.2 ms.


If you'd like to provide feedback on diagnosis, please use the 👍 or 👎 reaction.

User Story: (updated)
Whiteboard: [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success][autowebcompat:diagnosis-in-progress] → [webcompat-source:web-bugs][autowebcompat:processed][autowebcompat:repro-success]

This happens for me on Windows 11. Firefox 160.0b5 (64-bit)
Version 160.0b5
Build ID 20261104021706

This bug was moved into the Performance: General component.

:ctanase, could you make sure the following information is on this bug?

  • ✅ For slowness or high CPU usage, capture a profile with https://profiler.firefox.com/, upload it and share the link here.
  • For memory usage issues, capture a memory dump from about:memory and attach it to this bug. Please consider moving this issue to the Performance: Memory component.
  • Troubleshooting information: Go to about:support, click "Copy raw data to clipboard", paste it into a file, save it, and attach the file here.

If the requested information is already in the bug, please confirm it is recent.

Thank you.

Flags: needinfo?(ctanase)
User Story: (updated)
Flags: needinfo?(ctanase)
User Story: (updated)
Webcompat Priority: --- → P1
Webcompat Score: --- → 8
Webcompat Score: 8 → 7

Just confirming this on Firefox 160.0 and macOS 26.6.2. I've also noticed it is similarly broken on Firefox for Android. A lot of the site just hangs for maybe a minute on each page load.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: