Skip to content

Truly independent web browser

LibWeb: Give WebAssemblyInstantiatedSource objects the Object prototype

Andreas Klingb22318576586
diff --git a/Libraries/LibWeb/WebAssembly/WebAssembly.cpp b/Libraries/LibWeb/WebAssembly/WebAssembly.cpp
index 3c3dd238078..df7a3b1ef6f 100644
--- a/Libraries/LibWeb/WebAssembly/WebAssembly.cpp
+++ b/Libraries/LibWeb/WebAssembly/WebAssembly.cpp
@@ -1633,7 +1633,9 @@ void resolve_webassembly_instance_promise(JS::Realm& realm, WebIDL::Promise& pro
GC::Ref<JS::Object> create_webassembly_instantiated_source(JS::Realm& realm, GC::Ref<WebAssembly::Module> module, GC::Ref<WebAssembly::Instance> instance)
{
- auto result = JS::Object::create(realm, nullptr);
+ // NB: The WebAssemblyInstantiatedSource dictionary converts to an ordinary object, whose prototype is
+ // %Object.prototype%.
+ auto result = JS::Object::create(realm, realm.intrinsics().object_prototype());
result->define_direct_property("module"_utf16_fly_string, Bindings::wrap(Bindings::host_defined_wrapper_world(realm), realm, module), JS::default_attributes);
result->define_direct_property("instance"_utf16_fly_string, Bindings::wrap(Bindings::host_defined_wrapper_world(realm), realm, instance), JS::default_attributes);
return result;
diff --git a/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.txt b/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.txt
index 45f8256d950..f129078cb36 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.txt
@@ -2,62 +2,62 @@ Harness status: OK
Found 57 tests
-29 Pass
-28 Fail
+56 Pass
+1 Fail
Pass Missing arguments
-Fail Branding
+Pass Branding
Pass Invalid arguments
Pass Promise type
-Fail Empty module without imports argument: BufferSource argument
+Pass Empty module without imports argument: BufferSource argument
Pass Empty module without imports argument: Module argument
-Fail Empty module with undefined imports argument: BufferSource argument
+Pass Empty module with undefined imports argument: BufferSource argument
Pass Empty module with undefined imports argument: Module argument
-Fail Empty module with empty imports argument: BufferSource argument
+Pass Empty module with empty imports argument: BufferSource argument
Pass Empty module with empty imports argument: Module argument
-Fail getter order for imports object: BufferSource argument
+Pass getter order for imports object: BufferSource argument
Pass getter order for imports object: Module argument
-Fail imports: BufferSource argument
+Pass imports: BufferSource argument
Pass imports: Module argument
-Fail imports with empty module names: BufferSource argument
+Pass imports with empty module names: BufferSource argument
Pass imports with empty module names: Module argument
-Fail imports with empty names: BufferSource argument
+Pass imports with empty names: BufferSource argument
Pass imports with empty names: Module argument
-Fail exports with empty name: function: BufferSource argument
+Pass exports with empty name: function: BufferSource argument
Pass exports with empty name: function: Module argument
-Fail exports with empty name: table: BufferSource argument
+Pass exports with empty name: table: BufferSource argument
Pass exports with empty name: table: Module argument
-Fail exports with empty name: global: BufferSource argument
+Pass exports with empty name: global: BufferSource argument
Pass exports with empty name: global: Module argument
-Fail No imports: BufferSource argument
+Pass No imports: BufferSource argument
Pass No imports: Module argument
-Fail exports and imports: BufferSource argument
+Pass exports and imports: BufferSource argument
Pass exports and imports: Module argument
-Fail i64 exports and imports: BufferSource argument
+Pass i64 exports and imports: BufferSource argument
Pass i64 exports and imports: Module argument
-Fail import with i32-returning function: BufferSource argument
+Pass import with i32-returning function: BufferSource argument
Pass import with i32-returning function: Module argument
-Fail import with function that takes and returns i32: BufferSource argument
+Pass import with function that takes and returns i32: BufferSource argument
Pass import with function that takes and returns i32: Module argument
-Fail import with i64-returning function: BufferSource argument
+Pass import with i64-returning function: BufferSource argument
Pass import with i64-returning function: Module argument
-Fail import with function that takes and returns i64: BufferSource argument
+Pass import with function that takes and returns i64: BufferSource argument
Pass import with function that takes and returns i64: Module argument
-Fail import with i32-taking function: BufferSource argument
+Pass import with i32-taking function: BufferSource argument
Pass import with i32-taking function: Module argument
-Fail import with i64-taking function: BufferSource argument
+Pass import with i64-taking function: BufferSource argument
Pass import with i64-taking function: Module argument
-Fail export i64-returning function: BufferSource argument
+Pass export i64-returning function: BufferSource argument
Pass export i64-returning function: Module argument
-Fail i32 mutable WebAssembly.Global import: BufferSource argument
+Pass i32 mutable WebAssembly.Global import: BufferSource argument
Pass i32 mutable WebAssembly.Global import: Module argument
-Fail i64 mutable WebAssembly.Global import: BufferSource argument
+Pass i64 mutable WebAssembly.Global import: BufferSource argument
Pass i64 mutable WebAssembly.Global import: Module argument
-Fail Multiple i64 arguments: BufferSource argument
+Pass Multiple i64 arguments: BufferSource argument
Pass Multiple i64 arguments: Module argument
-Fail stray argument: BufferSource argument
+Pass stray argument: BufferSource argument
Pass stray argument: Module argument
-Fail Synchronous options handling: Buffer argument
+Pass Synchronous options handling: Buffer argument
Fail Synchronous options handling: Module argument
Pass Empty buffer
Pass Invalid code
-Fail Changing the buffer
\ No newline at end of file
+Pass Changing the buffer
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.worker.txt
index 45f8256d950..f129078cb36 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.worker.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/wasm/jsapi/constructor/instantiate.any.worker.txt
@@ -2,62 +2,62 @@ Harness status: OK
Found 57 tests
-29 Pass
-28 Fail
+56 Pass
+1 Fail
Pass Missing arguments
-Fail Branding
+Pass Branding
Pass Invalid arguments
Pass Promise type
-Fail Empty module without imports argument: BufferSource argument
+Pass Empty module without imports argument: BufferSource argument
Pass Empty module without imports argument: Module argument
-Fail Empty module with undefined imports argument: BufferSource argument
+Pass Empty module with undefined imports argument: BufferSource argument
Pass Empty module with undefined imports argument: Module argument
-Fail Empty module with empty imports argument: BufferSource argument
+Pass Empty module with empty imports argument: BufferSource argument
Pass Empty module with empty imports argument: Module argument
-Fail getter order for imports object: BufferSource argument
+Pass getter order for imports object: BufferSource argument
Pass getter order for imports object: Module argument
-Fail imports: BufferSource argument
+Pass imports: BufferSource argument
Pass imports: Module argument
-Fail imports with empty module names: BufferSource argument
+Pass imports with empty module names: BufferSource argument
Pass imports with empty module names: Module argument
-Fail imports with empty names: BufferSource argument
+Pass imports with empty names: BufferSource argument
Pass imports with empty names: Module argument
-Fail exports with empty name: function: BufferSource argument
+Pass exports with empty name: function: BufferSource argument
Pass exports with empty name: function: Module argument
-Fail exports with empty name: table: BufferSource argument
+Pass exports with empty name: table: BufferSource argument
Pass exports with empty name: table: Module argument
-Fail exports with empty name: global: BufferSource argument
+Pass exports with empty name: global: BufferSource argument
Pass exports with empty name: global: Module argument
-Fail No imports: BufferSource argument
+Pass No imports: BufferSource argument
Pass No imports: Module argument
-Fail exports and imports: BufferSource argument
+Pass exports and imports: BufferSource argument
Pass exports and imports: Module argument
-Fail i64 exports and imports: BufferSource argument
+Pass i64 exports and imports: BufferSource argument
Pass i64 exports and imports: Module argument
-Fail import with i32-returning function: BufferSource argument
+Pass import with i32-returning function: BufferSource argument
Pass import with i32-returning function: Module argument
-Fail import with function that takes and returns i32: BufferSource argument
+Pass import with function that takes and returns i32: BufferSource argument
Pass import with function that takes and returns i32: Module argument
-Fail import with i64-returning function: BufferSource argument
+Pass import with i64-returning function: BufferSource argument
Pass import with i64-returning function: Module argument
-Fail import with function that takes and returns i64: BufferSource argument
+Pass import with function that takes and returns i64: BufferSource argument
Pass import with function that takes and returns i64: Module argument
-Fail import with i32-taking function: BufferSource argument
+Pass import with i32-taking function: BufferSource argument
Pass import with i32-taking function: Module argument
-Fail import with i64-taking function: BufferSource argument
+Pass import with i64-taking function: BufferSource argument
Pass import with i64-taking function: Module argument
-Fail export i64-returning function: BufferSource argument
+Pass export i64-returning function: BufferSource argument
Pass export i64-returning function: Module argument
-Fail i32 mutable WebAssembly.Global import: BufferSource argument
+Pass i32 mutable WebAssembly.Global import: BufferSource argument
Pass i32 mutable WebAssembly.Global import: Module argument
-Fail i64 mutable WebAssembly.Global import: BufferSource argument
+Pass i64 mutable WebAssembly.Global import: BufferSource argument
Pass i64 mutable WebAssembly.Global import: Module argument
-Fail Multiple i64 arguments: BufferSource argument
+Pass Multiple i64 arguments: BufferSource argument
Pass Multiple i64 arguments: Module argument
-Fail stray argument: BufferSource argument
+Pass stray argument: BufferSource argument
Pass stray argument: Module argument
-Fail Synchronous options handling: Buffer argument
+Pass Synchronous options handling: Buffer argument
Fail Synchronous options handling: Module argument
Pass Empty buffer
Pass Invalid code
-Fail Changing the buffer
\ No newline at end of file
+Pass Changing the buffer
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.txt b/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.txt
index 74e58a56a60..da950943a61 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.txt
@@ -2,29 +2,29 @@ Harness status: OK
Found 25 tests
-25 Fail
-Fail Empty module without imports argument
-Fail Empty module with undefined imports argument
-Fail Empty module with empty imports argument
-Fail getter order for imports object
-Fail imports
-Fail imports with empty module names
-Fail imports with empty names
-Fail exports with empty name: function
-Fail exports with empty name: table
-Fail exports with empty name: global
-Fail No imports
-Fail exports and imports
-Fail i64 exports and imports
-Fail import with i32-returning function
-Fail import with function that takes and returns i32
-Fail import with i64-returning function
-Fail import with function that takes and returns i64
-Fail import with i32-taking function
-Fail import with i64-taking function
-Fail export i64-returning function
-Fail i32 mutable WebAssembly.Global import
-Fail i64 mutable WebAssembly.Global import
-Fail Multiple i64 arguments
-Fail stray argument
-Fail Synchronous options handling
\ No newline at end of file
+25 Pass
+Pass Empty module without imports argument
+Pass Empty module with undefined imports argument
+Pass Empty module with empty imports argument
+Pass getter order for imports object
+Pass imports
+Pass imports with empty module names
+Pass imports with empty names
+Pass exports with empty name: function
+Pass exports with empty name: table
+Pass exports with empty name: global
+Pass No imports
+Pass exports and imports
+Pass i64 exports and imports
+Pass import with i32-returning function
+Pass import with function that takes and returns i32
+Pass import with i64-returning function
+Pass import with function that takes and returns i64
+Pass import with i32-taking function
+Pass import with i64-taking function
+Pass export i64-returning function
+Pass i32 mutable WebAssembly.Global import
+Pass i64 mutable WebAssembly.Global import
+Pass Multiple i64 arguments
+Pass stray argument
+Pass Synchronous options handling
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.worker.txt
index 74e58a56a60..da950943a61 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.worker.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/wasm/webapi/instantiateStreaming.any.worker.txt
@@ -2,29 +2,29 @@ Harness status: OK
Found 25 tests
-25 Fail
-Fail Empty module without imports argument
-Fail Empty module with undefined imports argument
-Fail Empty module with empty imports argument
-Fail getter order for imports object
-Fail imports
-Fail imports with empty module names
-Fail imports with empty names
-Fail exports with empty name: function
-Fail exports with empty name: table
-Fail exports with empty name: global
-Fail No imports
-Fail exports and imports
-Fail i64 exports and imports
-Fail import with i32-returning function
-Fail import with function that takes and returns i32
-Fail import with i64-returning function
-Fail import with function that takes and returns i64
-Fail import with i32-taking function
-Fail import with i64-taking function
-Fail export i64-returning function
-Fail i32 mutable WebAssembly.Global import
-Fail i64 mutable WebAssembly.Global import
-Fail Multiple i64 arguments
-Fail stray argument
-Fail Synchronous options handling
\ No newline at end of file
+25 Pass
+Pass Empty module without imports argument
+Pass Empty module with undefined imports argument
+Pass Empty module with empty imports argument
+Pass getter order for imports object
+Pass imports
+Pass imports with empty module names
+Pass imports with empty names
+Pass exports with empty name: function
+Pass exports with empty name: table
+Pass exports with empty name: global
+Pass No imports
+Pass exports and imports
+Pass i64 exports and imports
+Pass import with i32-returning function
+Pass import with function that takes and returns i32
+Pass import with i64-returning function
+Pass import with function that takes and returns i64
+Pass import with i32-taking function
+Pass import with i64-taking function
+Pass export i64-returning function
+Pass i32 mutable WebAssembly.Global import
+Pass i64 mutable WebAssembly.Global import
+Pass Multiple i64 arguments
+Pass stray argument
+Pass Synchronous options handling
\ No newline at end of file