| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 74ab710 commit a34c4ea
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,7 +40,7 @@ | |||
| 40 | 40 | ||
| 41 | 41 | # Reset this number to 0 on major V8 upgrades. | |
| 42 | 42 | # Increment by one for each non-official patch applied to deps/v8. | |
| 43 | - 'v8_embedder_string': '-node.19', | ||
| 43 | + 'v8_embedder_string': '-node.20', | ||
| 44 | 44 | ||
| 45 | 45 | ##### V8 defaults for Node.js ##### | |
| 46 | 46 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -375,6 +375,8 @@ enum class IsolateFieldId : uint8_t; | |||
| 375 | 375 | IF_WASM(V, wasm_WebAssemblyExceptionGetArg, \ | |
| 376 | 376 | "wasm::WebAssemblyExceptionGetArg") \ | |
| 377 | 377 | IF_WASM(V, wasm_WebAssemblyExceptionIs, "wasm::WebAssemblyExceptionIs") \ | |
| 378 | + IF_WASM(V, wasm_WebAssemblyExceptionGetStack, \ | ||
| 379 | + "wasm::WebAssemblyExceptionGetStack") \ | ||
| 378 | 380 | IF_WASM(V, wasm_WebAssemblyGlobal, "wasm::WebAssemblyGlobal") \ | |
| 379 | 381 | IF_WASM(V, wasm_WebAssemblyGlobalGetValue, \ | |
| 380 | 382 | "wasm::WebAssemblyGlobalGetValue") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3119,6 +3119,15 @@ void WebAssemblyExceptionIsImpl( | |||
| 3119 | 3119 | info.GetReturnValue().Set(tag_object->tag() == *tag); | |
| 3120 | 3120 | } | |
| 3121 | 3121 | ||
| 3122 | + void WebAssemblyExceptionGetStackImpl( | ||
| 3123 | + const v8::FunctionCallbackInfo<v8::Value>& info) { | ||
| 3124 | + WasmJSApiScope js_api_scope{info, "WebAssembly.Exception.stack()"}; | ||
| 3125 | + auto [isolate, i_isolate, thrower] = js_api_scope.isolates_and_thrower(); | ||
| 3126 | + EXTRACT_THIS(exception, WasmExceptionPackage); | ||
| 3127 | + | ||
| 3128 | + info.GetReturnValue().Set(v8::Undefined(isolate)); | ||
| 3129 | + } | ||
| 3130 | + | ||
| 3122 | 3131 | void WebAssemblyGlobalGetValueCommon(WasmJSApiScope& js_api_scope) { | |
| 3123 | 3132 | auto [isolate, i_isolate, thrower] = js_api_scope.isolates_and_thrower(); | |
| 3124 | 3133 | auto& info = js_api_scope.callback_info(); // Needed by EXTRACT_THIS. | |
@@ -3562,6 +3571,7 @@ void WasmJs::PrepareForSnapshot(Isolate* isolate) { | |||
| 3562 | 3571 | { | |
| 3563 | 3572 | DirectHandle<JSFunction> exception_constructor = InstallConstructorFunc( | |
| 3564 | 3573 | isolate, webassembly, "Exception", wasm::WebAssemblyException); | |
| 3574 | + exception_constructor->shared()->set_length(2); | ||
| 3565 | 3575 | SetDummyInstanceTemplate(isolate, exception_constructor); | |
| 3566 | 3576 | DirectHandle<JSObject> exception_proto = SetupConstructor( | |
| 3567 | 3577 | isolate, exception_constructor, WASM_EXCEPTION_PACKAGE_TYPE, | |
@@ -3571,6 +3581,8 @@ void WasmJs::PrepareForSnapshot(Isolate* isolate) { | |||
| 3571 | 3581 | wasm::WebAssemblyExceptionGetArg, 2); | |
| 3572 | 3582 | InstallFunc(isolate, exception_proto, "is", wasm::WebAssemblyExceptionIs, | |
| 3573 | 3583 | 1); | |
| 3584 | + InstallGetter(isolate, exception_proto, "stack", | ||
| 3585 | + wasm::WebAssemblyExceptionGetStack); | ||
| 3574 | 3586 | native_context->set_wasm_exception_constructor(*exception_constructor); | |
| 3575 | 3587 | ||
| 3576 | 3588 | DirectHandle<Map> initial_map(exception_constructor->initial_map(), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,7 @@ V8_EXPORT_PRIVATE std::unique_ptr<WasmStreaming> StartStreamingForTesting( | |||
| 34 | 34 | V(WebAssemblyCompile) \ | |
| 35 | 35 | V(WebAssemblyException) \ | |
| 36 | 36 | V(WebAssemblyExceptionGetArg) \ | |
| 37 | + V(WebAssemblyExceptionGetStack) \ | ||
| 37 | 38 | V(WebAssemblyExceptionIs) \ | |
| 38 | 39 | V(WebAssemblyGlobal) \ | |
| 39 | 40 | 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 | + })(); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,10 @@ | |||
| 42 | 42 | 'wpt/table/type.tentative': [FAIL], | |
| 43 | 43 | 'wpt/tag/type.tentative': [FAIL], | |
| 44 | 44 | ||
| 45 | + # TODO(mliedtke): This requires synchronizing the spec-tests with their newest version. | ||
| 46 | + 'wpt/exception/constructor.tentative': [FAIL], | ||
| 47 | + 'exception/constructor.tentative': [FAIL], | ||
| 48 | + | ||
| 45 | 49 | # Broken test (forgot to define JS function 'nulls()'). | |
| 46 | 50 | 'table/grow-memory64': [FAIL], | |
| 47 | 51 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments