deps: V8: cherry-pick 1d7159580156

Original commit message:

    [explicit-resource-management] Clear isolate internal exception

    This CL clears the isolate internal exception before rejecting
    the promise.

    Bug: 418103036
    Change-Id: If3748f7fc4b79b7b5be5009b9fff0d0267541a6f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6594252
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#100532}

Refs: 1d71595801
PR-URL: https://github.com/nodejs/node/pull/58749
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Michaël Zasso 2025-06-18 08:48:13 +02:00
parent 6a3b545b4d
commit 8db664f72c
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
4 changed files with 31 additions and 8 deletions

View File

@ -38,7 +38,7 @@
# Reset this number to 0 on major V8 upgrades. # Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8. # Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.14', 'v8_embedder_string': '-node.15',
##### V8 defaults for Node.js ##### ##### V8 defaults for Node.js #####

View File

@ -89,10 +89,6 @@ BUILTIN(AsyncDisposeFromSyncDispose) {
kMethod))), kMethod))),
isolate); isolate);
v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
try_catch.SetVerbose(false);
try_catch.SetCaptureMessage(false);
MaybeDirectHandle<Object> result = MaybeDirectHandle<Object> result =
Execution::Call(isolate, sync_method, receiver, {}); Execution::Call(isolate, sync_method, receiver, {});
@ -107,7 +103,8 @@ BUILTIN(AsyncDisposeFromSyncDispose) {
return {}; return {};
} }
// d. IfAbruptRejectPromise(result, promiseCapability). // d. IfAbruptRejectPromise(result, promiseCapability).
DCHECK(try_catch.HasCaught()); isolate->clear_internal_exception();
isolate->clear_pending_message();
JSPromise::Reject(promise, direct_handle(exception, isolate)); JSPromise::Reject(promise, direct_handle(exception, isolate));
} }

View File

@ -1133,7 +1133,7 @@ Correctly predicted as caught
Running test: testCase Running test: testCase
> Throwing from throwInAsyncDisposeFormSync, handling with dontHandleAsync > Throwing from throwInAsyncDisposeFormSync, handling with dontHandleAsync
Paused on caught exception Paused on uncaught promiseRejection
[Symbol.dispose] (catch-prediction.js:188:6) [Symbol.dispose] (catch-prediction.js:188:6)
throwInAsyncDisposeFormSync (catch-prediction.js:185:18) throwInAsyncDisposeFormSync (catch-prediction.js:185:18)
dontHandleAsync (catch-prediction.js:196:8) dontHandleAsync (catch-prediction.js:196:8)
@ -1171,7 +1171,7 @@ Correctly predicted as uncaught
Running test: testCase Running test: testCase
> Throwing from throwInAsyncDisposeFormSync, handling with awaitAndCreateInTry > Throwing from throwInAsyncDisposeFormSync, handling with awaitAndCreateInTry
Paused on caught exception Paused on caught promiseRejection
[Symbol.dispose] (catch-prediction.js:188:6) [Symbol.dispose] (catch-prediction.js:188:6)
throwInAsyncDisposeFormSync (catch-prediction.js:185:18) throwInAsyncDisposeFormSync (catch-prediction.js:185:18)
awaitAndCreateInTry (catch-prediction.js:202:10) awaitAndCreateInTry (catch-prediction.js:202:10)

View File

@ -0,0 +1,26 @@
// Copyright 2025 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --ignore-unhandled-promises
const obj = {
get f() {
async function f() {
function g() {
throw 1;
}
g[Symbol.dispose] = g;
await using y = g;
}
return f();
},
};
async function test(obj) {
const ser = d8.serializer.serialize(obj);
const des = d8.serializer.deserialize(ser);
await des;
}
assertThrowsAsync(test(obj), Error);