Repository navigation
Parse the hosted player's trace in a Web Worker - #514
Merged
Merged
Conversation
This was referenced Oct 30, 2026
The hosted player unpacked and parsed the zip on the main thread, so the tab froze for the whole read, and "Opening trace…" was all it could say. The parse now runs in a module worker loaded from the player's own origin, which the CSP already allows through script-src 'self', and the landing screen names the step it is on: reading the file, unpacking, building the timeline. There is no percentage, since none of the steps can report one. The worker and the no-Worker fallback run the same handler, so the tests exercise the code the worker runs. A worker that fails to start rejects the open rather than falling back silently, so a CSP break is visible. Closes #497 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vishnuv688
force-pushed
the
fix/505-screenshot-extension
branch
from
October 30, 2026 10:12
7a751ea to
730a86d
Compare
vishnuv688
force-pushed
the
perf/497-parse-in-worker
branch
from
October 30, 2026 10:12
6bfa403 to
938e36a
Compare
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.
What & why
Closes #497. Part of #494. Stacked on #513.
The hosted player unpacked and parsed the zip on the main thread, so the tab froze for the whole read and the landing screen could only say "Opening trace…". The parse now runs in a Web Worker, and the landing screen names the step it is on: reading the file, unpacking the archive, building the timeline.
Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)selenium-devtools-py(Selenium Python adapter)backend(server)app(UI)script(page-injected runtime)trace(Trace mode)Capability matrix
packages/conformance/src/features.tsupdated, and tables regenerated withpnpm docs:capabilities, if this adds or changes user-facing behaviourNot needed: hosted player only, not per-adapter.
Notes for reviewers
Design notes
new Worker(new URL('./trace-parse.worker.ts', import.meta.url), { type: 'module' }), emitted as a hashed file under/assets/and loaded from the player's own origin. The CSP sets noworker-src, so it falls back toscript-src 'self', which already allows it;vercel.jsonis unchanged.answerParseRequest, which the no-Worker path (vitest's happy-dom has no Worker) runs in the page, so the tests exercise the code the worker runs.Not a readable trace: <reason>andNo trace found in this archive. A worker that fails to load rejects the open ("The trace reader could not start") rather than falling back silently, so a CSP break would be visible.unzipSynccannot report one.parseTraceZipintraceis split intounzipTraceZipandparseTraceEntriesso the worker can report the step between them;parseTraceZipcomposes the two and behaves as before.Bundles
trace-parse.worker-*.js, 21 KB, created by the pageindex-*.jsnew Workerindist/index-*.jsTesting
pnpm build,pnpm test(3313 passed) andpnpm lintare green.parseInWorkeragainst a fake Worker (URL, module type, bytes transferred, worker terminated, a worker that fails to start); phase order and error wording fromreadTraceArchive; the split reader functions give the same result asparseTraceZip. The existing hosted tests pass unchanged.Not verified yet (needs a browser, in
pnpm player:hosted)/assets/trace-parse.worker-*.js, and the console shows no CSP violation.pnpm demo:wdio), no worker file is requested.Screenshots / recordings
To be added: the landing screen during each phase.
🤖 Generated with Claude Code