| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 287e023 commit 6e56f01
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | 39 | # Reset this number to 0 on major V8 upgrades. | |
| 40 | 40 | # Increment by one for each non-official patch applied to deps/v8. | |
| 41 | - 'v8_embedder_string': '-node.49', | ||
| 41 | + 'v8_embedder_string': '-node.50', | ||
| 42 | 42 | ||
| 43 | 43 | ##### V8 defaults for Node.js ##### | |
| 44 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -364,6 +364,8 @@ enum class IsolateFieldId : uint8_t; | |||
| 364 | 364 | IF_WASM(V, wasm_WebAssemblyExceptionGetArg, \ | |
| 365 | 365 | "wasm::WebAssemblyExceptionGetArg") \ | |
| 366 | 366 | IF_WASM(V, wasm_WebAssemblyExceptionIs, "wasm::WebAssemblyExceptionIs") \ | |
| 367 | + IF_WASM(V, wasm_WebAssemblyExceptionGetStack, \ | ||
| 368 | + "wasm::WebAssemblyExceptionGetStack") \ | ||
| 367 | 369 | IF_WASM(V, wasm_WebAssemblyGlobal, "wasm::WebAssemblyGlobal") \ | |
| 368 | 370 | IF_WASM(V, wasm_WebAssemblyGlobalGetValue, \ | |
| 369 | 371 | "wasm::WebAssemblyGlobalGetValue") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3054,6 +3054,15 @@ void WebAssemblyExceptionIsImpl( | |||
| 3054 | 3054 | info.GetReturnValue().Set(tag_object->tag() == *tag); | |
| 3055 | 3055 | } | |
| 3056 | 3056 | ||
| 3057 | + void WebAssemblyExceptionGetStackImpl( | ||
| 3058 | + const v8::FunctionCallbackInfo<v8::Value>& info) { | ||
| 3059 | + WasmJSApiScope js_api_scope{info, "WebAssembly.Exception.stack()"}; | ||
| 3060 | + auto [isolate, i_isolate, thrower] = js_api_scope.isolates_and_thrower(); | ||
| 3061 | + EXTRACT_THIS(exception, WasmExceptionPackage); | ||
| 3062 | + | ||
| 3063 | + info.GetReturnValue().Set(v8::Undefined(isolate)); | ||
| 3064 | + } | ||
| 3065 | + | ||
| 3057 | 3066 | void WebAssemblyGlobalGetValueCommon(WasmJSApiScope& js_api_scope) { | |
| 3058 | 3067 | auto [isolate, i_isolate, thrower] = js_api_scope.isolates_and_thrower(); | |
| 3059 | 3068 | auto& info = js_api_scope.callback_info(); // Needed by EXTRACT_THIS. | |
@@ -3494,6 +3503,7 @@ void WasmJs::PrepareForSnapshot(Isolate* isolate) { | |||
| 3494 | 3503 | { | |
| 3495 | 3504 | DirectHandle<JSFunction> exception_constructor = InstallConstructorFunc( | |
| 3496 | 3505 | isolate, webassembly, "Exception", wasm::WebAssemblyException); | |
| 3506 | + exception_constructor->shared()->set_length(2); | ||
| 3497 | 3507 | SetDummyInstanceTemplate(isolate, exception_constructor); | |
| 3498 | 3508 | DirectHandle<JSObject> exception_proto = SetupConstructor( | |
| 3499 | 3509 | isolate, exception_constructor, WASM_EXCEPTION_PACKAGE_TYPE, | |
@@ -3503,6 +3513,8 @@ void WasmJs::PrepareForSnapshot(Isolate* isolate) { | |||
| 3503 | 3513 | wasm::WebAssemblyExceptionGetArg, 2); | |
| 3504 | 3514 | InstallFunc(isolate, exception_proto, "is", wasm::WebAssemblyExceptionIs, | |
| 3505 | 3515 | 1); | |
| 3516 | + InstallGetter(isolate, exception_proto, "stack", | ||
| 3517 | + wasm::WebAssemblyExceptionGetStack); | ||
| 3506 | 3518 | native_context->set_wasm_exception_constructor(*exception_constructor); | |
| 3507 | 3519 | ||
| 3508 | 3520 | DirectHandle<Map> initial_map(exception_constructor->initial_map(), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,7 @@ V8_EXPORT_PRIVATE std::unique_ptr<WasmStreaming> StartStreamingForTesting( | |||
| 33 | 33 | V(WebAssemblyCompile) \ | |
| 34 | 34 | V(WebAssemblyException) \ | |
| 35 | 35 | V(WebAssemblyExceptionGetArg) \ | |
| 36 | + V(WebAssemblyExceptionGetStack) \ | ||
| 36 | 37 | V(WebAssemblyExceptionIs) \ | |
| 37 | 38 | V(WebAssemblyGlobal) \ | |
| 38 | 39 | V(WebAssemblyGlobalGetValue) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,13 +106,19 @@ d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js"); | |||
| 106 | 106 | print(arguments.callee.name); | |
| 107 | 107 | let tag = new WebAssembly.Tag({parameters: []}); | |
| 108 | 108 | let exn = new WebAssembly.Exception(tag, []); | |
| 109 | + assertTrue('stack' in exn); | ||
| 109 | 110 | assertEquals(undefined, exn.stack); | |
| 110 | 111 | exn = new WebAssembly.Exception(tag, [], {traceStack: false}); | |
| 112 | + assertTrue('stack' in exn); | ||
| 111 | 113 | assertEquals(undefined, exn.stack); | |
| 112 | 114 | exn = new WebAssembly.Exception(tag, [], {traceStack: true}); | |
| 113 | 115 | assertTrue(exn.stack.indexOf(arguments.callee.name) > 0); | |
| 114 | 116 | assertThrows(() => new WebAssembly.Exception(tag, [], 0), TypeError, | |
| 115 | 117 | /Argument 2 is not an object/); | |
| 118 | + // The stack getter may only be used with a receiver that is a | ||
| 119 | + // WebAssembly.Exception. | ||
| 120 | + let proto = WebAssembly.Exception.prototype; | ||
| 121 | + assertThrows(() => proto.stack, TypeError); | ||
| 116 | 122 | })(); | |
| 117 | 123 | ||
| 118 | 124 | (function TestCatchJSException() { | |
@@ -319,3 +325,7 @@ function TestGetArgHelper(types_str, types, values) { | |||
| 319 | 325 | // Don't catch with implicit wrapping. | |
| 320 | 326 | assertThrowsEquals(() => instance.exports.test(obj), obj); | |
| 321 | 327 | })(); | |
| 328 | + | ||
| 329 | + (function TestExceptionConstructorLength() { | ||
| 330 | + assertEquals(2, WebAssembly.Exception.length); | ||
| 331 | + })(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments