Skip to content

Open every corpus page in Firefox with its console held empty - #3445

Merged
max-sixty merged 12 commits into
mainfrom
console-warnings
Oct 21, 2026
Merged

max-sixty merged 12 commits into
mainfrom
console-warnings

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

The Firefox sweep (test_page_fixture_opens_without_firefox_console_warnings) opens each corpus page, loads its live samples, and fails on any console warning, as the Chrome render gate does. #3405 held it back because two things kept it red.

Firefox warns "Layout was forced before the page was fully loaded" from sample frames. In its rendering update, a document with a ResizeObserver flushes layout in every in-process document of the tab (FlushLayoutForWholeBrowsingContextTree in Document.cpp), including a sample frame still parsing its head. That frame's content sink then starts layout early and reports it. A page with a ResizeObserver and an iframe whose head arrives slowly, with no Leaf code, warns 3 of 3 times; without the observer, 0 of 3. Inlining the sample's stylesheet doesn't help, since the flush lands before the frame has parsed any. No page can prevent it, so console_finding drops Firefox's own form of that warning when its location is a frame's document, a sample (served under /api/samples/<id>/) or an HTML preview's about:srcdoc frame, and keeps it from the page itself. Firefox files the warning under the script that forced layout where one did, so the location is matched by path rather than compared with the top-level URL. The cost: a sample's own script reading layout too early would also go unreported.

The feature gallery never finished arriving in Playwright's Firefox. Playwright's Firefox leaves about half the sample frames without the suite's init scripts. The input watch wrapped each port message in an envelope, which such a child could not read, so its host's calls went unanswered and the page stalled at arrived for 240 s. The source now rides as one extra field on Leaf's plain-object port messages, which an unwatched peer reads past. The shift-watch fixture that sent strings now sends objects, as Leaf does.

The Firefox run of the feature gallery then hung in CI after its test body passed. Under concurrency, Playwright's Firefox loses up to 9 of the page's 18 frames, reporting them at about:blank or an earlier URL. The watch judgement's evaluate in such a frame never returns, so the test hung for 30 minutes and the job for 4 more hours. judge_watches now leaves a Firefox child frame unjudged when it answers no bounded probe within 2 s; that frame never ran the watches' init scripts. Chrome still judges every frame. The sweep's wait for each sample is bounded too, and names a sample that never gets ready. Six concurrent copies of the feature-gallery case now pass locally in about 30 s each; before this, all six hung.

Checked locally: the three pages that failed (feature-gallery, thread-panel-gallery, diff-thread-gallery) pass, the other 32 passed before, and the shift-watch and words-watch port tests pass.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 8 commits October 20, 2026 16:22
The probe printed only console errors and exceptions, so `probe --firefox`
showed none of the warnings Firefox raises on a Leaf page: the reparse
after the initial-render `document.write` and the forced layout in a
sample child. Its reading now names the field `console` and carries
warnings beside errors, as the suite's browser fixtures already collect.

The startup observer asked Firefox and WebKit for layout-shift entries,
which they lack, and each frame warned; it now asks only where the entry
type is supported.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Delivery opened a <template> around each widget drawn before first paint
with document.write, so the parser held its source inert until the
script after its end tag drew it. Firefox reparses the rest of the
document after any unbalanced write and warns of it on every such page.

The host now arrives marked `data-lf-arriving`, which the theme hides
while the runtime will run (`html[data-lf-interactive]`), and the script
after its end tag takes the mark off and draws it in the same task. With
scripts off, or in a DOMParser reading, the mark hides nothing, as the
unopened template did. The streamed-delivery test now also runs in
Firefox, whose collector rejects the reparse warning; it fails on the
previous delivery.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Chrome's corpus sweep holds every page's console to no warning or error,
but Firefox reports what Chrome never says: a reparse after an unbalanced
document.write, layout forced before the page loaded, a response blocked
as opaque. Each corpus page now also opens in Firefox with its live
samples loaded, and the Firefox fixture rejects any message.

The three pages with live samples fail for now: each sample's document
forces layout before Firefox has started it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The sweep's three pages with live samples fail on Firefox's "Layout was
forced" warning from each fresh sample document, and feature-gallery
also never reaches readiness there in CI. The check returns with the fix
for those, rather than landing red.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Firefox sweep (`test_page_fixture_opens_without_firefox_console_warnings`)
opens each corpus page and loads its live samples, and fails on any console
warning, as the Chrome render gate does. Two things kept it red.

Firefox warns "Layout was forced before the page was fully loaded" from sample
frames. In its rendering update, a document with a ResizeObserver flushes layout
in every in-process document of the tab (`FlushLayoutForWholeBrowsingContextTree`),
including a sample frame still parsing its head, whose sink then starts layout
early and says so. A page with a ResizeObserver and a slow-headed iframe, no
Leaf involved, warns 3 of 3 times; without the observer, 0 of 3. No page can
prevent it, so `console_finding` drops that warning when a frame reports it,
and keeps it from a top-level document.

The feature gallery never finished arriving in Playwright's Firefox, which
leaves some sample frames without the suite's init scripts. The input watch
wrapped each port message in an envelope, which such a child could not read, so
its host's calls went unanswered. The source now rides as one extra field on
Leaf's plain-object port messages, which an unwatched peer reads past. The
shift-watch fixture that sent strings now sends objects, as Leaf does.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The forced-layout filter can hide a warning from the top-level document. message.location["url"] identifies the warning's source URL, not its frame: a top-level script loaded from another URL differs from main_frame.url, so a matching warning is discarded. Calling console_finding with a top-level page URL and an external script URL returns None. This leaves page check --render and the Firefox console sweep unable to report that warning on an authored page. The suppression needs a way to establish that the warning came from a child frame rather than inferring its frame from the source URL.

Firefox files the warning under the script that forced layout where one did,
so a top-level page's own script could carry a URL other than the page's and
had its warning dropped. The warning is now dropped only where its location is
under a sample's served path, and only in the form Firefox's engine reports it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 21, 2026
The Firefox sweep of the feature gallery hung in CI for 30 minutes, then the
job for 4 more hours. Six concurrent copies hang locally too, all after the
test body returns: Playwright's Firefox loses up to 9 of the page's 18 frames,
reporting them at about:blank or an earlier URL, and the watch judgement's
evaluate in such a frame never returns. A Firefox child frame that answers no
bounded probe within 2 s is now left unjudged; it never ran the watches'
init scripts. The sweep's wait for each sample is bounded too, and names the
sample that never got ready.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new reachability probe runs outside the existing frame-lifetime handler. If a Firefox sample frame detaches after page.frames is read, frame.wait_for_function() can raise a Playwright error before that handler runs, failing teardown for a frame the harness otherwise releases. Keep the probe inside the same try as watch judgement.

Comment thread tests/render_harness.py Resolved
A sample frame detaching after the frame list is read made the probe raise
before the handler that releases detached frames could see it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 21, 2026
CI's Firefox sweep of the feature gallery reported the same warning from an
HTML preview's srcdoc frame (lf-text-document), which the whole-tree flush
reaches as it reaches a sample. A frame is now known by either source of its
document: a sample's served path, or about:srcdoc.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 1494bd9 into main Oct 21, 2026
3 checks passed
@max-sixty
max-sixty deleted the console-warnings branch October 21, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants