Commit Graph
91 Commits
Author SHA1 Message Date
ldm0 af912f2f84 fix(performance): report stylesheet font resource timings
Retain the stylesheet source through nested imports and CSS font requests,
and publish each completed font timing in its requesting Document. Reuse
response filtering and Service Worker source hiding, and avoid duplicate
timings when consuming preloads.

Cover inline, base URL, linked, imported and cross-origin stylesheets in
main and child documents, plus synthetic, forwarded and fallback worker
responses with real font bytes and physical request counts.
2026-11-20 22:48:01 +08:00
ldm0 e022fc2e60 fix(stylesheets): finish child parser import graphs before scripts
Fetch child parser stylesheet imports through the shared import graph,
including nested requests, response policies and cycle deduplication.
Install descendant CSSOM sheets into their original owner before releasing
parser and frame load blockers. Preserve retired-owner network facts.

Cover linked and inline roots, duplicate and cyclic imports, failed child
responses, controlled pending requests and stale graph completions.
2026-11-20 22:48:01 +08:00
ldm0 478329ec8d fix(performance): retain preload request attribution and completion
Keep initiating sources on connected-link requests and report their real
network terminal clocks. Attribute image and other link preloads to link,
and preserve the actual caller for stylesheet preloads. Attribute response
header preloads to their requesting Document.

Cover pending and completed consumption, cache policies, Document realms,
and HTTP Link preloads. Hide initiating sources for Service Worker
responses while retaining them on actual network fallback.
2026-11-20 22:48:01 +08:00
ldm0 8e3b445a1c fix(performance): report previous document unload timing
Observe each retiring Document's own unload event and transfer that record
only when its replacement commits. Expose modern and legacy timestamps
through the same native origin and redirect checks, including inherited
opaque origins. Keep pagehide and descendant unload handlers outside the
recorded interval.

Retain the accepted navigation clock for local child Documents so their
previous unload remains on the new timeline. Cover iframe and popup
replacement, cross-origin redirects, sandbox isolation and local srcdoc.
2026-11-20 22:48:01 +08:00
ldm0 d828673e8f fix(performance): retain queued frame navigation start clocks
Retain each accepted child navigation attempt's monotonic and wall clocks
through deferred attribute and Location commits. Keep fetch timing tied to
the actual loader and transport rather than the navigation time origin.

When a retiring subtree has beforeunload handlers, establish its new time
origin after the existing beforeunload check completes. Preserve navigation
cancellation and ownership checks.

Cover queued network and service worker requests, replaced attempts, and
beforeunload listeners, properties, HTML attributes and descendants. Keep
safe diagnostic context for existing controlled-preload timeout failures.
2026-11-20 22:48:01 +08:00
ldm0 31c67a340b fix(performance): default absent connection timing to fetch start
Use the allowed response fetch start for DNS and connection timing when
there is no client connection, including Service Worker respondWith.
Keep TLS unset and retain TAO masking and actual network observations.

Cover synthetic, forwarded, network fallback and cross-origin responses
in both the top Window and an iframe.
2026-11-20 22:48:01 +08:00
ldm0 618dfa1a59 fix(module): preserve resource timing initiators
Carry request-owned attribution through parser and dynamic module graphs and
modulepreload producers. Preserve the source captured before asynchronous
scheduling, independently of URL resolution and HTTP referrer policy.

Publish the native timing entry for runtime module roots and retain child
root/dependency timing data through owner-checked completions. Keep actual
Service Worker response provenance so synthetic responses stay unattributed.

Cover parser/import sources, dynamic modules in main and child Documents,
modulepreload reuse, base URLs, and real Service Worker module responses.
2026-11-20 22:48:01 +08:00
ldm0 b30e220fc5 fix(performance): retain native navigation timing 2026-11-20 22:48:01 +08:00
ldm0 d9c8f5b559 fix(eventsource): report Window resource timing 2026-11-20 22:48:01 +08:00
ldm0 85ecd78a3d feat(workers): support EventSource connections
Use Worker-owned fetch transport for EventSource in dedicated and shared
workers, including CORS/CSP, service-worker responses, interception, streaming
SSE parsing, reconnection and UTF-8 Last-Event-ID headers.

Deliver state and messages as individual networking tasks. Keep connection
callbacks separate from fetch Promise consumers, and use private delayed
networking tasks that author timers cannot cancel. Close and Worker teardown
cancel their transport and delayed work. Keep CONNECTING when a closing
Worker discards connection tasks.

