Repository navigation
Wpt: vendor and run the workers corpus, in a real worker - #3225
Merged
Merged
Conversation
The workers/ corpus is the capstone of sebastienros#3167: it is reachable at all only because Jint now has a Worker. Eleven files, 15 assertions, run as the body of a real module worker built by a real `new Worker(…, { type: 'module' })` — not in the driver's top-level engine, where every one of them would have passed and proved nothing. Two lanes. WptWorkerProvider is a WorkerProvider — the shipped host extension point — and the driver pumps the parent and every live worker in turn on its own thread; nothing here starts one, so a suite's outcome cannot depend on how two schedulers interleaved. Results are read off the worker engine between turns rather than posted back, so a serializer defect would present as a failing assertion rather than as every worker suite reporting nothing. WptHarness.RunsInAWorker picks the lane from the directory *and* the `// META: global=` key, because neither half does the job alone, and EveryWorkerLaneFileIsAWorkersFile pins both directions — no previously vendored file moves. Eight of the 15 pass, and what passes is the worker global doing its job: dispatching a custom event at itself, taking `onmessage` eight times over, replacing `self.MessageEvent`, exposing atob/btoa, and — the best of them — refusing `postMessage(formData)` with a DataCloneError, so the worker global's postMessage really is the port's, running the real serializer. Six of the seven failures were decided in writing before a line of this ran, which is the point of running it: five are the three globals the design declines by name (WorkerGlobalScope, WorkerLocation, WorkerNavigator — divergences 5, 6 and 7) and one is nesting being off by default. The seventh is NeedsTriage and is not in the worker code: `self` is installed once for every global as a writable data property, against Window's [Replaceable] definition, where WorkerGlobalScope's is read-only. Recorded rather than fixed — the install predates Worker and is shared with the top-level lane. The shim stops assuming `self` is assignable so that fix will not break the harness. Twenty upstream .any.js files cannot be reached and are named with reasons. One row is a finding rather than a decision: workers/modules/ holds the flagship module-worker suite, and every one of its nine fixtures installs its onmessage handler inside `if ('DedicatedWorkerGlobalScope' in self && self instanceof DedicatedWorkerGlobalScope)`. Jint deliberately exposes no such interface object, so no handler is installed, the worker never answers, and the file hangs — the canonical "am I in a worker" sniff, failing in the fixture where no per-test exclusion can name it. The design named that wrinkle; this is what it costs. Also fixes leftover merge-conflict markers in Vendor/README.md, left by sebastienros#3215. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The capstone of #3167: the reachable subset of web-platform-tests'
workers/directory, vendored at the existing pin and run against the shipped implementation — inside a real worker. Every reachable.any.jsthere is// META: global=worker, so running them in the driver's top-level engine would prove nothing; the driver instead grew a worker lane that makes the file the body of a genuinenew Worker(…, { type: 'module' }), with parent and worker pumped cooperatively on the test's own thread through a thread-freeWptWorkerProvider. Results are read off the worker engine between turns rather than posted back, so a serializer defect fails an assertion instead of silencing every worker suite. A lane-classification pin (EveryWorkerLaneFileIsAWorkersFile) holds both directions of the routing rule.11 of 31 upstream files vendored (the rest named in the not-vendored table with reasons — browsing-context, classic-worker and
SharedWorkermaterial), 15 assertions, 0.46 s. Seven exclusion rows in three categories:NeedsDeclinedWorkerGlobals(the interface objects,locationandWorkerNavigatorthe design declines by name),NeedsWorkerNesting(off by default, by design), and one genuineNeedsTriage—selfis installed writable everywhere whileWorkerGlobalScope.selfisreadonly, now tracked as #3224.NeedsMessageChannel's stale "Jint has no worker story" wording is rewritten to what remains true.Two findings beyond the table: the flagship
modules/dedicated-worker-import.any.jssuite (nine tests of the feature Jint ships) stalls on the canonicalself instanceof DedicatedWorkerGlobalScopesniff and had to be not-vendored — posted to #3195 as a concrete cost datum for the exposure ruling — andVendor/README.mdon main carried live merge-conflict markers from #3215, fixed here since the file was being edited anyway.Closes the implementation plan of #3167.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PnghUC3EKrYa12xQ2LaYyd