fix(trace): convert file path to URI in StdinServer._loadTrace #39097
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.
Summary
Fix trace viewer failing when receiving trace paths via stdin (used by VS Code extension for live trace).
StdinServer._loadTrace()now callsvalidateTraceUrl()to convert file paths tofile?path=URI formatrunTraceViewerApp()andrunTraceInBrowser()Problem
After #38566, the trace viewer expects trace URIs in
file?path=...format, butStdinServer._loadTrace()was still sending raw file paths. This caused the Service Worker to attempt fetching the raw path directly, resulting in:Root Cause
In commit 185bfb7,
validateTraceUrl()was updated to convert file paths to URI format, butStdinServer._loadTrace()was not updated to use this function.Fix
private _loadTrace(traceUrl: string) { - this._traceUrl = traceUrl; + const validatedUrl = validateTraceUrl(traceUrl); + this._traceUrl = validatedUrl; clearTimeout(this._pollTimer); - this.sendEvent?.('loadTraceRequested', { traceUrl }); + this.sendEvent?.('loadTraceRequested', { traceUrl: validatedUrl }); }Test Plan
Fixes #39096