Remove the unsupported constructor and cover both Worker kinds with fourteen
API tests, retaining Window EventSource and existing Worker test identities.
2026-11-20 22:48:01 +08:00
ldm0 3838946ba2 fix(workers): report root fetch timing to creator
Keep dedicated worker main-script timing in the outside settings timeline.
Publish a networking task targeted to the captured creator Window, independent
of the worker wrapper, and retain native request, body and completion timing.

Report nested worker root fetches in the parent WorkerGlobalScope, including
HTTP and MIME failures. Reuse response filtering and keep local blob/data
scripts outside HTTP timing.

Cover classic, module, iframe and nested creation, rejected responses and
local-script controls with eight API tests.
2026-11-20 22:48:01 +08:00
ldm0 bab758acd3 fix(scripts): retain async source network timing
Keep successful parser-async network results through parse-time tasks, EOF
fallback and late source completion. Publish ready scanner preloads through
the same owner task so each async fetch is recorded once.

Capture native response timestamps and body sizes at the source fetch, and
retain them independently of when script execution becomes eligible. Keep
attribution outside fetch reuse keys and apply existing CORS/TAO filtering.

Cover streaming parse-time execution, EOF completion, single-chunk parsing
and multiple async task turns with four API regressions.
2026-11-20 22:48:01 +08:00
ldm0 9f65feab4a fix(workers): retire nested workers with their parent global
Keep nested Worker handles in their parent global's native registry so terminate and global retirement release descendants through the existing nonblocking shutdown path. Remove production raw handle ownership from V8 private slots.

Add classic and module worker regressions for ancestor termination, self.close and explicit child termination while preserving an unrelated live worker's lock.
2026-11-20 22:47:59 +08:00
ldm0 78952de374 fix(navigation): retain native child navigation initiators 2026-11-20 22:47:57 +08:00
ldm0 e1d7a4e101 fix(csp): retain inherited Window connect policy sources
Reuse the admitted connect policy snapshot for initial Fetch checks and the shared native snapshot for other Window connect clients. Preserve the inherited policy URL for self matching and relative report-uri resolution while reporting the actual Document URI.

Keep source-location capture and violation task ordering in one queue helper, remove obsolete per-context connect paths, and calculate srcdoc referrers against the actual navigation URL. Cover same/cross-origin Fetch admission, report-only independence, report endpoints and default/same-origin referrer policies.
2026-11-20 22:47:57 +08:00
ldm0 6959f49a23 fix(csp): preserve native Document referrers in violations 2026-11-20 22:47:57 +08:00
ldm0 5d2e07578b fix(csp): preserve Document response status in violations 2026-11-20 22:47:57 +08:00
ldm0 1affe8fff5 fix(worker): inherit local script referrer policies
Resolve local worker policy from the Blob URL creator environment, including
meta updates delivered before startup. Keep existing worker snapshots and
SharedWorker reuse stable, and carry the policy through worker-created URLs.
Preserve parent request and child response policy for nested HTTP workers.

Validate with the complete fmt, clippy, and nextest gates (20,458 passed),
73 original WPT files (665 -> 667 passed, zero regressions), and 226 network
comparisons covering worker types, ownership, policy timing, and overrides.
2026-11-20 22:47:44 +08:00
ldm0 0f6c05c270 fix(css): preserve referrer state across stylesheet imports 2026-11-20 22:47:44 +08:00
ldm0 8a8f4eb246 fix(css): snapshot document referrer policy for stylesheet requests
Capture the owning Document policy at stylesheet resource admission and
include it in the shared resource key, while preserving existing owner
bindings. Carry parser/preload snapshots and child Document policies into
the native request.

Test policy changes, shared URLs, parent/child isolation and parser-created
stylesheets through the controlling service worker. The shared browser
fixture performs 55 comparisons and also passes in Chromium.
2026-11-20 22:47:44 +08:00
ldm0 41d1933593 fix(fetch): resolve client referrers before dispatch
Select the live Document URL, following srcdoc containers and rejecting opaque
client origins, before applying the effective referrer policy. Resolve these
values before both service-worker interception and native network dispatch,
without changing the public Request or the origin and cookie initiator.

Use HTML's about:srcdoc URL match so javascript replacements remain srcdoc
Documents. Preserve the replaced Document's current delivered policies,
including removed meta elements, instead of reverting to response-only state.

Cover network headers across two origins, author base URLs, history changes,
about:blank boundaries, javascript replacements, opaque srcdoc Documents, and
service-worker request metadata.

Keep Fetch resource classification when attaching policy metadata, and isolate
memory-cache entries by their resolved Referer so policy changes cannot reuse
a response selected for a different referrer.
2026-11-20 22:47:44 +08:00
ldm0 237a046f49 fix(referrer): snapshot creator policy for local documents
Capture the creator Document's current effective referrer policy when cloning
its policy container. Initial empty child documents now resolve their actual
owner, including popup parents, and reuse the shared inheritance path.

Preserve the original navigation policy when recording about-document history
state. Test creation snapshots, later parent and child mutations, removed meta
elements, grandchildren, and explicit Fetch overrides across both origins.
2026-11-20 22:47:44 +08:00
ldm0 cf2d928040 fix(referrer): persist meta policy on each document
Apply meta referrer delivery on insertion and attribute changes, preserve it across removal and document.open(), and share the state with Fetch, XHR, and existing script consumers. Cover temporal ordering, namespaces, windowless documents, cloning, and main/child/popup network owners.
2026-11-20 22:47:44 +08:00
ldm0 7ba52e5dab fix(scripts): honor document referrer policies for classic fetches
Capture the owning Document policy when preparing parser and runtime script
requests, separately from persistent script fetch options. Preserve the HTML
preload scanner snapshot and pass it to classic script and link preload fetches.

Admit child preload links at their parser token boundary and retain the policy
while waiting for realm creation, so a later meta cannot change an earlier
request. Keep explicit attributes and subsequent dynamic imports independent.

Cover main and child Documents, parser and runtime modes, same/cross origins,
header and meta defaults, invalid/explicit attributes, and delayed realm creation
with real HTTP regressions that also check request and execution counts.
2026-11-20 22:47:44 +08:00
ldm0 87191d6150 fix(modules): preserve document policy for module preloads
Capture the exact Document's default referrer policy when preparing a
modulepreload request, separately from the module's persistent script options.
Carry it through single-module fetch reservations into the actual network
request, including main and child parser and connected-link paths.

Seed the HTML preload scanner with the response policy and snapshot meta
policies in token order for parser modules and modulepreload links. Seed
insertion scans with the live policy without scanning an idle Document.
Admit child links at FinishParsingChildren so a later meta in the same parser
batch cannot overwrite an earlier request's policy or duplicate link terminals.

Cover same/cross-origin requests, response and meta defaults, explicit and
invalid attributes, late meta tags, module-map reuse, and dynamic imports
from preloaded modules after a policy change with real HTTP regressions.
2026-11-20 22:47:44 +08:00
ldm0 6c1597fc7a fix(modules): apply document referrer policies to module graph fetches
Capture the exact Document's current referrer policy for each module fetch,
separately from compiled script options. Preserve explicit script and response
policies while allowing later imports with an empty policy to observe meta
policy changes. Resolve child policies through their Document and realm owner.

Carry the prepared module request through the main runtime root's Service
Worker path and its network fallback instead of rebuilding it without the
Document policy. Apply the same fallback to child parser roots.

Add real HTTP regression coverage for main and child documents, root and
static imports, saved classic/module import functions, string timers, explicit
and invalid policies, response policy overrides, and dynamic meta updates.
2026-11-20 22:47:44 +08:00
ldm0 2827f48fa6 fix(modules): preserve dynamic import referrers and policies
Retain script referrer policy in V8 host-defined options, including imports
from saved functions and string timers. Carry the importing script's URL
through the module tree's existing referrer field into Fetch independently
of the document origin and cookie initiator. Keep the client referrer for
imports without referring script metadata.

Add real HTTP coverage for main and child documents, classic and module
scripts, inline and external sources, element mutation, response policies,
and direct and timer imports. Verify that an explicit script referrer does
not replace the document's origin or cookie context.
2026-11-20 22:47:44 +08:00
ldm0 661f413097 fix(scripts): preserve dynamic import credentials from initiating scripts
Carry preparation-time fetch metadata through classic script execution and
child external-script ready tasks. Encode normalized credentials in V8
script origins so saved import functions retain their initiating script's
credentials after element mutation or removal.

Inherit credentials and nonce in string timers while clearing parser
metadata and keeping the root script's integrity out of dependency fetches.
Cover main and child documents, inline and external classic/module scripts,
credential defaults, same/cross-origin requests, and timer imports.
2026-11-20 22:47:44 +08:00
ldm0 090d66a19e fix(modules): reuse compiled records for child script roots
Deliver compiled child root completions without requiring discarded
JavaScript source. Reuse the realm's existing record when each script
consumer advances, retaining its namespace, fetch metadata, response base
URL, and pending or rejected evaluation.

Cover preload, parser, runtime, and import consumers with real HTTP tests,
including redirect request keys, separate realms, per-element load events,
and top-level-await fulfillment and rejection identity.
2026-11-20 22:47:44 +08:00
ldm0 a740833e2a fix(modules): reuse module maps for runtime script roots
Consult the module map before fetching runtime module script roots while
preserving script-element Service Worker filtering and integrity checks.
Keep shared fetches alive across document.open so imports in the retained
realm settle without reviving retired script elements or their events.
2026-11-20 22:47:44 +08:00
ldm0 103c519f88 fix(preload): start runtime modulepreloads in their document
Start connected main-document modulepreloads during mutation commit using the
same module-map reservation and scheduling path as parser preloads. Route child
links through the existing Document/realm-owned modulepreload queue instead of
leaving their start requests in the main lifecycle accumulator.

Cover post-load JavaScript/JSON/CSS/text preloads, import reuse, asynchronous
load/error delivery, CORS and integrity failures, per-Window module maps, and
queued child starts retired by document.open.
2026-11-20 22:47:44 +08:00
ldm0 09cbc7397c test(dom): cover inactive Document locations 2026-11-20 22:47:44 +08:00
ldm0 1e71e557f8 fix(iframe): reject ancestor URLs during attribute navigation 2026-11-20 22:47:42 +08:00
ldm0 d9d85b497d fix(fonts): validate font set queries with Stylo 2026-11-20 22:47:41 +08:00
ldm0 6ef3d8b3b9 fix(fonts): validate binary FontFace sources
Decode and validate binary font data before marking a FontFace loaded, and
check SFNT table extents for every face in a collection. Reuse the stronger
validation for URL fonts so truncated unused tables cannot escape detection.

Reject shared and resizable sources during argument conversion, then copy
ordinary BufferSource bytes after descriptor conversion. Retain validated
bytes independently of later caller mutations and transfers.

Cover real TTF, WOFF and WOFF2 inputs, offset views, malformed and truncated
fonts, shared/resizable/detached buffers, descriptor side effects, collections,
URL font validation and cross-realm promises and errors.
2026-11-20 22:47:41 +08:00
ldm0 1ae6b469a1 fix(fonts): load URL-backed FontFace resources asynchronously
Fetch and validate font bytes through the owning Document resource loader,
including URL fallback, CORS, CSP redirects, Service Workers and preload/SRI
consumption. Preserve loaded promises and track pending FontFaceSet members,
ready promises and queued loading events.

Keep font tasks separate from author timer cancellation and dispatch child
CSP violations at their source Document. Replace fake font fixtures and
synchronous load assertions with real bytes and task-driven checks.
2026-11-20 22:47:41 +08:00
ldm0 148e687f46 fix(sri): preserve supported hashes with malformed padding
Keep supported hash metadata through verification so misplaced or excess
base64 padding cannot disable integrity checks or select a weaker algorithm.
Accept matching noncanonical base64 without changing encoded metadata used
by CSP and preload consumption.

Cover script, preload, CSP, and Window/Worker fetch consumers. Validate with
cargo fmt, workspace Clippy, and all 19,886 nextest tests, plus browser
comparisons and SRI/preload WPT regressions.
2026-11-20 22:47:41 +08:00
ldm0 09a5096546 fix(preload): consume stylesheet preload responses 2026-11-20 22:47:41 +08:00
ldm0 d5e2966cd8 fix(preload): consume document-owned preload responses 2026-11-20 22:47:41 +08:00
ldm0 fc35034823 fix(preload): verify ordinary preload integrity
Check ordinary preload responses with the shared SRI implementation, including CORS eligibility and Service Worker response filters. Dispatch error on verification failure while retaining the actual response bytes for Resource Timing.

Cover top-level and child parser links, dynamic links, binary bodies, redirect taint, hash selection, and Service Worker responses with integration regressions.
2026-11-20 22:47:41 +08:00
ldm0 e62886720d fix(dom): clear defaultView after browsing context destruction 2026-11-20 22:47:39 +08:00
ldm0 8ded1211c9 fix(runtime): preserve retained child Window globals 2026-11-20 22:47:39 +08:00
ldm0 c60e7af73b fix(dom): update document.open URLs from the entry document 2026-11-20 22:47:39 +08:00
ldm0 8f8b1c994a fix(parser): respect script nesting for stylesheet waits 2026-11-20 22:47:39 +08:00
ldm0 8868449086 fix(runtime): admit document lifecycle during awaited evaluation 2026-11-20 22:47:39 +08:00
ldm0 59c1a08507 fix(parser): preserve nested document.write insertion points
Keep blocked writes with the input position saved by each parser script. Share the context between main and child parsers so external-script suspension preserves nested caller tails and consecutive write order.

Add four integration regressions across main/child and navigation/script-created parsers. Validated with fmt, strict workspace Clippy, 19474 passing nextest tests, 18 Chromium comparison checks, and 50 WPT pages without new failures.
2026-11-20 22:47:39 +08:00
ldm0 eaf4fc9c9e fix(html): queue child load delivery through the DOM source
Queue iframe load delivery alongside other DOM tasks and include current
child lifecycle owners in the existing lifecycle scheduling preference.
This keeps initial load ahead of module timers that replace the document.

Cover inline, imported, external, and top-level-await modules using parent
and child timers. Check adopted-image events against the shared DOM FIFO.
Update the WPT ledgers for the three repaired delayed module-write cases.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 17,875 passed, 13 skipped
- 270 WPT cases: 254 to 257 passes, no case or subtest regressions
2026-11-20 22:47:36 +08:00
ldm0 379493363d fix(html): queue document lifecycle transitions on the DOM source
Admit DOMContentLoaded and main Window load after their parser/defer and load
prerequisites so earlier DOM tasks keep their FIFO positions. Keep interactive
readiness at parser stop, preserve child realm prerequisites, and return a load
boundary to its driver if an earlier DOM callback adds a new load delay.

Queue parser-owned external import-map errors during preparation, including
child and document.write parsers, so later dynamic errors cannot overtake them.
Cover ordering, replacement and load-delay behavior in main and child documents.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 17,871 passed, 13 skipped
- 270 WPT cases: 254 pass, 10 fail, 5 timeout, 1 error; one new pass and
  no case-status or passing-subtest-count regressions
2026-11-20 22:47:36 +08:00
ldm0 5070746e60 fix(parser): checkpoint microtasks before preparing parser scripts
Yield live HTML script preparation to the document owner after releasing
parser borrows. Prepare from the current DOM after the guarded microtask
checkpoint, and abandon stale handoffs when that checkpoint replaces the
document. Apply the boundary to main documents, child documents, and
document.write; preserve eager parsing when no runtime owner is installed.

Admit parser async classic scripts after preparation and keep nested
script cleanup from draining microtasks while an outer script is running.
Add main/child integration coverage and update the two repaired WPT cases.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 17,846 passed, 13 skipped
- 245 related WPT cases: all 231 previously passing cases remain passing
- Final CLI build: both repaired WPT cases pass on the validated sources
2026-11-20 22:47:36 +08:00
ldm0 d3f3e6f497 fix(script): checkpoint microtasks during event callback cleanup
Perform HTML script cleanup between event callbacks when the execution-context stack becomes empty, retaining currentTarget, passive state, and window.event through the checkpoint. Preserve script execution scopes during exception reporting, use the same callback boundary for Worker.onerror, and guard the complete microtask checkpoint against reentrancy.

Remove deferred window.event restoration. Update callback-order assertions and asynchronous fixtures to wait for the final event they inspect, while retaining scheduler, document-owner, and follow-up checks. Add Window, child Window, and Worker coverage for nested dispatch, listener removal in microtasks, and script versus callback exceptions.

Callback exception ordering follows Web IDL cleanup before rethrow; the local Chromium probe reports the error before that checkpoint.

WPT: 3 additional passes in the script-element microtask tests; the other 492 cases retain identical statuses and subtest results. Update the corresponding passed/failed case lists.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (17,843 passed, 13 skipped). Fresh CLI build SHA-256 matches the binary used for the 495-case WPT comparison.
2026-11-20 22:47:36 +08:00