mirror of
https://github.com/denoland/deno.git
synced 2024-12-12 10:37:52 -05:00
ab60d9e6a3
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when using `Object.prototype.isPrototypeOf` to check built-in types. ```js import vm from "node:vm"; const err = new Error(); const crossErr = vm.runInNewContext(`new Error()`); console.assert( !(crossErr instanceof Error) ); console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) ); ``` This PR changes to check using internal slots solves them. --- current: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error {} > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) Date {} ``` this PR: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error: message at <anonymous>:1:1 > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) 2018-12-10T02:26:59.002Z ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> |
||
---|---|---|
.. | ||
console | ||
crypto | ||
dns | ||
fs | ||
process | ||
readline | ||
streams | ||
test | ||
util | ||
assert.mjs | ||
async_hooks.ts | ||
buffer.d.ts | ||
buffer.mjs | ||
child_process.ts | ||
cli_table.ts | ||
constants.ts | ||
dgram.ts | ||
dtrace.ts | ||
error_codes.ts | ||
errors.ts | ||
event_target.mjs | ||
fixed_queue.ts | ||
hide_stack_frames.ts | ||
http.ts | ||
idna.ts | ||
net.ts | ||
normalize_encoding.mjs | ||
options.ts | ||
primordials.mjs | ||
querystring.ts | ||
stream_base_commons.ts | ||
timers.mjs | ||
url.ts | ||
util.mjs | ||
validators.mjs |