Skip to content

fix(module-runner): keep stack trace interception working when Object.prototype is frozen - #23073

Merged
sapphi-red merged 1 commit into
vitejs:mainfrom
sheremet-va:fix/module-runner-frozen-object-prototype
Jul 27, 2026
Merged

sapphi-red merged 1 commit into
vitejs:mainfrom
sheremet-va:fix/module-runner-frozen-object-prototype

Conversation

@sheremet-va

@sheremet-va sheremet-va commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

Description

cloneCallSite copies every own property of CallSite.prototype, including constructor, onto a plain object. If user code ran Object.freeze(Object.prototype), that assignment throws on the first error.stack read, breaking the prepareStackTrace sourcemap interceptor. This clones onto a null-prototype object instead.

Fixes vitest-dev/vscode#798 (Vitest test collection crashing when includeTaskLocation is enabled).

…t.prototype` is frozen

`cloneCallSite` copied every own property of `CallSite.prototype`,
including `constructor`, onto a plain object. When user code runs
`Object.freeze(Object.prototype)`, that assignment throws
`TypeError: Cannot assign to read only property 'constructor'` the
first time `error.stack` is read, breaking any consumer of the
`prepareStackTrace` sourcemap interceptor (vitest-dev/vscode#798).

Clone onto a null-prototype object instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: ssr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object.freeze(Object.prototype) crashing vitest process

2 participants