Skip to content

Commit fa4d078

Browse files
backesguybedford
authored andcommitted
deps: V8: cherry-pick b96e40d5ac85
Original commit message: [wasm][js-api] Fix exception handling in Exception Calling `Get` on the third argument can throw. If so, return immediately. [email protected] Fixed: 372993873 Change-Id: I70ec0d0421833a60151f6bcdc9c386f6ad864256 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5937803 Reviewed-by: Thibaud Michaud <[email protected]> Commit-Queue: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/main@{#96627} Refs: v8/v8@b96e40d
1 parent b8297e1 commit fa4d078

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

deps/v8/src/wasm/wasm-js.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,11 +2046,12 @@ void WebAssemblyExceptionImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
20462046
Local<Context> context = isolate->GetCurrentContext();
20472047
Local<Object> trace_stack_obj = Local<Object>::Cast(info[2]);
20482048
Local<String> trace_stack_key = v8_str(isolate, "traceStack");
2049-
v8::MaybeLocal<v8::Value> maybe_trace_stack =
2050-
trace_stack_obj->Get(context, trace_stack_key);
20512049
v8::Local<Value> trace_stack_value;
2052-
if (maybe_trace_stack.ToLocal(&trace_stack_value) &&
2053-
trace_stack_value->BooleanValue(isolate)) {
2050+
if (!trace_stack_obj->Get(context, trace_stack_key)
2051+
.ToLocal(&trace_stack_value)) {
2052+
return;
2053+
}
2054+
if (trace_stack_value->BooleanValue(isolate)) {
20542055
auto caller = Utils::OpenHandle(*info.NewTarget());
20552056

20562057
i::Handle<i::Object> capture_result;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2024 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
let tag = new WebAssembly.Tag({'parameters': []});
6+
let proxy = new Proxy({}, {
7+
'get': () => {
8+
throw new Error('boom')
9+
}
10+
});
11+
12+
assertThrows(() => new WebAssembly.Exception(tag, [], proxy), Error, 'boom');

0 commit comments

Comments
 (0)