1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibWeb: Remove unecessary dependence on Window from WebAssembly classes

These classes only needed Window to get at its realm. Pass a realm
directly to construct WebAssembly classes.
This commit is contained in:
Andrew Kaster 2022-09-25 18:05:03 -06:00 committed by Linus Groh
parent 320dddde6a
commit d0efc7734a
8 changed files with 22 additions and 29 deletions

View file

@ -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);
}