mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
LibJS+LibWeb: Replace GlobalObject with Realm in initialize() functions
This is a continuation of the previous commit. Calling initialize() is the first thing that's done after allocating a cell on the JS heap - and in the common case of allocating an object, that's where properties are assigned and intrinsics occasionally accessed. Since those are supposed to live on the realm eventually, this is another step into that direction.
This commit is contained in:
parent
ecd163bdf1
commit
5dd5896588
304 changed files with 608 additions and 603 deletions
|
@ -19,11 +19,11 @@ AudioConstructor::AudioConstructor(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void AudioConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void AudioConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
NativeFunction::initialize(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<HTMLAudioElementPrototype>("HTMLAudioElement"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Bindings {
|
|||
class AudioConstructor final : public JS::NativeFunction {
|
||||
public:
|
||||
explicit AudioConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~AudioConstructor() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -18,9 +18,9 @@ CSSNamespace::CSSNamespace(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void CSSNamespace::initialize(JS::GlobalObject& global_object)
|
||||
void CSSNamespace::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = JS::Attribute::Enumerable;
|
||||
define_native_function("escape", escape, 1, attr);
|
||||
define_native_function("supports", supports, 2, attr);
|
||||
|
|
|
@ -17,7 +17,7 @@ class CSSNamespace final : public JS::Object {
|
|||
|
||||
public:
|
||||
explicit CSSNamespace(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~CSSNamespace() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -19,11 +19,11 @@ ImageConstructor::ImageConstructor(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void ImageConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void ImageConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
NativeFunction::initialize(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<HTMLImageElementPrototype>("HTMLImageElement"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Bindings {
|
|||
class ImageConstructor final : public JS::NativeFunction {
|
||||
public:
|
||||
explicit ImageConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~ImageConstructor() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -28,12 +28,12 @@ JS::ThrowCompletionOr<JS::Object*> LocationConstructor::construct(FunctionObject
|
|||
return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::NotAConstructor, "Location");
|
||||
}
|
||||
|
||||
void LocationConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void LocationConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<LocationPrototype>("Location"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class LocationConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit LocationConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~LocationConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -29,11 +29,11 @@ LocationObject::LocationObject(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void LocationObject::initialize(JS::GlobalObject& global_object)
|
||||
void LocationObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
auto& vm = this->vm();
|
||||
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable;
|
||||
define_native_accessor("href", href_getter, href_setter, attr);
|
||||
define_native_accessor("host", host_getter, {}, attr);
|
||||
|
|
|
@ -22,7 +22,7 @@ class LocationObject final : public JS::Object {
|
|||
|
||||
public:
|
||||
explicit LocationObject(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~LocationObject() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override;
|
||||
|
|
|
@ -28,12 +28,12 @@ JS::ThrowCompletionOr<JS::Object*> NavigatorConstructor::construct(FunctionObjec
|
|||
return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::NotAConstructor, "Navigator");
|
||||
}
|
||||
|
||||
void NavigatorConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void NavigatorConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<NavigatorPrototype>("Navigator"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class NavigatorConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit NavigatorConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~NavigatorConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -18,10 +18,10 @@ NavigatorObject::NavigatorObject(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void NavigatorObject::initialize(JS::GlobalObject& global_object)
|
||||
void NavigatorObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& heap = this->heap();
|
||||
auto* languages = MUST(JS::Array::create(global_object, 0));
|
||||
auto* languages = MUST(JS::Array::create(realm.global_object(), 0));
|
||||
languages->indexed_properties().append(js_string(heap, "en-US"));
|
||||
|
||||
// FIXME: All of these should be in Navigator's prototype and be native accessors
|
||||
|
|
|
@ -17,7 +17,7 @@ class NavigatorObject final : public JS::Object {
|
|||
|
||||
public:
|
||||
NavigatorObject(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~NavigatorObject() override = default;
|
||||
|
||||
private:
|
||||
|
|
|
@ -20,11 +20,11 @@ OptionConstructor::OptionConstructor(JS::Realm& realm)
|
|||
{
|
||||
}
|
||||
|
||||
void OptionConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void OptionConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
NativeFunction::initialize(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
NativeFunction::initialize(realm);
|
||||
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<HTMLOptionElementPrototype>("HTMLOptionElement"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Web::Bindings {
|
|||
class OptionConstructor final : public JS::NativeFunction {
|
||||
public:
|
||||
explicit OptionConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~OptionConstructor() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -28,12 +28,12 @@ JS::ThrowCompletionOr<JS::Object*> WindowConstructor::construct(FunctionObject&)
|
|||
return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::NotAConstructor, "Window");
|
||||
}
|
||||
|
||||
void WindowConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void WindowConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WindowPrototype>("Window"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class WindowConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit WindowConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WindowConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -40,12 +40,12 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyInstanceConstructor::construct(Fun
|
|||
return heap().allocate<WebAssemblyInstanceObject>(global_object, realm, result);
|
||||
}
|
||||
|
||||
void WebAssemblyInstanceConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyInstanceConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyInstancePrototype>("WebAssemblyInstancePrototype"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class WebAssemblyInstanceConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit WebAssemblyInstanceConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WebAssemblyInstanceConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -23,14 +23,12 @@ WebAssemblyInstanceObject::WebAssemblyInstanceObject(JS::Realm& realm, size_t in
|
|||
{
|
||||
}
|
||||
|
||||
void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyInstanceObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
|
||||
auto& realm = *global_object.associated_realm();
|
||||
Object::initialize(realm);
|
||||
|
||||
VERIFY(!m_exports_object);
|
||||
m_exports_object = create(global_object, nullptr);
|
||||
m_exports_object = create(realm.global_object(), nullptr);
|
||||
auto& instance = this->instance();
|
||||
auto& cache = this->cache();
|
||||
for (auto& export_ : instance.exports()) {
|
||||
|
@ -38,7 +36,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
|||
[&](Wasm::FunctionAddress const& address) {
|
||||
Optional<JS::FunctionObject*> object = cache.function_instances.get(address);
|
||||
if (!object.has_value()) {
|
||||
object = create_native_function(global_object, address, export_.name());
|
||||
object = create_native_function(realm.global_object(), address, export_.name());
|
||||
cache.function_instances.set(address, *object);
|
||||
}
|
||||
m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes);
|
||||
|
@ -46,7 +44,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
|||
[&](Wasm::MemoryAddress const& address) {
|
||||
Optional<WebAssemblyMemoryObject*> object = cache.memory_instances.get(address);
|
||||
if (!object.has_value()) {
|
||||
object = heap().allocate<Web::Bindings::WebAssemblyMemoryObject>(global_object, realm, address);
|
||||
object = heap().allocate<Web::Bindings::WebAssemblyMemoryObject>(realm.global_object(), realm, address);
|
||||
cache.memory_instances.set(address, *object);
|
||||
}
|
||||
m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes);
|
||||
|
|
|
@ -20,7 +20,7 @@ class WebAssemblyInstanceObject final : public JS::Object {
|
|||
|
||||
public:
|
||||
explicit WebAssemblyInstanceObject(JS::Realm&, size_t index);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WebAssemblyInstanceObject() override = default;
|
||||
|
||||
size_t index() const { return m_index; }
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Web::Bindings {
|
||||
|
||||
void WebAssemblyInstancePrototype::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyInstancePrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
define_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(exports_getter);
|
||||
|
|
|
@ -54,12 +54,12 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyMemoryConstructor::construct(Funct
|
|||
return vm.heap().allocate<WebAssemblyMemoryObject>(global_object, realm, *address);
|
||||
}
|
||||
|
||||
void WebAssemblyMemoryConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyMemoryConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyMemoryPrototype>("WebAssemblyMemoryPrototype"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class WebAssemblyMemoryConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit WebAssemblyMemoryConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WebAssemblyMemoryConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Web::Bindings {
|
||||
|
||||
void WebAssemblyMemoryPrototype::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyMemoryPrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
define_native_accessor("buffer", buffer_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(grow);
|
||||
|
|
|
@ -38,12 +38,12 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyModuleConstructor::construct(Funct
|
|||
return heap().allocate<WebAssemblyModuleObject>(global_object, realm, result);
|
||||
}
|
||||
|
||||
void WebAssemblyModuleConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyModuleConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyModulePrototype>("WebAssemblyModulePrototype"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class WebAssemblyModuleConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit WebAssemblyModuleConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WebAssemblyModuleConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -31,18 +31,18 @@ WebAssemblyObject::WebAssemblyObject(JS::Realm& realm)
|
|||
s_abstract_machine.enable_instruction_count_limit();
|
||||
}
|
||||
|
||||
void WebAssemblyObject::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
|
||||
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
|
||||
define_native_function("validate", validate, 1, attr);
|
||||
define_native_function("compile", compile, 1, attr);
|
||||
define_native_function("instantiate", instantiate, 1, attr);
|
||||
|
||||
auto& vm = global_object.vm();
|
||||
auto& vm = this->vm();
|
||||
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
auto& memory_constructor = window.ensure_web_constructor<WebAssemblyMemoryConstructor>("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");
|
||||
|
|
|
@ -24,7 +24,7 @@ class WebAssemblyObject final : public JS::Object {
|
|||
|
||||
public:
|
||||
explicit WebAssemblyObject(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WebAssemblyObject() override = default;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
|
|
@ -81,12 +81,12 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
|
|||
return vm.heap().allocate<WebAssemblyTableObject>(global_object, realm, *address);
|
||||
}
|
||||
|
||||
void WebAssemblyTableConstructor::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyTableConstructor::initialize(JS::Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& window = static_cast<WindowObject&>(global_object);
|
||||
auto& window = static_cast<WindowObject&>(realm.global_object());
|
||||
|
||||
NativeFunction::initialize(global_object);
|
||||
NativeFunction::initialize(realm);
|
||||
define_direct_property(vm.names.prototype, &window.ensure_web_prototype<WebAssemblyTablePrototype>("WebAssemblyTablePrototype"), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class WebAssemblyTableConstructor : public JS::NativeFunction {
|
|||
|
||||
public:
|
||||
explicit WebAssemblyTableConstructor(JS::Realm&);
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual ~WebAssemblyTableConstructor() override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> call() override;
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Web::Bindings {
|
||||
|
||||
void WebAssemblyTablePrototype::initialize(JS::GlobalObject& global_object)
|
||||
void WebAssemblyTablePrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
Object::initialize(realm);
|
||||
define_native_accessor("length", length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("get", get, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void initialize(JS::GlobalObject& global_object) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(grow);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue