From 402d59eea99481af30c2aa0aff19d90a4ce9ced3 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 13 Apr 2024 17:02:07 +0530 Subject: fix(ext/node): promise rejection in VM contexts (#23305) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/denoland/deno/issues/23297 `docusaurus build` works! ``` $ deno run -A repro.js fish: Job 1, 'deno run -A ../../littledivy/fs…' terminated by signal SIGSEGV (Address boundary error) $ denod run -A repro.js error: Uncaught (in promise) Error: rejected ``` Depends on https://github.com/denoland/deno_core/pull/693 --- tests/unit_node/vm_test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/unit_node/vm_test.ts b/tests/unit_node/vm_test.ts index b557350ad..21e56ee94 100644 --- a/tests/unit_node/vm_test.ts +++ b/tests/unit_node/vm_test.ts @@ -132,3 +132,19 @@ Deno.test({ assertEquals(isContext(sandbox), false); }, }); + +// https://github.com/denoland/deno/issues/23297 +Deno.test({ + name: "vm context promise rejection", + fn() { + const code = ` +function reject() { + return Promise.reject(new Error('rejected')); +} +reject().catch(() => {}) + `; + + const script = new Script(code); + script.runInNewContext(); + }, +}); -- cgit v1.2.3