Commit Graph
4368 Commits
Author SHA1 Message Date
ldm0 cfd5cd2fe0 feat(dom): add Observable error recovery
Add catch(callback) with native receiver and callback bindings. Forward source
values and completion, then convert the catcher's return value into one recovery
subscription after a source error. Recovery errors go directly downstream.

Replace the traced upstream observer when recovery starts so pending Promises
retain the replacement producer without retaining the exhausted source and
catcher. Reuse the existing signal-owned cancellation algorithms.

Cover Window/Worker conversion, error identity, shared subscriptions, reentrant
cancellation, teardown ordering, realms and GC. Verify all nine upstream catch
subtests in both realms and add those cases to the pass catalogue.
2026-11-24 14:30:20 +08:00
ldm0 b58b632679 feat(dom): add Observable switchMap subscriptions
Cancel the previous inner before mapping each source value, convert mapper
results through the native Observable path, and wait for active inner
completion after the source completes. Preserve the draft's shared controller
reference under reentrant mapper, conversion and teardown callbacks.

Trace each live inner and release replaced observers without persistent roots
outside the existing signal stores. Finish Window and Worker dependent abort
dispatch after IteratorClose failures, then propagate the first exception.

Cover Window and Worker conversion, switching, cancellation, cross-realm
receivers and callbacks, GC, and reentrant synchronous completion. Verify 61
related WPT cases: 576/592 to 590/592 subtests, no regressions. Add switchMap
and finally Window/Worker cases to the verified pass catalogue.
2026-11-24 14:30:20 +08:00
ldm0 65453c8b46 feat(dom): add serial Observable flatMap subscriptions
Queue source values until each mapped inner subscription completes, preserving
mapper indices, synchronous completion order, sharing and callback realms.
Trace the producer graph in V8 and release exhausted sources and queued values.

Finish shared abort algorithms before rethrowing the first IteratorClose
failure so cancellation always reaches both source and inner producers.
Cover Window/worker behavior, reentrancy, cancellation, realms and GC lifetimes.
2026-11-24 14:30:20 +08:00
ldm0 4138dffa6e feat(dom): add Observable finalization callbacks
Register finally callbacks through the existing Subscriber teardown path and
forward notifications with a native observer. Preserve cleanup ordering,
original terminal outcomes and callback-realm exception reporting.

Cover shared consumers, pre-abort, reentrant subscription, iterator-close
failures, Window/worker behavior, cross-realm calls and GC lifetimes.
2026-11-24 14:30:20 +08:00
ldm0 ced6fc974a fix(webidl): make the Window global prototype chain immutable
Build WindowProperties into the native template inheritance chain before
context creation so Window.prototype and EventTarget.prototype can keep
immutable prototypes while remaining extensible. Link Window's interface
constructor to EventTarget as well.

Preserve WindowProperties visibility and exotic mutation rules through
native interceptors, including inherited accessors, different receivers,
numeric names and symbols. Remove the post-bootstrap Proxy insertion.

Cover main and child realms with 186 regression assertions, verify
cross-origin navigation and promote the passing immutable-prototype WPT.
2026-11-24 14:30:20 +08:00
ldm0 7c6482a840 fix(workers): inherit EventTarget across worker global scopes
Build dedicated, shared and service worker globals from the native
EventTarget template before context creation. Preserve immutable global
prototype chains and explicitly link the Web IDL interface constructors.

Cover all three worker kinds with the same regression fixture, including
inherited when(), event delivery, cancellation, global error reporting,
receiver branding and replacement of the public EventTarget constructor.

Promote the passing worker inspect and immutable-prototype WPT cases.
2026-11-24 14:30:20 +08:00
ldm0 b22314cac4 feat(dom): add Observable inspection hooks
Convert inspector callbacks through the shared observer conversion boundary and
invoke them before source notifications. Remove the abort hook on producer
termination, report consumer-abort callback errors in their own realm, and trace
pending subscriptions without retaining abandoned callbacks.

Cover Window/Worker behavior, conversion order, reentrancy, cleanup errors,
callback realms and garbage collection. Fix 27 WPT subtests, including the two
takeUntil-toArray crashtests; worker-global when exposure remains a separate fix.
2026-11-24 14:30:20 +08:00
ldm0 3364d2a2f9 feat(dom): add Observable takeUntil
Convert notifier inputs using the native Observable conversion path, subscribe
to the notifier first, and share downstream cancellation across both inputs.
Notifier next/error completes downstream; notifier completion leaves the source
running and releases the exhausted notifier graph.

Cover receiver and conversion semantics, sharing, reentrancy, cleanup errors,
cross-realm results, Window/Worker behavior and garbage collection. Add the
three passing takeUntil WPT cases, fixing 26 subtests without regressions.
2026-11-24 14:30:20 +08:00
ldm0 a8573a904f feat(dom): add Observable take and drop operators
Reuse lazy native transform subscriptions for take/drop, preserving shared
counts, reentrant notification ordering, cancellation and early completion.
Keep each subscription's unsigned 64-bit count in a traced BigInt slot.

Fix unsigned-long-long conversion losing low bits for negative values by
applying the sign wrap in u64 after converting the magnitude. Add count,
conversion, Window/worker, realm, iterator-close and GC regression coverage.

Validation: fmt, all-target/all-feature workspace clippy, 172 targeted tests,
full nextest (19,297 passed; 13 skipped), 194 runtime checks, 40 realm checks,
and 43 WPT cases improving from 441/469 to 467/469 without regressions.
2026-11-24 14:30:20 +08:00
ldm0 16f0431ad1 feat(dom): add lazy Observable map and filter
Share native transform observers and callback indices across Window and worker
bindings. Trace live upstream chains without rooting abandoned subscriptions,
and release observer state after cancellation and pre-aborted subscriptions.

Preserve callback errors and terminal notifications when iterator closing fails,
finish teardown before propagating explicit cancellation errors, and cover
sharing, reentrancy, cross-realm calls, native lifetimes and mutable globals.

Validation: fmt, workspace clippy with all targets/features, full nextest
(19,292 passed; 13 skipped), 201 Window/worker fixture checks, 40 realm checks,
and 39 WPT cases improving from 416/443 to 441/443 subtests without regressions.
2026-11-24 14:30:20 +08:00
ldm0 9f5560041e feat(dom): add Observable some, every and find
Resolve predicate consumers on the first deciding value and cancel only
their own observer. Reuse traced WebIDL callbacks and native Promise state,
with boolean predicate conversion and reentrant settlement protection.

Cover shared subscriptions, conversion order, exception identity, worker
execution, callback/Promise realms, and callback lifetime after cancellation.
The focused WPT set improves from 364/418 to 416/418 subtests; eight complete
cases are added to the passing catalogue.

Validation: cargo fmt --all; all-targets/all-features workspace clippy with
-D warnings; CLI build; 160 focused tests; full nextest (19,287 passed,
13 skipped); 302 semantic checks in Window and worker; 48 realm checks.
2026-11-24 14:30:20 +08:00
ldm0 de12b21340 feat(dom): consume Observables with forEach and reduce
Implement native callback-driven Promise consumers for Window and workers,
using traced WebIDL callbacks and shared cancellation/settlement helpers.
Preserve exception identity, raw reducer values, reentrant notification
ordering, callback realms, and independent subscriptions.

Add conversion, cancellation, cross-realm, GC, and worker coverage. Record
five newly passing WPT cases: the audited suites improve from 330/372 to
364/372 subtests, with EventTarget regressions remaining 150/150.

Validation: cargo fmt --all; workspace all-targets/all-features clippy with
-D warnings; CLI build; 156 focused tests; full nextest (19,283 passed,
13 skipped). The supplemental fixture passes 132 checks in both globals.
2026-11-24 14:30:20 +08:00
ldm0 7fdb8889f4 feat(dom): collect Observable values with last and toArray
Add completion-based Promise operators in Window and workers, preserving
raw values, shared subscriptions and direct AbortSignal ordering. Reuse
the native Promise observer lifetime and settlement logic with first.

Cover receiver conversion, callee realms, thenable reentrancy, inherited
array setters and value reachability. Related WPTs improve from 302/326
to 324/326; EventTarget regressions remain 150/150.
2026-11-24 14:30:20 +08:00
ldm0 88bd1ab88c feat(dom): resolve first Observable values with native observers
Add Observable.first in Window and workers through the shared WebIDL
receiver and Promise adapters. Native observers use internal subscription
and AbortSignal dependency graphs, preserving shared producers and
reentrant Promise resolution without consulting public JS methods.

Cover thenable reentrancy, abort/teardown order, iterable closing,
callee realms, and observer reachability. Related WPTs improve from
290/304 to 302/304; EventTarget regressions remain 150/150.
2026-11-24 14:30:20 +08:00
ldm0 19b736968b feat(dom): convert iterables and promises to Observables
Implement Observable.from for Window and workers with native input brands,
per-subscription iterator records, Promise reactions and async-from-sync
adaptation. Preserve getter timing, exception identities and cancellation.

Keep private iterator abort algorithms weak in the existing signal stores,
and propagate synchronous iterator close errors through native cancellation.
Cover shared Window/worker semantics, callee realms and abandoned iterator GC.

The two official from variants improve from 2/48 to 46/48 each. Retain the
next-getter timing discrepancy and the unimplemented first() dependency as
failures; the existing Observable, AbortSignal and EventTarget cases pass.
2026-11-24 14:30:20 +08:00
ldm0 d7073b72a1 feat(dom): add EventTarget observable event streams
Implement EventTarget.when for Window and worker targets using native Observable subscriptions and the existing event listener and AbortSignal routes. Preserve capture/passive conversion, weak targets, native receiver brands and exact Window identity across navigation.

Cover multicast cancellation and restart, DOM propagation, public method tampering, cross-realm receivers, garbage collection and Window replacement. Add four verified WPT cases: 348/348 relevant subtests pass against Chromium. Workspace fmt, clippy and nextest pass (19267 tests, 13 skipped).
2026-11-24 14:30:20 +08:00
ldm0 65d9f3c025 feat(dom): implement Observable subscription lifecycle 2026-11-24 14:30:20 +08:00
ldm0 9112ea866d fix(dom): return standard XML parser error documents
Replace partial XML trees with a single parsererror root in the namespace
specified by HTML's DOMParser algorithm. Keep diagnostics as text and retain
the requested content type and document metadata. XHR parsing continues to
return no document on XML errors.

Replace Chromium-specific error-wrapper assertions with coverage for empty,
malformed and namespace-invalid input, prologues, doctypes, cross-realm
documents, serialization and valid author-created parsererror elements.

Validation: workspace fmt and strict all-feature Clippy; full nextest
19258 passed, 13 skipped; 22 WPT cases / 344 subtests; 1776 JS assertions.
2026-11-24 14:30:20 +08:00
ldm0 e0d70cd0b0 fix(dom): keep class collections live and honor quirks mode
Use the query root's current owner-document mode for ASCII class matching,
including cached collections after adoption. Standards and limited-quirks
documents retain case-sensitive matching.

Reuse native live collections for detached class queries so class changes,
tree mutations and cross-realm method calls use the current DOM. Cover
HTML, SVG, MathML, XML, whitespace and non-ASCII class names.

Validation: workspace fmt and strict all-feature Clippy; full nextest
19258 passed, 13 skipped; 37 WPT cases / 76 subtests; 813 JS assertions.
2026-11-24 14:30:20 +08:00
ldm0 07368c0cd2 fix(file-api): retain MediaSource targets in object URLs
Register branded MediaSource objects alongside Blob entries, preserving native
identity, creator keys and URL lifetimes. Capture the entry kind in parsed URLs
and reject MediaSource fetches with a network error.

Cover identity retention through wrapper GC and isolate teardown, revocation,
cross-realm receivers and worker consumers. Add the passing MediaSource WPT
to the catalogue.
2026-11-24 14:30:20 +08:00
ldm0 3fd5d337c5 fix(fetch): honor byte ranges in blob URL responses
Resolve single ranges against captured Blob bytes for Window and Worker Fetch
and XHR, including partial response headers and integrity verification. Reject
malformed or unsatisfiable ranges and normalize author headers before CORS
preflight and context overrides so repeated ranges cannot lose earlier values
or skip preflight.

Cover byte boundaries, cloned and revoked URL entries, empty and binary bodies,
request guards, synchronous XHR, and partial-body integrity. Add the two passing
Blob range WPT cases to the verified catalogue.
2026-11-24 14:30:19 +08:00
ldm0 791aa10cb3 fix(fetch): enforce integrity before response handover
Preserve integrity through Window and worker fetch continuations and wait for
complete response bytes before applying the shared SRI validator. Cover local,
network, intercepted, and Service Worker responses, retaining null-body state
and abort reasons.

Add regressions for digest selection, body completion, and null versus empty
responses; preserve non-ASCII whitespace in integrity metadata parsing.
2026-11-24 14:30:19 +08:00
ldm0 3467ff8795 fix(fetch): include required headers in blob URL responses
Always expose Content-Length from the Blob's byte size and Content-Type
from its type, including empty values. Fetch and XHR use the same builder
for fresh and captured Blob URL entries.

