Skip to content

Hold arriving initial widgets without document.write, and print console warnings from probe - #3405

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

max-sixty merged 5 commits into
mainfrom
console-warnings

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Firefox printed warnings on Leaf pages that Chrome never shows, and nothing in the suite or leaf-dev probe surfaced them. This removes the main one and makes the probe report them.

Initial-render delivery no longer uses document.write. A widget drawn before first paint (x-initial: playgrounds, contents, activity) was wrapped in a <template> opened by document.write, so its source stayed inert until the script after its end tag drew it. Firefox reparses the rest of the document after an unbalanced write and warns on every such page. The host now arrives marked data-lf-arriving, which the theme hides only while the runtime will run (html[data-lf-interactive]); the script after its end tag removes the mark 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, where it fails on the previous delivery. Requests before presentation are unchanged (62); the page grows by the 255-byte theme rule.

leaf-dev probe prints console warnings beside errors, under a console field, and its startup observer no longer asks Firefox and WebKit for layout-shift entries they lack.

A Firefox sweep of the corpus with an empty-console requirement is held back: on the three pages with live samples, each fresh sample's document forces layout before Firefox has started it ("Layout was forced before the page was fully loaded"), and feature-gallery never reached readiness in Firefox in CI. It lands with the fix for those.

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

max-sixty and others added 4 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]>

@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 Firefox corpus test fails on pages this PR includes. I ran leaf-dev probe feature-gallery --firefox --js "1" on this head; it recorded five “Layout was forced before the page was fully loaded” warnings from live sample documents. firefox_browser passes those console warnings to clean_browser, so test_page_fixture_opens_without_firefox_console_warnings will fail for this page in the scheduled journeys tier. The PR description reports the same warning for two other gallery pages. Please resolve the sample layout warning before adding an empty-console requirement for the whole corpus, so the new check can pass when it runs.

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]>
@max-sixty max-sixty changed the title Hold arriving initial widgets without document.write, and check Firefox's console Hold arriving initial widgets without document.write, and print console warnings from probe Oct 21, 2026
@max-sixty
max-sixty merged commit 0c62076 into main Oct 21, 2026
3 checks passed
@max-sixty
max-sixty deleted the console-warnings branch October 21, 2026 01:03
max-sixty added a commit that referenced this pull request Oct 21, 2026
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_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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