mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
b2cd254c35
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> |
||
---|---|---|
.. | ||
_fs | ||
crypto | ||
internal | ||
testdata | ||
_test_utils.ts | ||
assertion_error_test.ts | ||
async_hooks_test.ts | ||
buffer_test.ts | ||
child_process_test.ts | ||
console_test.ts | ||
dgram_test.ts | ||
events_test.ts | ||
fs_test.ts | ||
http2_test.ts | ||
http_test.ts | ||
module_test.ts | ||
net_test.ts | ||
os_test.ts | ||
path_test.ts | ||
perf_hooks_test.ts | ||
process_test.ts | ||
querystring_test.ts | ||
readline_test.ts | ||
repl_test.ts | ||
stream_test.ts | ||
string_decoder_test.ts | ||
timers_test.ts | ||
tls_test.ts | ||
tty_test.ts | ||
util_test.ts | ||
v8_test.ts | ||
vm_test.ts | ||
worker_threads_test.ts | ||
zlib_test.ts |