Cover binary and Unicode payloads, empty types, File and slice responses,
cloned requests, and URL revocation in Window and Worker tests.
2026-11-24 14:30:19 +08:00
ldm0 433d772b89 fix(fetch): propagate explicit referrers and preflight policies
Forward Window and Worker Fetch referrer values into the transport without
changing the request origin, cookie initiator, or network partition.
Derived preflight requests inherit referrer state and policies while keeping
other metadata, including integrity, separate.

Cover real Window and Worker requests, buffered and streaming preflights,
referrer overrides, sanitization, and request identity preservation.
2026-11-24 14:30:19 +08:00
ldm0 26cc26be58 fix(fetch): enforce request header guards on fetch initializers
Use the existing Request guard selection for Window and Worker fetch headers,
including Request inputs with overridden headers. Preserve inherited headers
when no override is supplied and retain the no-cors guard.

Cover forbidden headers, method override values, all initializer forms,
conversion exceptions, and unmodified inputs in both native fetch paths.
2026-11-24 14:30:19 +08:00
ldm0 b77f0dec73 fix(indexeddb): snapshot writes before evaluating keys 2026-11-24 14:30:19 +08:00
ldm0 c1953283e2 fix(indexeddb): validate schema key paths and exception ordering
Validate key paths and schema options in the backend before metadata writes.
Preserve method-specific precedence for duplicates, syntax and option errors,
and use native transaction mode together with activity and deletion state.

Check receivers and required arity before conversion, consume iterable key
paths once, and read IDB dictionary members in WebIDL order. Keep synchronous
schema exceptions in the callee realm while mutating the store in its owner
realm.

Cover native metadata rejection, argument parsing and Window/iframe/Worker
behavior. Record eight newly passing official IndexedDB WPT cases.
2026-11-24 14:30:19 +08:00
ldm0 a35d503c1e fix(indexeddb): propagate request events and abort failed transactions
Reuse EventTarget listener dispatch for request, transaction and database
capture/bubble paths, ordered handler properties, listener options and callback
cleanup. Keep event parents private so author properties cannot change them.

Abort active transactions after uncanceled request errors or thrown listeners,
while preserving the original request error and giving pending requests fresh
AbortErrors. Keep committing transactions inactive, reject further commit/abort
calls, and abort committing request failures before their error notifications.

Cover event order, cancellation, listener exceptions, microtasks, explicit commit
and persisted data in Window, child and Worker regressions. Record 16 additional
complete official WPT passes.

Validation: fmt, strict workspace Clippy, and 19,159 nextest tests passed.
Official WPT sample: 54 -> 70 passes out of 78, without regressions.
2026-11-24 14:30:19 +08:00
ldm0 46509feba9 fix(indexeddb): validate transaction creation across upgrade boundaries
Convert store names before the mode enum and read iterator methods once.
Use the generated receiver and required-argument checks. Reject live
upgrades, closing connections, missing stores and empty scopes before
creating or queuing transactions; reject versionchange after those checks.
Normalize transaction scopes to unique names.

Reserve the open result before upgrade-complete callbacks can enqueue
regular transaction results. Keep request.transaction until complete
returns and still check for a closed connection when delivering open.

Exercise Window, iframe and Worker through the production browser event
loop, including getter errors, pending transactions and upgrade state
boundaries. Record newly passing upstream WPT variants after verification.
2026-11-24 14:30:19 +08:00
ldm0 5c22288fd5 fix(indexeddb): coordinate connections across Window and worker agents
Discover connections through the shared manager and deliver versionchange
notifications through each owning event loop. Acknowledge notifications after
their microtask checkpoints and retain the resulting blocked-event decision
when a later timer closes the connection.

Keep closing connections alive until accepted transactions finish, including
transactions awaiting their backend start. Abort transactions and release
connection requests when a worker exits. Keep borrowed database operations
in the connection's realm while preserving the callee's exception realm.

Count transaction requests only after an operation is accepted, so synchronous
validation errors cannot leave closing connections waiting on phantom work.

Cover Window/Worker and two-worker notifications, close-pending transactions,
cross-realm methods, worker termination, rollback and retired requesters.
2026-11-24 14:30:19 +08:00
ldm0 5429639793 fix(parser): adapt WPT paths to shared parser state
Preserve owner interruptions during deferred script preparation and use the
current HTML stream and custom-element construction interfaces. Restore
body/window content-handler registration on the new child insertion path and
remove mutation adapters superseded by the shared parser lifecycle.

