mirror of
https://github.com/denoland/deno.git
synced 2024-12-13 19:12:20 -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> |
||
---|---|---|
.. | ||
bench_tests.rs | ||
bundle_tests.rs | ||
cache_tests.rs | ||
cert_tests.rs | ||
check_tests.rs | ||
compile_tests.rs | ||
coverage_tests.rs | ||
doc_tests.rs | ||
eval_tests.rs | ||
flags_tests.rs | ||
fmt_tests.rs | ||
info_tests.rs | ||
init_tests.rs | ||
inspector_tests.rs | ||
install_tests.rs | ||
js_unit_tests.rs | ||
jsr_tests.rs | ||
jupyter_tests.rs | ||
lint_tests.rs | ||
lsp_tests.rs | ||
mod.rs | ||
node_compat_tests.rs | ||
node_unit_tests.rs | ||
npm_tests.rs | ||
publish_tests.rs | ||
repl_tests.rs | ||
run_tests.rs | ||
shared_library_tests.rs | ||
task_tests.rs | ||
test_tests.rs | ||
upgrade_tests.rs | ||
vendor_tests.rs | ||
watcher_tests.rs | ||
worker_tests.rs |