Commit Graph
4162 Commits
Author SHA1 Message Date
ldm0 d59c94de58 fix(events): register child Window content attribute handlers
Route body and frameset attributes through the child Window listener
registry, including parser insertion and HTML fragments. Compile lazily
in the child realm
while preserving error arguments, listener order and reentrant changes.

Replace the special onload/onstorage paths so clearing an IDL handler
does not reactivate its content attribute. Cover parser startup, empty
handlers, syntax errors, dispatch mutations and document replacement.
2026-11-21 20:03:21 +08:00
ldm0 ec1011b880 fix(workers): keep module workers alive after evaluation errors 2026-11-21 20:03:21 +08:00
ldm0 0a360485d1 fix(workers): dispatch intrinsic bootstrap error events
Use trusted plain Events with default flags for worker loading, parsing,
and SharedWorker connection failures, without invoking author constructors
or exposing ErrorEvent-only details.

Keep nested bootstrap failures out of runtime error propagation. Cover
native event construction, author hooks, CSP blocking, callback ordering,
and startup-versus-runtime behavior in Rust and ported WPT fixtures.
2026-11-21 20:03:21 +08:00
ldm0 9d6dfe52fa fix(modules): parse JSON before evaluating module graphs
Parse JSON while creating document and worker module records, before any
sibling module executes. Cache the parsed default export and preserve the
original parse exception across concurrent and repeated imports.

Retain JSON response URLs as private host metadata without replacing a
later JavaScript throw location. Avoid preparing author stacks during JSON
module creation, and preserve native Worker compile errors while retaining
existing bootstrap fallback error kinds.
2026-11-21 20:03:21 +08:00
ldm0 c4596b4e85 fix(webidl): use native receiver brands for DOM bindings
Enable shared receiver checks for Document structure, CharacterData, Text, ProcessingInstruction and affected HTML element templates. Remove redundant EventTarget Proxy and HTMLElement checks so registered native Proxies remain valid receivers.

Resolve windowless CharacterData through native handles while preserving UTF-16 data, Text/CDATA wholeText, range updates and detached XPath invalidation. Cover invalid receivers, conversion ordering, cross-realm errors and native Proxy event dispatch.
2026-11-21 20:03:21 +08:00
ldm0 52353e0338 fix: adapt rebased scripts and viewport tests to main APIs
Use each script request identity for Accept-Language and client hints in the metadata fallback path. Cover request overrides across script kinds and redirect targets. Initialize newly added viewport fields and format the merged visibility predicate.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (18710 passed, 13 skipped).
2026-11-21 20:03:21 +08:00
ldm0 909537e581 fix(script): require supplied JavaScript MIME for strict loads 2026-11-21 20:03:21 +08:00
ldm0 60afd8f25c fix(service-worker): implement registration update jobs 2026-11-21 20:03:21 +08:00
ldm0 4476a231e3 fix(service-worker): persist classic script resource maps
Reuse each version's main and imported script sources across repeated imports, worker restarts, and profile restoration. Keep full request URLs as map keys and freeze new imports after the install event settles.

Preserve decoded sources, muted errors, redirect checks, and installed main-script policies. Recover legacy metadata only when fetched bytes and final URLs still match. Cover install timing, redirect aliases, fragments, failed evaluation, retries, and offline restarts.
2026-11-21 20:03:21 +08:00
ldm0 b4e4bad62d fix(csp): block importScripts redirects before network contact
Carry owned worker policies and the importer location into per-request
redirect checks, including cached redirect responses. Queue an event for
each violated policy while preserving the original request URL and
synchronous NetworkError behavior.

Verify server contact counts, current-policy checks on cached redirects,
multiple enforced/report-only policies, and asynchronous report fields.
2026-11-21 20:03:21 +08:00
ldm0 0af39f3b2a fix(csp): correct importScripts policy checks and events
Use script-src-elem with script-src/default-src fallbacks for imported
classic scripts. Queue Worker CSP violations after the current task while
preserving the importer's sanitized source location and synchronous
NetworkError behavior.

Cover late listeners, microtask ordering, directive precedence, imported
callsites, and report-only behavior in dedicated and shared workers.
2026-11-21 20:03:21 +08:00
ldm0 b313c454dd fix(csp): enforce worker string timer policies
Apply the worker eval CSP gate to setTimeout and setInterval string
handlers, return zero when blocked, and preserve report-only execution
and Trusted Types policy rules.

Convert handler and delay arguments before policy checks. Propagate
conversion exceptions without scheduling a timer or invoking a default
Trusted Types policy. Cover function callbacks, report samples, and
TrustedScript/default-policy behavior.
2026-11-21 20:03:21 +08:00
ldm0 1a5c124c58 fix(csp): inherit creator policies in local workers
Carry header, meta, and report-only policies into blob/data dedicated,
shared, and nested workers while retaining their self origin and report
rules. Keep blob URLs linked to their creating environment until worker
startup, then clone the policies for the worker lifetime.

Preserve nested HTTP worker response policies and cover local worker
requests, reporting metadata, and object URL metadata lifetimes.
2026-11-21 20:03:21 +08:00
ldm0 25f9fab67a fix(csp): block fetch redirects before network access 2026-11-21 20:03:21 +08:00
ldm0 e626109d6d fix(csp): report fetch call locations and original redirect URLs
Capture script locations for synchronous Window and Worker fetch violations.
Leave locations absent for asynchronous redirects and report the original
request URL, retaining the initiating document's report authority.
Omit unknown source-file values from legacy reports and cover location-based
deduplication, redirect privacy, and report ownership.
2026-11-21 20:03:21 +08:00
ldm0 a6fd61188e fix(webidl): isolate WindowProperties proxy trap lookup
Give WindowProperties and HTML constructor proxy handlers a null prototype
so inherited page properties cannot intercept named element lookup.
Cover inherited trap functions/getters and numeric prototype shadowing in
both main and child windows.
2026-11-21 20:03:21 +08:00
ldm0 2f9d4423fa fix(csp): deduplicate reports per document and worker 2026-11-21 20:03:21 +08:00
ldm0 b7169059dd fix(csp): enforce frozen document base URL policies 2026-11-21 20:03:21 +08:00
ldm0 041760c684 fix(modules): preserve runtime failure ordering
Keep failed ordered modules at their insertion position and allow ready async
failures to report without waiting for later graph fetches. Preserve error
readiness across scheduler checks and register graph-start failure fanout in
its original order.

Validate mixed script ordering, pending fetches, and shared failure dispatch.
All workspace fmt, Clippy, and nextest checks pass (18,429 tests; 13 skipped).
Browser comparison passes 96 probes and 21 WPT files (56 subtests).
2026-11-21 20:03:21 +08:00
ldm0 a3c01e8899 fix(scripts): execute dynamic child modules in insertion order 2026-11-21 20:03:21 +08:00
ldm0 9121fe7c20 fix(scripts): skip execution after cross-document adoption
Check each prepared script's node Document before executing or reporting a
source failure, while settling its original ordering and load-delay ownership.
Apply the check to main-document classic/module and child-document script work.

Keep terminal events for scripts adopted during execution, and allow existing
top-level-await evaluations to continue. Cover removal, adoption, moving back,
source failures, child lifecycle completion, and adoption after evaluation starts.
2026-11-21 20:03:21 +08:00
ldm0 15d95d348c fix(realms): unwrap bound function and Proxy targets
Bound functions wrapping foreign proxies can have a creation context that differs from the underlying target realm. Expose V8 GetBoundFunction and follow both internal target chains when resolving a callable realm, including revoked-Proxy errors without executing property traps.

Cover mixed chains, prototype mutation, revoked proxies, all eight Wasm constructors, and DOMParser prototype fallback with unchanged document ownership and getter counts.

Validation: cargo fmt --all; strict workspace/all-targets/all-features Clippy; full nextest (18,417 passed, 13 skipped); CLI build; 17/17 selected WPT passed. The Wasm NewTarget realm WPT improves from 112/120 to 120/120 subtests.
2026-11-21 20:03:21 +08:00
ldm0 bdc0bd3422 fix(wasm): preserve child intrinsic prototype identity
Reuse the child V8 intrinsic instance prototypes behind the public WebAssembly constructors so native exceptions, async compilation results and imported modules retain constructor and instanceof identity. Keep the existing Function and NewTarget realm adapter.

Add native CompileError, LinkError and RuntimeError regressions, realm isolation and descriptor checks, and an HTTP module error identity assertion.

Validation: cargo fmt --all; strict workspace/all-targets/all-features Clippy; cargo nextest run --no-fail-fast (18,416 passed, 13 skipped); CLI build; API and WPT baseline comparisons.
2026-11-21 20:03:21 +08:00
ldm0 26850897e9 fix(modules): load and evaluate Wasm in child documents
Carry the parser-root module kind into fetching and compilation so child
Wasm responses retain their binary bytes. Keep resolved evaluation inputs
with the compiled records and use exact context/module lookup for Wasm
and its dependencies, including evaluation resumed after async work.

Cover real child HTTP loading, invalid bytes, context isolation, identity
hash collisions and record disposal. Full fmt, strict workspace Clippy and
18,415 nextest tests pass. Runtime scenarios improve from 28/40 to 40/40;
iframe execute-start and wasm-import-wasm-export WPT cases now pass.
2026-11-21 20:03:21 +08:00
ldm0 0070d6c54f fix(modules): preserve error constructors through module trees 2026-11-21 20:03:21 +08:00
ldm0 f76cd66dea fix(modules): preserve caught TypeError constructors 2026-11-21 20:03:21 +08:00
ldm0 95f11bf0cf fix(service-worker): apply WebIDL promise operation semantics
Use declarative receiver checks and promise rejection adapters for container
registration and lookup methods. Convert options before invoking the Trusted
Types default policy and preserve the original conversion exceptions.

Correct getRegistration's optional-argument length and cover conversion
order, native receiver identity, and cross-realm Promise rejection.
2026-11-21 20:03:21 +08:00
ldm0 7086d77720 test(wpt): reconcile case lists after main rebase
Restore the _self and input button passing entries lost during replay and
classify the history back noop case as harness-stalled, matching fresh Moli
results. Keep one classification per case across all 12,936 entries.

Compared eight affected and related pages with the rebased Moli binary and
Chromium. execution-timing/102 still reports a harness timeout in both.
2026-11-21 20:03:21 +08:00
ldm0 351ac277f0 fix(cssom): retain link sheets until replacement loads
Keep the installed owner source and JavaScript sheet while a valid link
attribute change starts a successor load. Preserve existing CSSOM edits and
prevent URL-cache hydration from replacing the current sheet prematurely.

Replacement responses detach the old sheet at installation; integrity rejection
retains it. Cover successful and failed loads, source bindings, and removal
before a queued successor response settles.
2026-11-21 20:03:21 +08:00
ldm0 21cf269b0f fix(stylesheet): enforce integrity before CSSOM installation
Validate raw stylesheet response bytes and response eligibility through the
shared SRI verifier. Preserve integrity rejection in fetch terminals so failed
loads dispatch error and release their load delay without installing a sheet
or discovering imports.

Require links with integrity metadata to use the compatible fetch cache instead
of hydrating an unverified parsed source by URL. Add regressions for hashing,
CORS, service-worker filters, local data URLs, redirects, and cached loads.
2026-11-21 20:03:21 +08:00
ldm0 b663d540d6 fix(csp): match wildcard ports on exact hosts
Handle exact-host sources with :* in the CSP matcher instead of sending them
to URL parsing. Preserve scheme, host, path, and redirect restrictions while
rejecting invalid literal host sources.

Add coverage across resource kinds and source restrictions. Record the image
and script wildcard-port WPT files as passing, and record the two SRI files
with remaining partial-integrity failures as failing.

Validation: cargo fmt --all; workspace clippy with all targets/features and
-D warnings; full nextest (18,367 passed, 13 skipped); 69 focused CSP tests.
23 WPT cases improved from 79/94 to 86/94 subtests without new failures.
All 18 HTTP port probes match Chromium, including blocked-request counts.
2026-11-21 20:03:21 +08:00
ldm0 d94f6a1c6f fix(forms): preserve popup navigation source and referrer
Use the shared element navigation path for GET form popup submissions so the
new document retains its creator URL, policy container, and rel semantics.
Resolve child-window creators from the form's owner document, and remove the
obsolete popup path that carried only the opener flag. Apply Referrer Policy
and sanitize the source URL, honoring anchor/area policy overrides.

Exercise all seven rel combinations for form, button, and input submissions
from both top-level and HTTP-loaded iframe documents, plus cross-origin
referrer policy and fragment stripping. Record the three newly
passing form popup WPT cases.
2026-11-21 20:03:21 +08:00
ldm0 a0aa798354 fix(input): preserve document ownership in empty iframe viewports
Use a generated document root as the viewport input fallback, retaining the
child document and coordinate transform when an iframe has no hittable box.
Keep mouse input suppressed for roots without a box while allowing inspectors
and wheel events to target the owning Document.

Chain wheel input through embedding frames only when the child cannot consume
it, and respect overscroll containment. Cover empty, excluded and removed roots,
nested and transformed frames, viewport bounds, and wheel scroll boundaries.
2026-11-21 20:03:20 +08:00
ldm0 2f8144a7fe fix(navigator): retain UserActivation state with its Window
Create the associated UserActivation object when its Window is initialized,
using the intrinsic interface prototype. Keep the activation state alive when
script retains a Navigator after iframe removal or Window replacement, and
release native anchors on GC or isolate teardown.

Expose the WebIDL constructor and readonly prototype accessors, preserving
native receiver checks. Refresh popup Navigators when their Window changes
so retained activation state cannot follow the replacement Window.
2026-11-21 20:03:20 +08:00
ldm0 f76a7c0436 fix(editing): implement native execCommand text copying
execCommand("copy") previously returned the user-activation flag without
firing an event or updating the clipboard. Dispatch trusted beforecopy and
copy events, honor cancellation, and copy the receiver document's selection.

Keep text-control selections per document across focus changes and reject
nested editing commands per native document. Share Window activation state
with navigator.userActivation so copying remains available after the
activating call and expires without clearing sticky activation. Read fresh
layout for DOM selection text, preserve preformatted whitespace, and use
the browser profile's clipboard line endings.

Add nine regression tests and correct the BiDi activation regression test.
Validate 38 copy-command cases, 38 existing native shortcut cases, and nine
activation-state cases against Chromium. The copy-event WPT and all 32
selection line-break subtests now pass, with no regressions in 65 WPT cases.
2026-11-21 20:03:20 +08:00
ldm0 045ca4866b fix(input): implement native clipboard shortcuts for text controls
Dispatch trusted clipboard events for native copy, cut, and paste shortcuts,
then apply text-control edits through cancelable, typed InputEvents. Resolve
focus and selection after event listeners and preserve UTF-16 selections,
readonly and password behavior, maxlength, and single-line normalization.

Keep paste data read-only and retire clipboard DataTransfer objects after
dispatch. Use intrinsic event constructors even when page scripts replace
the globals.

Add seven regression tests for editing, cancellation, focus changes, and
clipboard data lifetime. Validate 38 native CDP scenarios against Chromium
and 63 WPT cases; textEditCommands.html now passes with no regressions in
the remaining cases.
2026-11-21 20:03:20 +08:00
ldm0 0a948ad551 fix(cdp): preserve session routing for child default bindings 2026-11-21 20:03:20 +08:00
ldm0 fd602ff01c test(events): cover keyboard and mouse modifier state
Cover the native modifier snapshots and their independent states,
cross-realm calls, and receiver validation before conversion.
2026-11-21 20:03:20 +08:00
ldm0 5a18e89a54 feat(close-watcher): handle native Escape with activation groups 2026-11-21 20:03:20 +08:00
ldm0 e15f8fccb1 feat(close-watcher): implement programmatic lifecycle
Expose the Window-only CloseWatcher interface through native derive bindings.
Implement requestClose(), close(), destroy(), ordered event handlers and
AbortSignal algorithms, including reentrant calls and inactive documents.
Retain the creation realm separately from the reusable WindowProxy so old
watchers cannot become active after navigation.

Add five native regressions covering lifecycle, dictionary conversion,
signal ordering, interface brands, intrinsic events and detached child realms.
Native Escape requests and activation grouping remain follow-up work.

Validation: cargo fmt --all; full workspace/all-target/all-feature Clippy
with warnings denied; cargo nextest run --no-fail-fast (18288 passed,
13 skipped). Selected browser WPTs improve from 0/30 to 25/30; the remaining
failures require native Escape handling or pass through click hit testing.
The cross-document navigation probe matches Chromium.
2026-11-21 20:03:20 +08:00
ldm0 f8f21b4173 fix(webidl): honor initializer iterators on platform objects
Use sequence/record discrimination for native Headers, URLSearchParams,
FormData, and URL initializers. Read the author iterator once, preserve
its result or exception, and use own record properties when it is absent.

Cover Request and Response headers, enumerable iterator symbols, and
FormData File conversion. Remove unused imports and the URL
stringification helper.
2026-11-21 20:03:20 +08:00
ldm0 a0e687badb fix(webidl): preserve record conversion order and symbol keys
Collect all own keys, then inspect each current property descriptor before
converting its key and value. Record conversion now observes Proxy traps,
getter-driven property changes and abrupt completion in WebIDL order.

Preserve normalized duplicate-key replacement and cover Headers,
URLSearchParams and ClipboardItem, including thenable conversion order.

Correct the local URLSearchParams smoke expectation: non-enumerable symbol
keys are ignored, while enumerable symbol keys throw before value access.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 18,208 passed, 13 skipped
- Headers upstream WPT: 490/537 -> 504/537 (+14), no new failures
- URLSearchParams and ClipboardItem constructor regressions: 82/82
- Record behavior probes: 5/5 in Moli and Chromium
- Local URLSearchParams smoke: 26/26 in Moli; changed symbol checks: 2/2
  in both engines. The full legacy smoke page times out in Chromium before
  and after this change, so only its changed assertions claim parity.
2026-11-21 20:03:20 +08:00
ldm0 42ede340df fix(fetch): inherit intrinsic Headers prototype methods
Bind Headers storage objects to the realm's intrinsic Headers.prototype
and reuse its declared operations. Request, Response, fetch and Cache
headers now share operation identity and observe prototype method updates.

Cover replaced global constructors, Response getter/clone receiver realms,
and inherited method descriptors and iterator aliases.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 18,205 passed, 13 skipped
- Cache upstream WPT: 86/250 -> 180/250 (+94), no new failures
- Headers upstream WPT: 490/537, no regressions
- Prototype probes: 81/81; descriptor probes: 2/2 in Moli and Chromium
- Cache admission and Service Worker response regressions: 84/84 and 384/384
2026-11-21 20:03:20 +08:00
ldm0 60e8dbcf89 fix(cache): validate stored responses and preserve network errors
Give Cache.put its own response admission rules: accept Response.error(),
and reject public status 206 or Vary: * before consuming the body. Keep
filtered internal response metadata available for storage and respondWith.

Reconstruct error responses without invoking the global Response
constructor and make headers on all cached responses immutable. Cover
failed replacement, streaming bodies, cloned errors and global tampering.
2026-11-21 20:03:20 +08:00
ldm0 80a50e25d9 fix(fetch): preserve service worker response types and CORS headers
Carry the original response filter and validation state through Window
streams and Worker completions, including paused responses. Synthesized
responses remain basic, and already fetched bodies are not filtered by ORB
again. Keep client CORP/COEP checks against actual network response URLs.

Retain internal headers separately from the CORS public header view through
clone, deferred Cache.put, persistent Cache storage and respondWith. Match
Vary using the public header view and keep filtered cached headers immutable.
2026-11-21 20:03:20 +08:00
ldm0 0f818e4dfb fix(fetch): preserve opaque response metadata through service workers
Keep internal response status, status text and headers through Window and
Worker fetch, Response.clone(), Cache storage and FetchEvent.respondWith().
This preserves CORP checks when a require-corp client receives an opaque
response from a service worker.

Keep public opaque headers empty and immutable, and use the public header
view when matching Vary in Cache. Cover streamed and materialized responses,
opaque redirects, filtered HTTP 206 responses and Vary:* cache roundtrips.

Reject invalid filtered respondWith responses before following their
restored internal Location headers.
2026-11-21 20:03:20 +08:00
ldm0 292ba8b7c5 fix(fetch): keep data URL responses basic across request modes
Apply the data-scheme exception when selecting response filtering and the
observable response type. Data URL origins remain opaque, while no-cors
fetches retain their status, immutable headers and response body.

Cover Window and opaque-origin Worker fetches across request modes,
redirect modes, GET/HEAD/POST, Request clones, URL fragments, MIME types,
binary body reads, response clones and bodyUsed behavior.
2026-11-21 20:03:20 +08:00
ldm0 e23340dca6 fix(fetch): reject non-follow cross-origin no-cors requests
Reject cross-origin HTTP(S) no-cors requests with manual or error redirect
mode before transport, CDP interception, or Service Worker dispatch in
Window and Worker fetch. Check the logical URL at the fetch entry point
so a CDP transport URL rewrite retains the original policy decision.

Cover non-redirecting responses, Request clones and init overrides,
local URL fetches, argument and abort precedence, interception ordering,
and Service Worker dispatch counts.
2026-11-21 20:03:20 +08:00
ldm0 1b4bc50228 fix(fetch): preserve URLs on opaque redirect responses 2026-11-21 20:03:20 +08:00
ldm0 2bc2c48e21 fix(fetch): preserve redirect mode when filtering responses 2026-11-21 20:03:20 +08:00