Validation: cargo fmt --all; strict all-feature workspace Clippy; cargo nextest
run --no-fail-fast (19,128 passed, 13 skipped). The nine child handler regressions
also pass in a focused run.
2026-11-24 14:30:19 +08:00
ldm0 4a2a070fa4 fix(events): share AbortSignal EventTarget dispatch
Use inherited EventTarget methods and the shared listener registry for window and worker signals. Preserve ordered onabort handlers, cancellation options, listener mutation, and receiver validation while keeping abort algorithms with their existing owners.

Remove the duplicate dispatchers and tighten the raw callback inventory. Cover cross-realm bindings, retired targets, native abort delivery, and worker receivers.
2026-11-24 14:30:19 +08:00
ldm0 ee733c7016 test(wpt): remove regressions duplicated by main 2026-11-24 14:30:19 +08:00
ldm0 24a04caf20 fix(runtime): adapt WPT paths to shared script execution 2026-11-24 14:30:19 +08:00
ldm0 5937742d8e test(blob): verify captured entries bypass request interception 2026-11-24 14:30:19 +08:00
ldm0 350fbd7a3d fix(events): preserve cleanup for host-dispatched child events 2026-11-24 14:30:19 +08:00
ldm0 e86e3aef89 fix(messaging): preserve MessagePort document lifecycle
Create detached branded ports from retained constructors, retire stale owners
before transfer, and reject manual dispatch on retired receiver realms after
validating Event state. Capture postMessage destinations after argument
conversion and before serialization so reentry cannot revive old connections
or cancel an already selected live destination.

Cover constructor realms, frame reinsertion, endpoint cleanup, borrowed
dispatch, transfer and serialization reentry.
2026-11-24 14:30:19 +08:00
ldm0 0188020c49 fix(events): share MessagePort EventTarget dispatch 2026-11-24 14:30:19 +08:00
ldm0 5251ad7ac9 fix(events): route borrowed Window EventTarget methods
Capture Window execution bindings before argument conversion and dispatch in
the receiver realm. Borrowed add/remove/dispatch methods now use the receiver's
listener list and currentTarget, reject cross-origin access before conversion,
and cannot retarget a replacement Window after a getter navigates or removes it.

Cover parent/child realm routing, receiver replacement during conversion,
cross-origin checks, and borrowed Window onerror dispatch.
2026-11-24 14:30:19 +08:00
ldm0 1097590489 fix(events): preserve original Window onerror data 2026-11-24 14:30:19 +08:00
ldm0 3f8f413e51 fix(events): dispatch worker onerror through ordered listeners 2026-11-24 14:30:19 +08:00
ldm0 5dadf3f269 fix(events): report worker listener exceptions once 2026-11-24 14:30:19 +08:00
ldm0 a7f68bf304 fix(events): preserve object-valued handlers on simple targets
Keep legacy EventHandler object values and their listener registration position
across page, popup and worker targets. Invoke non-callable handler objects as
no-ops while retaining callback-interface behavior for ordinary listeners.

Cover cross-realm identity, proxy callability, native dispatch and worker
surfaces, and correct obsolete object-to-null assertions in local fixtures.
2026-11-24 14:30:19 +08:00
ldm0 c3e5429e98 fix(events): preserve listener mutations during dispatch
Track the exact registration represented by each dispatch snapshot and
refresh active handlers before invoking them. Removing and re-adding the
same callback no longer revives an entry from the current snapshot, while
handler replacements use their current value and callback contexts.

Share invocation preparation across simple event targets, worker threads,
and Worker/SharedWorker host error dispatch. Remove once listeners before
calling author code so a reentrant registration remains active.

Cover listener replacement, abort, object callbacks, nested dispatch,
realm retirement, and actual worker message and error delivery.
2026-11-24 14:30:19 +08:00
ldm0 3ff32f9834 fix(events): preserve DOM handler object values
Keep object values in DOM and Window event handler slots and convert
primitives to null. Distinguish legacy handlers from EventListener
callbacks so non-callable handlers return undefined without looking up
handleEvent, retaining listener order and surviving object-realm retirement.

Cover callable and revoked proxies, child windows, handler object lifetime,
and special Window callbacks. Update older assertions to check object
identity separately from primitive clearing.
2026-11-24 14:30:19 +08:00
ldm0 f5a75045ce fix(events): preserve handler mutations during compile errors 2026-11-24 14:30:19 +08:00
ldm0 52e11b016a 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-24 14:30:19 +08:00
ldm0 ee944ea468 fix(workers): keep module workers alive after evaluation errors 2026-11-24 14:30:19 +08:00
ldm0 7c9ab41694 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-24 14:30:19 +08:00
ldm0 a6a3e0cdf7 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-24 14:30:19 +08:00