diff options
Diffstat (limited to 'Userland/Libraries')
8 files changed, 22 insertions, 29 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp index 6cce454127..0f40dd5429 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp @@ -5,7 +5,7 @@ */ #include <LibJS/Runtime/GlobalObject.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/WebAssembly/WebAssemblyInstanceConstructor.h> #include <LibWeb/WebAssembly/WebAssemblyInstanceObject.h> #include <LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h> @@ -42,10 +42,9 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyInstanceConstructor::construct(Fun void WebAssemblyInstanceConstructor::initialize(JS::Realm& realm) { auto& vm = this->vm(); - auto& window = verify_cast<HTML::Window>(realm.global_object()); NativeFunction::initialize(realm); - define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyInstancePrototype>("WebAssemblyInstancePrototype"), 0); + define_direct_property(vm.names.prototype, &Bindings::ensure_web_prototype<WebAssemblyInstancePrototype>(realm, "WebAssemblyInstancePrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp index 821fe58480..7d937fe963 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp @@ -10,7 +10,7 @@ #include <LibJS/Runtime/BigInt.h> #include <LibJS/Runtime/TypedArray.h> #include <LibWasm/AbstractMachine/Interpreter.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/WebAssembly/WebAssemblyInstanceObject.h> #include <LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h> #include <LibWeb/WebAssembly/WebAssemblyObject.h> @@ -18,7 +18,7 @@ namespace Web::Bindings { WebAssemblyInstanceObject::WebAssemblyInstanceObject(JS::Realm& realm, size_t index) - : Object(static_cast<Web::HTML::Window&>(realm.global_object()).ensure_web_prototype<WebAssemblyInstancePrototype>("WebAssemblyInstancePrototype")) + : Object(Bindings::ensure_web_prototype<WebAssemblyInstancePrototype>(realm, "WebAssemblyInstancePrototype")) , m_index(index) { } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp index 78068af3e4..1cde4c1994 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp @@ -4,8 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <LibJS/Runtime/GlobalObject.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/WebAssembly/WebAssemblyMemoryConstructor.h> #include <LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h> #include <LibWeb/WebAssembly/WebAssemblyObject.h> @@ -53,10 +52,9 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyMemoryConstructor::construct(Funct void WebAssemblyMemoryConstructor::initialize(JS::Realm& realm) { auto& vm = this->vm(); - auto& window = verify_cast<HTML::Window>(realm.global_object()); NativeFunction::initialize(realm); - define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyMemoryPrototype>("WebAssemblyMemoryPrototype"), 0); + define_direct_property(vm.names.prototype, &Bindings::ensure_web_prototype<WebAssemblyMemoryPrototype>(realm, "WebAssemblyMemoryPrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp index 217d22a2ea..17c985ff3c 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp @@ -4,9 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/TypedArray.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/WebAssembly/WebAssemblyModuleConstructor.h> #include <LibWeb/WebAssembly/WebAssemblyModuleObject.h> #include <LibWeb/WebAssembly/WebAssemblyModulePrototype.h> @@ -40,10 +39,9 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyModuleConstructor::construct(Funct void WebAssemblyModuleConstructor::initialize(JS::Realm& realm) { auto& vm = this->vm(); - auto& window = verify_cast<HTML::Window>(realm.global_object()); NativeFunction::initialize(realm); - define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyModulePrototype>("WebAssemblyModulePrototype"), 0); + define_direct_property(vm.names.prototype, &Bindings::ensure_web_prototype<WebAssemblyModulePrototype>(realm, "WebAssemblyModulePrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.cpp index 8613837f0f..1b3f480e8e 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.cpp @@ -10,7 +10,7 @@ namespace Web::Bindings { WebAssemblyModuleObject::WebAssemblyModuleObject(JS::Realm& realm, size_t index) - : Object(verify_cast<HTML::Window>(realm.global_object()).ensure_web_prototype<WebAssemblyModulePrototype>("WebAssemblyModulePrototype")) + : Object(Bindings::ensure_web_prototype<WebAssemblyModulePrototype>(realm, "WebAssemblyModulePrototype")) , m_index(index) { } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index 9a7b78a522..b19f2e104e 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -19,7 +19,7 @@ #include <LibJS/Runtime/TypedArray.h> #include <LibWasm/AbstractMachine/Interpreter.h> #include <LibWasm/AbstractMachine/Validator.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/WebAssembly/WebAssemblyInstanceConstructor.h> #include <LibWeb/WebAssembly/WebAssemblyObject.h> @@ -42,28 +42,27 @@ void WebAssemblyObject::initialize(JS::Realm& realm) auto& vm = this->vm(); - auto& window = verify_cast<HTML::Window>(realm.global_object()); - auto& memory_constructor = window.ensure_web_constructor<WebAssemblyMemoryConstructor>("WebAssembly.Memory"); + auto& memory_constructor = Bindings::ensure_web_constructor<WebAssemblyMemoryConstructor>(realm, "WebAssembly.Memory"); memory_constructor.define_direct_property(vm.names.name, js_string(vm, "WebAssembly.Memory"), JS::Attribute::Configurable); - auto& memory_prototype = window.ensure_web_prototype<WebAssemblyMemoryPrototype>("WebAssemblyMemoryPrototype"); + auto& memory_prototype = Bindings::ensure_web_prototype<WebAssemblyMemoryPrototype>(realm, "WebAssemblyMemoryPrototype"); memory_prototype.define_direct_property(vm.names.constructor, &memory_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); define_direct_property("Memory", &memory_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); - auto& instance_constructor = window.ensure_web_constructor<WebAssemblyInstanceConstructor>("WebAssembly.Instance"); + auto& instance_constructor = Bindings::ensure_web_constructor<WebAssemblyInstanceConstructor>(realm, "WebAssembly.Instance"); instance_constructor.define_direct_property(vm.names.name, js_string(vm, "WebAssembly.Instance"), JS::Attribute::Configurable); - auto& instance_prototype = window.ensure_web_prototype<WebAssemblyInstancePrototype>("WebAssemblyInstancePrototype"); + auto& instance_prototype = Bindings::ensure_web_prototype<WebAssemblyInstancePrototype>(realm, "WebAssemblyInstancePrototype"); instance_prototype.define_direct_property(vm.names.constructor, &instance_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); define_direct_property("Instance", &instance_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); - auto& module_constructor = window.ensure_web_constructor<WebAssemblyModuleConstructor>("WebAssembly.Module"); + auto& module_constructor = Bindings::ensure_web_constructor<WebAssemblyModuleConstructor>(realm, "WebAssembly.Module"); module_constructor.define_direct_property(vm.names.name, js_string(vm, "WebAssembly.Module"), JS::Attribute::Configurable); - auto& module_prototype = window.ensure_web_prototype<WebAssemblyModulePrototype>("WebAssemblyModulePrototype"); + auto& module_prototype = Bindings::ensure_web_prototype<WebAssemblyModulePrototype>(realm, "WebAssemblyModulePrototype"); module_prototype.define_direct_property(vm.names.constructor, &module_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); define_direct_property("Module", &module_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); - auto& table_constructor = window.ensure_web_constructor<WebAssemblyTableConstructor>("WebAssembly.Table"); + auto& table_constructor = Bindings::ensure_web_constructor<WebAssemblyTableConstructor>(realm, "WebAssembly.Table"); table_constructor.define_direct_property(vm.names.name, js_string(vm, "WebAssembly.Table"), JS::Attribute::Configurable); - auto& table_prototype = window.ensure_web_prototype<WebAssemblyTablePrototype>("WebAssemblyTablePrototype"); + auto& table_prototype = Bindings::ensure_web_prototype<WebAssemblyTablePrototype>(realm, "WebAssemblyTablePrototype"); table_prototype.define_direct_property(vm.names.constructor, &table_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); define_direct_property("Table", &table_constructor, JS::Attribute::Writable | JS::Attribute::Configurable); } @@ -482,7 +481,7 @@ JS::NativeFunction* create_native_function(JS::VM& vm, Wasm::FunctionAddress add } WebAssemblyMemoryObject::WebAssemblyMemoryObject(JS::Realm& realm, Wasm::MemoryAddress address) - : Object(verify_cast<HTML::Window>(realm.global_object()).ensure_web_prototype<WebAssemblyMemoryPrototype>("WebAssemblyMemoryPrototype")) + : Object(Bindings::ensure_web_prototype<WebAssemblyMemoryPrototype>(realm, "WebAssemblyMemoryPrototype")) , m_address(address) { } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp index e581ed01da..6b7076fbad 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp @@ -6,7 +6,7 @@ #include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/TypedArray.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Bindings/Intrinsics.h> #include <LibWeb/WebAssembly/WebAssemblyObject.h> #include <LibWeb/WebAssembly/WebAssemblyTableConstructor.h> #include <LibWeb/WebAssembly/WebAssemblyTableObject.h> @@ -83,10 +83,9 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi void WebAssemblyTableConstructor::initialize(JS::Realm& realm) { auto& vm = this->vm(); - auto& window = verify_cast<HTML::Window>(realm.global_object()); NativeFunction::initialize(realm); - define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyTablePrototype>("WebAssemblyTablePrototype"), 0); + define_direct_property(vm.names.prototype, &Bindings::ensure_web_prototype<WebAssemblyTablePrototype>(realm, "WebAssemblyTablePrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableObject.cpp index 030eed5b8d..f2c7326de9 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableObject.cpp @@ -10,7 +10,7 @@ namespace Web::Bindings { WebAssemblyTableObject::WebAssemblyTableObject(JS::Realm& realm, Wasm::TableAddress address) - : Object(verify_cast<HTML::Window>(realm.global_object()).ensure_web_prototype<WebAssemblyTablePrototype>("WebAssemblyTablePrototype")) + : Object(Bindings::ensure_web_prototype<WebAssemblyTablePrototype>(realm, "WebAssemblyTablePrototype")) , m_address(address) { } |