diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp index 59a9843dcc..27853e305d 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp @@ -1838,7 +1838,7 @@ public: static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&); @wrapper_class@(JS::Realm&, @fully_qualified_name@&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~@wrapper_class@() override; )~~~"); @@ -2029,11 +2029,11 @@ namespace Web::Bindings { } generator.append(R"~~~( -void @wrapper_class@::initialize(JS::GlobalObject& global_object) +void @wrapper_class@::initialize(JS::Realm& realm) { - @wrapper_base_class@::initialize(global_object); + @wrapper_base_class@::initialize(realm); - auto& vm = global_object.vm(); + auto& vm = this->vm(); define_direct_property(*vm.well_known_symbol_to_string_tag(), JS::js_string(vm, "@name@"), JS::Attribute::Configurable); } @@ -2800,7 +2800,7 @@ class @constructor_class@ : public JS::NativeFunction { JS_OBJECT(@constructor_class@, JS::NativeFunction); public: explicit @constructor_class@(JS::Realm&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~@constructor_class@() override; virtual JS::ThrowCompletionOr call() override; @@ -2991,13 +2991,13 @@ JS::ThrowCompletionOr @constructor_class@::construct(FunctionObject generator.append(R"~~~( } -void @constructor_class@::initialize(JS::GlobalObject& global_object) +void @constructor_class@::initialize(JS::Realm& realm) { auto& vm = this->vm(); - auto& window = static_cast(global_object); + auto& window = static_cast(realm.global_object()); [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable; - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype<@prototype_class@>("@name@"), 0); define_direct_property(vm.names.length, JS::Value(@constructor.length@), JS::Attribute::Configurable); @@ -3067,7 +3067,7 @@ class @prototype_class@ : public JS::Object { JS_OBJECT(@prototype_class@, JS::Object); public: explicit @prototype_class@(JS::Realm&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~@prototype_class@() override; private: )~~~"); @@ -3238,7 +3238,7 @@ namespace Web::Bindings { { } -void @prototype_class@::initialize(JS::GlobalObject& global_object) +void @prototype_class@::initialize(JS::Realm& realm) { [[maybe_unused]] auto& vm = this->vm(); [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable | JS::Attribute::Configurable | JS::Attribute::Writable; @@ -3247,7 +3247,7 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object) if (interface.has_unscopable_member) { generator.append(R"~~~( - auto* unscopable_object = JS::Object::create(global_object, nullptr); + auto* unscopable_object = JS::Object::create(realm.global_object(), nullptr); )~~~"); } @@ -3320,15 +3320,15 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object) if (interface.indexed_property_getter.has_value()) { auto iterator_generator = generator.fork(); iterator_generator.append(R"~~~( - define_direct_property(*vm.well_known_symbol_iterator(), global_object.array_prototype()->get_without_side_effects(vm.names.values), JS::Attribute::Configurable | JS::Attribute::Writable); + define_direct_property(*vm.well_known_symbol_iterator(), realm.global_object().array_prototype()->get_without_side_effects(vm.names.values), JS::Attribute::Configurable | JS::Attribute::Writable); )~~~"); if (interface.value_iterator_type.has_value()) { iterator_generator.append(R"~~~( - define_direct_property(vm.names.entries, global_object.array_prototype()->get_without_side_effects(vm.names.entries), default_attributes); - define_direct_property(vm.names.keys, global_object.array_prototype()->get_without_side_effects(vm.names.keys), default_attributes); - define_direct_property(vm.names.values, global_object.array_prototype()->get_without_side_effects(vm.names.values), default_attributes); - define_direct_property(vm.names.forEach, global_object.array_prototype()->get_without_side_effects(vm.names.forEach), default_attributes); + define_direct_property(vm.names.entries, realm.global_object().array_prototype()->get_without_side_effects(vm.names.entries), default_attributes); + define_direct_property(vm.names.keys, realm.global_object().array_prototype()->get_without_side_effects(vm.names.keys), default_attributes); + define_direct_property(vm.names.values, realm.global_object().array_prototype()->get_without_side_effects(vm.names.values), default_attributes); + define_direct_property(vm.names.forEach, realm.global_object().array_prototype()->get_without_side_effects(vm.names.forEach), default_attributes); )~~~"); } } @@ -3354,7 +3354,7 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object) } generator.append(R"~~~( - Object::initialize(global_object); + Object::initialize(realm); } )~~~"); @@ -3589,7 +3589,7 @@ public: static @wrapper_class@* create(JS::GlobalObject&, @fully_qualified_name@&); @wrapper_class@(JS::Realm&, @fully_qualified_name@&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~@wrapper_class@() override; @fully_qualified_name@& impl() { return *m_impl; } @@ -3670,9 +3670,9 @@ namespace Web::Bindings { { } -void @wrapper_class@::initialize(JS::GlobalObject& global_object) +void @wrapper_class@::initialize(JS::Realm& realm) { - Wrapper::initialize(global_object); + Wrapper::initialize(realm); } @wrapper_class@::~@wrapper_class@() @@ -3715,7 +3715,7 @@ class @prototype_class@ : public JS::Object { JS_OBJECT(@prototype_class@, JS::Object); public: explicit @prototype_class@(JS::Realm&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~@prototype_class@() override; private: @@ -3787,10 +3787,10 @@ namespace Web::Bindings { { } -void @prototype_class@::initialize(JS::GlobalObject& global_object) +void @prototype_class@::initialize(JS::Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_native_function(vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable); define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Iterator"), JS::Attribute::Configurable); diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index 2e7254abac..243831d5b0 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/Tests/LibWasm/test-wasm.cpp @@ -63,7 +63,7 @@ public: instance->m_module_instance = result.release_value(); return instance; } - void initialize(JS::GlobalObject&) override; + void initialize(JS::Realm&) override; ~WebAssemblyModule() override = default; @@ -148,9 +148,9 @@ TESTJS_GLOBAL_FUNCTION(compare_typed_arrays, compareTypedArrays) return JS::Value(lhs_array.viewed_array_buffer()->buffer() == rhs_array.viewed_array_buffer()->buffer()); } -void WebAssemblyModule::initialize(JS::GlobalObject& global_object) +void WebAssemblyModule::initialize(JS::Realm& realm) { - Base::initialize(global_object); + Base::initialize(realm); define_native_function("getExport", get_export, 1, JS::default_attributes); define_native_function("invoke", wasm_invoke, 1, JS::default_attributes); } diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp index 95b924ec32..1ab581712c 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.cpp +++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp @@ -371,9 +371,9 @@ WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook) { } -void WorkbookObject::initialize(JS::GlobalObject& global_object) +void WorkbookObject::initialize(JS::Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); define_native_function("sheet", sheet, 1, JS::default_attributes); } diff --git a/Userland/Applications/Spreadsheet/JSIntegration.h b/Userland/Applications/Spreadsheet/JSIntegration.h index 78433d0f5b..ecd1d32d5e 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.h +++ b/Userland/Applications/Spreadsheet/JSIntegration.h @@ -54,7 +54,7 @@ public: virtual ~WorkbookObject() override = default; - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; JS_DECLARE_NATIVE_FUNCTION(sheet); diff --git a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp index ef3fdc30e0..2bcd3a9019 100644 --- a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp +++ b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp @@ -23,13 +23,12 @@ $262Object::$262Object(Realm& realm) { } -void $262Object::initialize(JS::GlobalObject& global_object) +void $262Object::initialize(JS::Realm& realm) { - Base::initialize(global_object); + Base::initialize(realm); - auto& realm = *global_object.associated_realm(); - m_agent = vm().heap().allocate(global_object, realm); - m_is_htmldda = vm().heap().allocate(global_object, realm); + m_agent = vm().heap().allocate(realm.global_object(), realm); + m_is_htmldda = vm().heap().allocate(realm.global_object(), realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("clearKeptObjects", clear_kept_objects, 0, attr); @@ -38,8 +37,8 @@ void $262Object::initialize(JS::GlobalObject& global_object) define_native_function("evalScript", eval_script, 1, attr); define_direct_property("agent", m_agent, attr); - define_direct_property("gc", global_object.get_without_side_effects("gc"), attr); - define_direct_property("global", &global_object, attr); + define_direct_property("gc", realm.global_object().get_without_side_effects("gc"), attr); + define_direct_property("global", &realm.global_object(), attr); define_direct_property("IsHTMLDDA", m_is_htmldda, attr); } diff --git a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.h b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.h index 79445dee1c..aa586f58dc 100644 --- a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.h +++ b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.h @@ -18,7 +18,7 @@ class $262Object final : public Object { public: explicit $262Object(Realm&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~$262Object() override = default; private: diff --git a/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.cpp b/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.cpp index fbc8ef4b14..bc0643cff0 100644 --- a/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.cpp +++ b/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.cpp @@ -17,9 +17,9 @@ AgentObject::AgentObject(Realm& realm) { } -void AgentObject::initialize(JS::GlobalObject& global_object) +void AgentObject::initialize(JS::Realm& realm) { - Base::initialize(global_object); + Base::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function("monotonicNow", monotonic_now, 0, attr); diff --git a/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.h b/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.h index eeed225a89..262d939994 100644 --- a/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.h +++ b/Userland/Libraries/LibJS/Contrib/Test262/AgentObject.h @@ -16,7 +16,7 @@ class AgentObject final : public Object { public: explicit AgentObject(Realm&); - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; virtual ~AgentObject() override = default; private: diff --git a/Userland/Libraries/LibJS/Heap/Cell.h b/Userland/Libraries/LibJS/Heap/Cell.h index b03f0dd960..b467af79be 100644 --- a/Userland/Libraries/LibJS/Heap/Cell.h +++ b/Userland/Libraries/LibJS/Heap/Cell.h @@ -19,7 +19,7 @@ class Cell { AK_MAKE_NONMOVABLE(Cell); public: - virtual void initialize(GlobalObject&) { } + virtual void initialize(Realm&) { } virtual ~Cell() = default; bool is_marked() const { return m_mark; } diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index 1fef87d439..53bcc1de4b 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -349,4 +349,11 @@ void Heap::uproot_cell(Cell* cell) m_uprooted_cells.append(cell); } +// Temporary helper function as we can't pass a realm directly until Heap::allocate() receives one. +// Heap.h only has a forward declaration of the GlobalObject, so no inlined member access possible. +Realm& realm_from_global_object(GlobalObject& global_object) +{ + return *global_object.associated_realm(); +} + } diff --git a/Userland/Libraries/LibJS/Heap/Heap.h b/Userland/Libraries/LibJS/Heap/Heap.h index 752a2a97d8..110109860c 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.h +++ b/Userland/Libraries/LibJS/Heap/Heap.h @@ -25,6 +25,8 @@ namespace JS { +Realm& realm_from_global_object(GlobalObject&); + class Heap { AK_MAKE_NONCOPYABLE(Heap); AK_MAKE_NONMOVABLE(Heap); @@ -47,7 +49,8 @@ public: auto* memory = allocate_cell(sizeof(T)); new (memory) T(forward(args)...); auto* cell = static_cast(memory); - cell->initialize(global_object); + auto& realm = realm_from_global_object(global_object); + memory->initialize(realm); return cell; } diff --git a/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.cpp index 8562f99df7..58a055b9fc 100644 --- a/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.cpp @@ -19,13 +19,13 @@ AggregateErrorConstructor::AggregateErrorConstructor(Realm& realm) { } -void AggregateErrorConstructor::initialize(GlobalObject& global_object) +void AggregateErrorConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 20.5.7.2.1 AggregateError.prototype, https://tc39.es/ecma262/#sec-aggregate-error.prototype - define_direct_property(vm.names.prototype, global_object.aggregate_error_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().aggregate_error_prototype(), 0); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.h b/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.h index 42ddad0121..c2d6a7c2a4 100644 --- a/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.h @@ -15,7 +15,7 @@ class AggregateErrorConstructor final : public NativeFunction { public: explicit AggregateErrorConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AggregateErrorConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.cpp index 33e09e4c81..797b6a1cab 100644 --- a/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.cpp @@ -15,10 +15,10 @@ AggregateErrorPrototype::AggregateErrorPrototype(Realm& realm) { } -void AggregateErrorPrototype::initialize(GlobalObject& global_object) +void AggregateErrorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_direct_property(vm.names.name, js_string(vm, "AggregateError"), attr); define_direct_property(vm.names.message, js_string(vm, ""), attr); diff --git a/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.h b/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.h index a2f4d56b9b..b1aae1b60d 100644 --- a/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.h @@ -15,7 +15,7 @@ class AggregateErrorPrototype final : public Object { public: explicit AggregateErrorPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AggregateErrorPrototype() override = default; }; diff --git a/Userland/Libraries/LibJS/Runtime/ArgumentsObject.cpp b/Userland/Libraries/LibJS/Runtime/ArgumentsObject.cpp index ddbbdaa778..84956b5fc0 100644 --- a/Userland/Libraries/LibJS/Runtime/ArgumentsObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArgumentsObject.cpp @@ -16,11 +16,11 @@ ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment) { } -void ArgumentsObject::initialize(GlobalObject& global_object) +void ArgumentsObject::initialize(Realm& realm) { - Base::initialize(global_object); + Base::initialize(realm); set_has_parameter_map(); - m_parameter_map = Object::create(global_object, nullptr); + m_parameter_map = Object::create(realm.global_object(), nullptr); } void ArgumentsObject::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibJS/Runtime/ArgumentsObject.h b/Userland/Libraries/LibJS/Runtime/ArgumentsObject.h index 895592325e..ce23d81e92 100644 --- a/Userland/Libraries/LibJS/Runtime/ArgumentsObject.h +++ b/Userland/Libraries/LibJS/Runtime/ArgumentsObject.h @@ -18,7 +18,7 @@ class ArgumentsObject final : public Object { public: ArgumentsObject(Realm&, Environment&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ArgumentsObject() override = default; Environment& environment() { return m_environment; } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp index a4e1ead4a2..1930545e2f 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp @@ -18,13 +18,13 @@ ArrayBufferConstructor::ArrayBufferConstructor(Realm& realm) { } -void ArrayBufferConstructor::initialize(GlobalObject& global_object) +void ArrayBufferConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 25.1.4.2 ArrayBuffer.prototype, https://tc39.es/ecma262/#sec-arraybuffer.prototype - define_direct_property(vm.names.prototype, global_object.array_buffer_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().array_buffer_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.isView, is_view, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.h b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.h index 3803030412..3d5d2b5f1d 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.h @@ -15,7 +15,7 @@ class ArrayBufferConstructor final : public NativeFunction { public: explicit ArrayBufferConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ArrayBufferConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index bdd0425965..0b220ad81c 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -19,10 +19,10 @@ ArrayBufferPrototype::ArrayBufferPrototype(Realm& realm) { } -void ArrayBufferPrototype::initialize(GlobalObject& global_object) +void ArrayBufferPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.slice, slice, 2, attr); define_native_accessor(vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.h b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.h index d2515d6c7e..62b0e2b5b2 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.h @@ -16,7 +16,7 @@ class ArrayBufferPrototype final : public PrototypeObjectvm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 23.1.2.4 Array.prototype, https://tc39.es/ecma262/#sec-array.prototype - define_direct_property(vm.names.prototype, global_object.array_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().array_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.h b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.h index 57c0017779..24021c6c19 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.h @@ -15,7 +15,7 @@ class ArrayConstructor final : public NativeFunction { public: explicit ArrayConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ArrayConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index 6ed18d71b4..aaa3e8b97e 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -19,15 +19,15 @@ ArrayIteratorPrototype::ArrayIteratorPrototype(Realm& realm) { } -void ArrayIteratorPrototype::initialize(GlobalObject& global_object) +void ArrayIteratorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 23.1.5.2.2 %ArrayIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%arrayiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Array Iterator"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Array Iterator"), Attribute::Configurable); } // 23.1.5.2.1 %ArrayIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h index b17d106470..ad48f8e372 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h @@ -16,7 +16,7 @@ class ArrayIteratorPrototype final : public PrototypeObjectvm(); - Array::initialize(global_object); + Array::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.at, at, 1, attr); @@ -89,7 +89,7 @@ void ArrayPrototype::initialize(GlobalObject& global_object) // 23.1.3.37 Array.prototype [ @@unscopables ], https://tc39.es/ecma262/#sec-array.prototype-@@unscopables // With array grouping proposal, https://tc39.es/proposal-array-grouping/#sec-array.prototype-@@unscopables // With change array by copy proposal, https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype-@@unscopables - auto* unscopable_list = Object::create(global_object, nullptr); + auto* unscopable_list = Object::create(realm.global_object(), nullptr); MUST(unscopable_list->create_data_property_or_throw(vm.names.at, Value(true))); MUST(unscopable_list->create_data_property_or_throw(vm.names.copyWithin, Value(true))); MUST(unscopable_list->create_data_property_or_throw(vm.names.entries, Value(true))); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.h b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.h index d631861069..c87140ea8c 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.h @@ -16,7 +16,7 @@ class ArrayPrototype final : public Array { public: ArrayPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ArrayPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp index 2e8793350b..0925f31577 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp @@ -23,9 +23,9 @@ AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterato { } -void AsyncFromSyncIterator::initialize(GlobalObject& global_object) +void AsyncFromSyncIterator::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); } void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h index 66e361c9d2..8ce4d06043 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h @@ -20,7 +20,7 @@ public: static AsyncFromSyncIterator* create(GlobalObject&, Iterator sync_iterator_record); explicit AsyncFromSyncIterator(Realm&, Iterator sync_iterator_record); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AsyncFromSyncIterator() override = default; void visit_edges(Visitor& visitor) override; diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index fff5f98f80..31d8c63756 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp @@ -19,10 +19,10 @@ AsyncFromSyncIteratorPrototype::AsyncFromSyncIteratorPrototype(Realm& realm) { } -void AsyncFromSyncIteratorPrototype::initialize(GlobalObject& global_object) +void AsyncFromSyncIteratorPrototype::initialize(Realm& realm) { - auto& vm = global_object.vm(); - Object::initialize(global_object); + auto& vm = this->vm(); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.next, next, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.h index f91fcaf5b7..098aa9cd79 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.h @@ -20,7 +20,7 @@ class AsyncFromSyncIteratorPrototype final : public PrototypeObjectvm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 27.7.2.2 AsyncFunction.prototype, https://tc39.es/ecma262/#sec-async-function-constructor-prototype - define_direct_property(vm.names.prototype, global_object.async_function_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().async_function_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.h b/Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.h index 4d42d1da34..1cc9865eb5 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.h @@ -16,7 +16,7 @@ class AsyncFunctionConstructor final : public NativeFunction { public: explicit AsyncFunctionConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AsyncFunctionConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp index 09cb59e1a0..4eb27b1e68 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.cpp @@ -14,10 +14,10 @@ AsyncFunctionPrototype::AsyncFunctionPrototype(Realm& realm) { } -void AsyncFunctionPrototype::initialize(GlobalObject& global_object) +void AsyncFunctionPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); // 27.7.3.2 AsyncFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-async-function-prototype-properties-toStringTag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.AsyncFunction.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.h b/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.h index b0a3df4701..04f731dbbc 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.h @@ -15,7 +15,7 @@ class AsyncFunctionPrototype final : public Object { public: explicit AsyncFunctionPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AsyncFunctionPrototype() override = default; }; diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.cpp b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.cpp index 0341bd3313..e3e49e2dd6 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.cpp @@ -17,16 +17,16 @@ AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(Realm& real { } -void AsyncGeneratorFunctionConstructor::initialize(GlobalObject& global_object) +void AsyncGeneratorFunctionConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 27.4.2.1 AsyncGeneratorFunction.length, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-length define_direct_property(vm.names.length, Value(1), Attribute::Configurable); // 27.4.2.2 AsyncGeneratorFunction.prototype, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype - define_direct_property(vm.names.prototype, global_object.async_generator_function_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().async_generator_function_prototype(), 0); } // 27.4.1.1 AsyncGeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-asyncgeneratorfunction diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.h b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.h index 6434aaf9f5..d59fcbb089 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.h @@ -15,7 +15,7 @@ class AsyncGeneratorFunctionConstructor final : public NativeFunction { public: explicit AsyncGeneratorFunctionConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AsyncGeneratorFunctionConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp index 14096ab6f0..7fc40459b6 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.cpp @@ -16,15 +16,15 @@ AsyncGeneratorFunctionPrototype::AsyncGeneratorFunctionPrototype(Realm& realm) { } -void AsyncGeneratorFunctionPrototype::initialize(GlobalObject& global_object) +void AsyncGeneratorFunctionPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); // The constructor cannot be set at this point since it has not been initialized. // 27.4.3.2 AsyncGeneratorFunction.prototype.prototype, https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype-prototype - define_direct_property(vm.names.prototype, global_object.async_generator_prototype(), Attribute::Configurable); + define_direct_property(vm.names.prototype, realm.global_object().async_generator_prototype(), Attribute::Configurable); // 27.4.3.3 AsyncGeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-asyncgeneratorfunction-prototype-tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.AsyncGeneratorFunction.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.h b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.h index 78ee0e2982..558f53cbbd 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.h @@ -15,7 +15,7 @@ class AsyncGeneratorFunctionPrototype final : public PrototypeObjectvm(); - Object::initialize(global_object); + Object::initialize(realm); // 27.6.1.5 AsyncGenerator.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-asyncgenerator-prototype-tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "AsyncGenerator"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.h b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.h index 39a9ac8300..24026c3962 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.h @@ -16,7 +16,7 @@ class AsyncGeneratorPrototype final : public PrototypeObjectvm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(*vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr); } diff --git a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h index 8ebe1bf17a..16d545acad 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h @@ -15,7 +15,7 @@ class AsyncIteratorPrototype final : public Object { public: explicit AsyncIteratorPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AsyncIteratorPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp b/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp index 3099892efb..3b0d17f2d1 100644 --- a/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp @@ -134,9 +134,9 @@ AtomicsObject::AtomicsObject(Realm& realm) { } -void AtomicsObject::initialize(GlobalObject& global_object) +void AtomicsObject::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; @@ -152,7 +152,7 @@ void AtomicsObject::initialize(GlobalObject& global_object) define_native_function(vm.names.xor_, xor_, 3, attr); // 25.4.15 Atomics [ @@toStringTag ], https://tc39.es/ecma262/#sec-atomics-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Atomics"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Atomics"), Attribute::Configurable); } // 25.4.3 Atomics.add ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.add diff --git a/Userland/Libraries/LibJS/Runtime/AtomicsObject.h b/Userland/Libraries/LibJS/Runtime/AtomicsObject.h index 8fb1df29e3..8beb801ec8 100644 --- a/Userland/Libraries/LibJS/Runtime/AtomicsObject.h +++ b/Userland/Libraries/LibJS/Runtime/AtomicsObject.h @@ -15,7 +15,7 @@ class AtomicsObject : public Object { public: explicit AtomicsObject(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~AtomicsObject() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp index 7a07eda17d..815a07e77c 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -22,13 +22,13 @@ BigIntConstructor::BigIntConstructor(Realm& realm) { } -void BigIntConstructor::initialize(GlobalObject& global_object) +void BigIntConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 21.2.2.3 BigInt.prototype, https://tc39.es/ecma262/#sec-bigint.prototype - define_direct_property(vm.names.prototype, global_object.bigint_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().bigint_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.asIntN, as_int_n, 2, attr); diff --git a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.h b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.h index fc81ada21e..62452b084b 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.h @@ -15,7 +15,7 @@ class BigIntConstructor final : public NativeFunction { public: explicit BigIntConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~BigIntConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp index 5c0ffd8689..8e3b97ea12 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp @@ -22,17 +22,17 @@ BigIntPrototype::BigIntPrototype(Realm& realm) { } -void BigIntPrototype::initialize(GlobalObject& global_object) +void BigIntPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.toString, to_string, 0, attr); define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); define_native_function(vm.names.valueOf, value_of, 0, attr); // 21.2.3.5 BigInt.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-bigint.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.BigInt.as_string()), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.BigInt.as_string()), Attribute::Configurable); } // thisBigIntValue ( value ), https://tc39.es/ecma262/#thisbigintvalue diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.h b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.h index 62f171da56..d1e3b59a5e 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.h @@ -15,7 +15,7 @@ class BigIntPrototype final : public Object { public: explicit BigIntPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~BigIntPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp b/Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp index 90a56f184c..a930aa06bf 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp @@ -16,13 +16,13 @@ BooleanConstructor::BooleanConstructor(Realm& realm) { } -void BooleanConstructor::initialize(GlobalObject& global_object) +void BooleanConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 20.3.2.1 Boolean.prototype, https://tc39.es/ecma262/#sec-boolean.prototype - define_direct_property(vm.names.prototype, global_object.boolean_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().boolean_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/BooleanConstructor.h b/Userland/Libraries/LibJS/Runtime/BooleanConstructor.h index 8c6e22e88b..fa2c8a825f 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/BooleanConstructor.h @@ -15,7 +15,7 @@ class BooleanConstructor final : public NativeFunction { public: explicit BooleanConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~BooleanConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp index bdf4daaa10..67e0e9fbd7 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -17,10 +17,10 @@ BooleanPrototype::BooleanPrototype(Realm& realm) { } -void BooleanPrototype::initialize(GlobalObject& global_object) +void BooleanPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - BooleanObject::initialize(global_object); + BooleanObject::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.toString, to_string, 0, attr); define_native_function(vm.names.valueOf, value_of, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.h b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.h index 48f5672286..269b572319 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.h @@ -15,7 +15,7 @@ class BooleanPrototype final : public BooleanObject { public: explicit BooleanPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~BooleanPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp b/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp index 8d82aa5492..ad4067eab5 100644 --- a/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp @@ -17,10 +17,10 @@ ConsoleObject::ConsoleObject(Realm& realm) { } -void ConsoleObject::initialize(GlobalObject& global_object) +void ConsoleObject::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Enumerable | Attribute::Configurable; define_native_function(vm.names.log, log, 0, attr); define_native_function(vm.names.debug, debug, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ConsoleObject.h b/Userland/Libraries/LibJS/Runtime/ConsoleObject.h index 2749cc8ae1..438896b9c0 100644 --- a/Userland/Libraries/LibJS/Runtime/ConsoleObject.h +++ b/Userland/Libraries/LibJS/Runtime/ConsoleObject.h @@ -15,7 +15,7 @@ class ConsoleObject final : public Object { public: explicit ConsoleObject(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ConsoleObject() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp index 975c571626..10e054e80e 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp @@ -18,13 +18,13 @@ DataViewConstructor::DataViewConstructor(Realm& realm) { } -void DataViewConstructor::initialize(GlobalObject& global_object) +void DataViewConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 25.3.3.1 DataView.prototype, https://tc39.es/ecma262/#sec-dataview.prototype - define_direct_property(vm.names.prototype, global_object.data_view_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().data_view_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.h b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.h index d00c222a3f..20d77f0dcf 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.h @@ -15,7 +15,7 @@ class DataViewConstructor final : public NativeFunction { public: explicit DataViewConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DataViewConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp index a7c198f726..2c2b050b77 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -15,10 +15,10 @@ DataViewPrototype::DataViewPrototype(Realm& realm) { } -void DataViewPrototype::initialize(GlobalObject& global_object) +void DataViewPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.getBigInt64, get_big_int_64, 1, attr); @@ -47,7 +47,7 @@ void DataViewPrototype::initialize(GlobalObject& global_object) define_native_accessor(vm.names.byteOffset, byte_offset_getter, {}, Attribute::Configurable); // 25.3.4.25 DataView.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-dataview.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.DataView.as_string()), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.DataView.as_string()), Attribute::Configurable); } // 25.3.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type ), https://tc39.es/ecma262/#sec-getviewvalue diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h index 41a9bec2f3..979c7a3f32 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h @@ -16,7 +16,7 @@ class DataViewPrototype final : public PrototypeObjectvm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 21.4.3.3 Date.prototype, https://tc39.es/ecma262/#sec-date.prototype - define_direct_property(vm.names.prototype, global_object.date_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().date_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.now, now, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.h b/Userland/Libraries/LibJS/Runtime/DateConstructor.h index 54207f70d8..f7777c43f4 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.h @@ -15,7 +15,7 @@ class DateConstructor final : public NativeFunction { public: explicit DateConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DateConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index 03c1e7bfe7..61a9feae2c 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -35,10 +35,10 @@ DatePrototype::DatePrototype(Realm& realm) { } -void DatePrototype::initialize(GlobalObject& global_object) +void DatePrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.getDate, get_date, 0, attr); define_native_function(vm.names.getDay, get_day, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.h b/Userland/Libraries/LibJS/Runtime/DatePrototype.h index 0a922cef9a..5f159d556f 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.h @@ -16,7 +16,7 @@ class DatePrototype final : public PrototypeObject { public: explicit DatePrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DatePrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index cd500eb251..33cb8cff38 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -97,10 +97,10 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, String source }); } -void ECMAScriptFunctionObject::initialize(GlobalObject& global_object) +void ECMAScriptFunctionObject::initialize(Realm& realm) { auto& vm = this->vm(); - Base::initialize(global_object); + Base::initialize(realm); // Note: The ordering of these properties must be: length, name, prototype which is the order // they are defined in the spec: https://tc39.es/ecma262/#sec-function-instances . // This is observable through something like: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys @@ -114,17 +114,17 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object) Object* prototype = nullptr; switch (m_kind) { case FunctionKind::Normal: - prototype = vm.heap().allocate(global_object, *global_object.new_ordinary_function_prototype_object_shape()); + prototype = vm.heap().allocate(realm.global_object(), *realm.global_object().new_ordinary_function_prototype_object_shape()); MUST(prototype->define_property_or_throw(vm.names.constructor, { .value = this, .writable = true, .enumerable = false, .configurable = true })); break; case FunctionKind::Generator: // prototype is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png) - prototype = Object::create(global_object, global_object.generator_function_prototype_prototype()); + prototype = Object::create(realm.global_object(), realm.global_object().generator_function_prototype_prototype()); break; case FunctionKind::Async: break; case FunctionKind::AsyncGenerator: - prototype = Object::create(global_object, global_object.async_generator_function_prototype_prototype()); + prototype = Object::create(realm.global_object(), realm.global_object().async_generator_function_prototype_prototype()); break; } // 27.7.4 AsyncFunction Instances, https://tc39.es/ecma262/#sec-async-function-instances diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h index 6e417e782a..710d0f1098 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h @@ -36,7 +36,7 @@ public: static ECMAScriptFunctionObject* create(GlobalObject&, FlyString name, Object& prototype, String source_text, Statement const& ecmascript_code, Vector parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind, bool is_strict, bool might_need_arguments_object = true, bool contains_direct_call_to_eval = true, bool is_arrow_function = false, Variant class_field_initializer_name = {}); ECMAScriptFunctionObject(FlyString name, String source_text, Statement const& ecmascript_code, Vector parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind, bool is_strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant class_field_initializer_name); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ECMAScriptFunctionObject() override = default; virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; diff --git a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp index 7b9ceb3e3d..94698f2991 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -16,13 +16,13 @@ ErrorConstructor::ErrorConstructor(Realm& realm) { } -void ErrorConstructor::initialize(GlobalObject& global_object) +void ErrorConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 20.5.2.1 Error.prototype, https://tc39.es/ecma262/#sec-error.prototype - define_direct_property(vm.names.prototype, global_object.error_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().error_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } @@ -68,13 +68,13 @@ ThrowCompletionOr ErrorConstructor::construct(FunctionObject& new_targe { \ } \ \ - void ConstructorName::initialize(GlobalObject& global_object) \ + void ConstructorName::initialize(Realm& realm) \ { \ auto& vm = this->vm(); \ - NativeFunction::initialize(global_object); \ + NativeFunction::initialize(realm); \ \ /* 20.5.6.2.1 NativeError.prototype, https://tc39.es/ecma262/#sec-nativeerror.prototype */ \ - define_direct_property(vm.names.prototype, global_object.snake_name##_prototype(), 0); \ + define_direct_property(vm.names.prototype, realm.global_object().snake_name##_prototype(), 0); \ \ define_direct_property(vm.names.length, Value(1), Attribute::Configurable); \ } \ diff --git a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h index 534cf62e59..caaf3022e1 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorConstructor.h @@ -16,7 +16,7 @@ class ErrorConstructor final : public NativeFunction { public: explicit ErrorConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ErrorConstructor() override = default; virtual ThrowCompletionOr call() override; @@ -32,7 +32,7 @@ private: \ public: \ explicit ConstructorName(Realm&); \ - virtual void initialize(GlobalObject&) override; \ + virtual void initialize(Realm&) override; \ virtual ~ConstructorName() override; \ virtual ThrowCompletionOr call() override; \ virtual ThrowCompletionOr construct(FunctionObject& new_target) override; \ diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index 4c5a51d12d..1aae7414b3 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -20,10 +20,10 @@ ErrorPrototype::ErrorPrototype(Realm& realm) { } -void ErrorPrototype::initialize(GlobalObject& global_object) +void ErrorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_direct_property(vm.names.name, js_string(vm, "Error"), attr); define_direct_property(vm.names.message, js_string(vm, ""), attr); @@ -129,10 +129,10 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_setter) { \ } \ \ - void PrototypeName::initialize(GlobalObject& global_object) \ + void PrototypeName::initialize(Realm& realm) \ { \ auto& vm = this->vm(); \ - Object::initialize(global_object); \ + Object::initialize(realm); \ u8 attr = Attribute::Writable | Attribute::Configurable; \ define_direct_property(vm.names.name, js_string(vm, #ClassName), attr); \ define_direct_property(vm.names.message, js_string(vm, ""), attr); \ diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.h b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.h index c3e3566531..285e786ec4 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.h @@ -17,7 +17,7 @@ class ErrorPrototype final : public PrototypeObject { public: explicit ErrorPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ErrorPrototype() override = default; private: @@ -32,7 +32,7 @@ private: \ public: \ explicit PrototypeName(Realm&); \ - virtual void initialize(GlobalObject&) override; \ + virtual void initialize(Realm&) override; \ virtual ~PrototypeName() override = default; \ }; diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp index dfd681e48e..d693e4a6aa 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp @@ -18,13 +18,13 @@ FinalizationRegistryConstructor::FinalizationRegistryConstructor(Realm& realm) { } -void FinalizationRegistryConstructor::initialize(GlobalObject& global_object) +void FinalizationRegistryConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 26.2.2.1 FinalizationRegistry.prototype, https://tc39.es/ecma262/#sec-finalization-registry.prototype - define_direct_property(vm.names.prototype, global_object.finalization_registry_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().finalization_registry_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.h b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.h index 9516e4f102..39c6c32649 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.h @@ -15,7 +15,7 @@ class FinalizationRegistryConstructor final : public NativeFunction { public: explicit FinalizationRegistryConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~FinalizationRegistryConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp index d9aa36ed08..f19b5726bc 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -14,10 +14,10 @@ FinalizationRegistryPrototype::FinalizationRegistryPrototype(Realm& realm) { } -void FinalizationRegistryPrototype::initialize(GlobalObject& global_object) +void FinalizationRegistryPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.cleanupSome, cleanup_some, 0, attr); @@ -25,7 +25,7 @@ void FinalizationRegistryPrototype::initialize(GlobalObject& global_object) define_native_function(vm.names.unregister, unregister, 1, attr); // 26.2.3.4 FinalizationRegistry.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-finalization-registry.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.FinalizationRegistry.as_string()), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.FinalizationRegistry.as_string()), Attribute::Configurable); } // @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.h b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.h index a530fb482f..29f2aac192 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.h @@ -16,7 +16,7 @@ class FinalizationRegistryPrototype final : public PrototypeObjectvm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 20.2.2.2 Function.prototype, https://tc39.es/ecma262/#sec-function.prototype - define_direct_property(vm.names.prototype, global_object.function_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().function_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h index 159c50ee3b..7e8ea448c1 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.h @@ -18,7 +18,7 @@ public: static ThrowCompletionOr create_dynamic_function(GlobalObject& global_object, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector const& args); explicit FunctionConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~FunctionConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/FunctionObject.h b/Userland/Libraries/LibJS/Runtime/FunctionObject.h index 38b7689fa8..00fc2c7ec5 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionObject.h +++ b/Userland/Libraries/LibJS/Runtime/FunctionObject.h @@ -20,7 +20,7 @@ class FunctionObject : public Object { public: virtual ~FunctionObject() = default; - virtual void initialize(GlobalObject&) override { } + virtual void initialize(Realm&) override { } // Table 7: Additional Essential Internal Methods of Function Objects, https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index ab45ad95df..64b46d649f 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -25,10 +25,10 @@ FunctionPrototype::FunctionPrototype(Realm& realm) { } -void FunctionPrototype::initialize(GlobalObject& global_object) +void FunctionPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Base::initialize(global_object); + Base::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.apply, apply, 2, attr); define_native_function(vm.names.bind, bind, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.h b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.h index e7aef3b389..91ce61e648 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.h @@ -15,7 +15,7 @@ class FunctionPrototype final : public FunctionObject { public: explicit FunctionPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~FunctionPrototype() override = default; virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.cpp index 6fae3b8ad2..d8bf1dca88 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.cpp @@ -16,15 +16,15 @@ GeneratorFunctionConstructor::GeneratorFunctionConstructor(Realm& realm) { } -void GeneratorFunctionConstructor::initialize(GlobalObject& global_object) +void GeneratorFunctionConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 27.3.2.1 GeneratorFunction.length, https://tc39.es/ecma262/#sec-generatorfunction.length define_direct_property(vm.names.length, Value(1), Attribute::Configurable); // 27.3.2.2 GeneratorFunction.prototype, https://tc39.es/ecma262/#sec-generatorfunction.length - define_direct_property(vm.names.prototype, global_object.generator_function_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().generator_function_prototype(), 0); } // 27.3.1.1 GeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-generatorfunction diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.h b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.h index 90ce4bccb9..49a9af4649 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.h @@ -16,7 +16,7 @@ class GeneratorFunctionConstructor final : public NativeFunction { public: explicit GeneratorFunctionConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~GeneratorFunctionConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp index 00d0e5ca93..ab6d51e6f4 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.cpp @@ -15,13 +15,13 @@ GeneratorFunctionPrototype::GeneratorFunctionPrototype(Realm& realm) { } -void GeneratorFunctionPrototype::initialize(GlobalObject& global_object) +void GeneratorFunctionPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); // 27.3.3.2 GeneratorFunction.prototype.prototype, https://tc39.es/ecma262/#sec-generatorfunction.prototype.prototype - define_direct_property(vm.names.prototype, global_object.generator_prototype(), Attribute::Configurable); + define_direct_property(vm.names.prototype, realm.global_object().generator_prototype(), Attribute::Configurable); // 27.3.3.3 GeneratorFunction.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generatorfunction.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "GeneratorFunction"), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.h b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.h index 65d2798975..dedd61c4f1 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.h @@ -17,7 +17,7 @@ class GeneratorFunctionPrototype final : public Object { public: explicit GeneratorFunctionPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~GeneratorFunctionPrototype() override = default; }; diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp index b274677292..2249e54071 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp @@ -41,7 +41,7 @@ GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext con { } -void GeneratorObject::initialize(GlobalObject&) +void GeneratorObject::initialize(Realm&) { } diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.h b/Userland/Libraries/LibJS/Runtime/GeneratorObject.h index eff4e881ae..c205417164 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.h +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.h @@ -18,7 +18,7 @@ class GeneratorObject final : public Object { public: static ThrowCompletionOr create(GlobalObject&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow); GeneratorObject(Realm&, Object& prototype, ExecutionContext); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~GeneratorObject() override = default; void visit_edges(Cell::Visitor&) override; diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp index 81c4de3472..0386d9af2e 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp @@ -14,10 +14,10 @@ GeneratorPrototype::GeneratorPrototype(Realm& realm) { } -void GeneratorPrototype::initialize(GlobalObject& global_object) +void GeneratorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.next, next, 1, attr); define_native_function(vm.names.return_, return_, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.h b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.h index 0cc7a4ca85..1272c202f4 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.h @@ -17,7 +17,7 @@ class GeneratorPrototype final : public PrototypeObjectadd_property_without_transition(vm.names.constructor, Attribute::Writable | Attribute::Configurable); // Normally Heap::allocate() takes care of this, but these are allocated via allocate_without_global_object(). - - static_cast(m_function_prototype)->initialize(*this); - - static_cast(m_object_prototype)->initialize(*this); + static_cast(m_function_prototype)->initialize(realm); + static_cast(m_object_prototype)->initialize(realm); Object::set_prototype(m_object_prototype); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp index 2248aab8cb..fa945f3034 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.cpp @@ -23,9 +23,9 @@ CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collato { } -void CollatorCompareFunction::initialize(GlobalObject& global_object) +void CollatorCompareFunction::initialize(Realm&) { - auto& vm = global_object.vm(); + auto& vm = this->vm(); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h index c45cb5233a..98a39b7a91 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h @@ -17,7 +17,7 @@ public: static CollatorCompareFunction* create(GlobalObject&, Collator&); CollatorCompareFunction(Realm&, Collator&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~CollatorCompareFunction() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp index eafa195259..607a0f2677 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp @@ -137,14 +137,14 @@ CollatorConstructor::CollatorConstructor(Realm& realm) { } -void CollatorConstructor::initialize(GlobalObject& global_object) +void CollatorConstructor::initialize(Realm& realm) { - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); auto& vm = this->vm(); // 10.2.1 Intl.Collator.prototype, https://tc39.es/ecma402/#sec-intl.collator.prototype - define_direct_property(vm.names.prototype, global_object.intl_collator_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_collator_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.h index 2c925ded00..778c817ce1 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.h @@ -15,7 +15,7 @@ class CollatorConstructor final : public NativeFunction { public: explicit CollatorConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~CollatorConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp index 25f5b81421..4d575a3378 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp @@ -17,9 +17,9 @@ CollatorPrototype::CollatorPrototype(Realm& realm) { } -void CollatorPrototype::initialize(GlobalObject& global_object) +void CollatorPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.h index 2cb3169107..42daa2e02d 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.h @@ -16,7 +16,7 @@ class CollatorPrototype final : public PrototypeObjectvm(); // 11.2.1 Intl.DateTimeFormat.prototype, https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype - define_direct_property(vm.names.prototype, global_object.intl_date_time_format_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_date_time_format_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.h index cb328b0e5e..1a7ddf5417 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.h @@ -15,7 +15,7 @@ class DateTimeFormatConstructor final : public NativeFunction { public: explicit DateTimeFormatConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DateTimeFormatConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp index 114bf06916..1d285b1844 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.cpp @@ -25,11 +25,11 @@ DateTimeFormatFunction::DateTimeFormatFunction(DateTimeFormat& date_time_format, { } -void DateTimeFormatFunction::initialize(GlobalObject& global_object) +void DateTimeFormatFunction::initialize(Realm& realm) { auto& vm = this->vm(); - Base::initialize(global_object); + Base::initialize(realm); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h index f0e6c90d00..ab7f4be5ef 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h @@ -20,7 +20,7 @@ public: explicit DateTimeFormatFunction(DateTimeFormat&, Object& prototype); virtual ~DateTimeFormatFunction() override = default; - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp index 2cc261d0f6..6e1e3e14e1 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp @@ -19,9 +19,9 @@ DateTimeFormatPrototype::DateTimeFormatPrototype(Realm& realm) { } -void DateTimeFormatPrototype::initialize(GlobalObject& global_object) +void DateTimeFormatPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.h index e504ab390c..bb925b7f98 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.h @@ -16,7 +16,7 @@ class DateTimeFormatPrototype final : public PrototypeObjectvm(); // 12.2.1 Intl.DisplayNames.prototype, https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype - define_direct_property(vm.names.prototype, global_object.intl_display_names_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_display_names_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.h index 06dc7d196e..9686fc7cdd 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.h @@ -15,7 +15,7 @@ class DisplayNamesConstructor final : public NativeFunction { public: explicit DisplayNamesConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DisplayNamesConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp index a310f76fbf..2db9146d7c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp @@ -19,9 +19,9 @@ DisplayNamesPrototype::DisplayNamesPrototype(Realm& realm) { } -void DisplayNamesPrototype::initialize(GlobalObject& global_object) +void DisplayNamesPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.h index 049a1d8f75..77f82674ae 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.h @@ -16,7 +16,7 @@ class DisplayNamesPrototype final : public PrototypeObjectvm(); // 1.3.1 Intl.DurationFormat.prototype, https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype - define_direct_property(vm.names.prototype, global_object.intl_duration_format_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_duration_format_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.h index fe1aeafcd7..f9199457bd 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.h @@ -15,7 +15,7 @@ class DurationFormatConstructor final : public NativeFunction { public: explicit DurationFormatConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DurationFormatConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp index b32714846a..917504ca48 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp @@ -16,9 +16,9 @@ DurationFormatPrototype::DurationFormatPrototype(Realm& realm) { } -void DurationFormatPrototype::initialize(GlobalObject& global_object) +void DurationFormatPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.h index bce2f475c2..a12677db6b 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.h @@ -16,7 +16,7 @@ class DurationFormatPrototype final : public PrototypeObjectvm(); @@ -43,16 +43,16 @@ void Intl::initialize(GlobalObject& global_object) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_direct_property(vm.names.Collator, global_object.intl_collator_constructor(), attr); - define_direct_property(vm.names.DateTimeFormat, global_object.intl_date_time_format_constructor(), attr); - define_direct_property(vm.names.DisplayNames, global_object.intl_display_names_constructor(), attr); - define_direct_property(vm.names.DurationFormat, global_object.intl_duration_format_constructor(), attr); - define_direct_property(vm.names.ListFormat, global_object.intl_list_format_constructor(), attr); - define_direct_property(vm.names.Locale, global_object.intl_locale_constructor(), attr); - define_direct_property(vm.names.NumberFormat, global_object.intl_number_format_constructor(), attr); - define_direct_property(vm.names.PluralRules, global_object.intl_plural_rules_constructor(), attr); - define_direct_property(vm.names.RelativeTimeFormat, global_object.intl_relative_time_format_constructor(), attr); - define_direct_property(vm.names.Segmenter, global_object.intl_segmenter_constructor(), attr); + define_direct_property(vm.names.Collator, realm.global_object().intl_collator_constructor(), attr); + define_direct_property(vm.names.DateTimeFormat, realm.global_object().intl_date_time_format_constructor(), attr); + define_direct_property(vm.names.DisplayNames, realm.global_object().intl_display_names_constructor(), attr); + define_direct_property(vm.names.DurationFormat, realm.global_object().intl_duration_format_constructor(), attr); + define_direct_property(vm.names.ListFormat, realm.global_object().intl_list_format_constructor(), attr); + define_direct_property(vm.names.Locale, realm.global_object().intl_locale_constructor(), attr); + define_direct_property(vm.names.NumberFormat, realm.global_object().intl_number_format_constructor(), attr); + define_direct_property(vm.names.PluralRules, realm.global_object().intl_plural_rules_constructor(), attr); + define_direct_property(vm.names.RelativeTimeFormat, realm.global_object().intl_relative_time_format_constructor(), attr); + define_direct_property(vm.names.Segmenter, realm.global_object().intl_segmenter_constructor(), attr); define_native_function(vm.names.getCanonicalLocales, get_canonical_locales, 1, attr); define_native_function(vm.names.supportedValuesOf, supported_values_of, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Intl.h b/Userland/Libraries/LibJS/Runtime/Intl/Intl.h index 7c7eeea7bb..c7aab2bdc4 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Intl.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/Intl.h @@ -15,7 +15,7 @@ class Intl final : public Object { public: explicit Intl(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~Intl() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp index 6938320702..448e349e90 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp @@ -20,14 +20,14 @@ ListFormatConstructor::ListFormatConstructor(Realm& realm) { } -void ListFormatConstructor::initialize(GlobalObject& global_object) +void ListFormatConstructor::initialize(Realm& realm) { - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); auto& vm = this->vm(); // 13.2.1 Intl.ListFormat.prototype, https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype - define_direct_property(vm.names.prototype, global_object.intl_list_format_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_list_format_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.h index a7fdfbaa10..e84065fcdd 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.h @@ -15,7 +15,7 @@ class ListFormatConstructor final : public NativeFunction { public: explicit ListFormatConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ListFormatConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp index bfbde76cbb..e6776a6486 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp @@ -18,9 +18,9 @@ ListFormatPrototype::ListFormatPrototype(Realm& realm) { } -void ListFormatPrototype::initialize(GlobalObject& global_object) +void ListFormatPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.h index 7306daa40a..bb9cde718f 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.h @@ -16,7 +16,7 @@ class ListFormatPrototype final : public PrototypeObjectvm(); // 14.2.1 Intl.Locale.prototype, https://tc39.es/ecma402/#sec-Intl.Locale.prototype - define_direct_property(vm.names.prototype, global_object.intl_locale_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_locale_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.h index cd3d3a3a81..e10856c295 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.h @@ -15,7 +15,7 @@ class LocaleConstructor final : public NativeFunction { public: explicit LocaleConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~LocaleConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index d667c645ae..da3420463b 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -19,9 +19,9 @@ LocalePrototype::LocalePrototype(Realm& realm) { } -void LocalePrototype::initialize(GlobalObject& global_object) +void LocalePrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.h index 84771ac6b7..e84025fafd 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.h @@ -16,7 +16,7 @@ class LocalePrototype final : public PrototypeObject { public: explicit LocalePrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~LocalePrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp index bcf7e15ce9..5f31c5a220 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp @@ -19,14 +19,14 @@ NumberFormatConstructor::NumberFormatConstructor(Realm& realm) { } -void NumberFormatConstructor::initialize(GlobalObject& global_object) +void NumberFormatConstructor::initialize(Realm& realm) { - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); auto& vm = this->vm(); // 15.2.1 Intl.NumberFormat.prototype, https://tc39.es/ecma402/#sec-intl.numberformat.prototype - define_direct_property(vm.names.prototype, global_object.intl_number_format_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_number_format_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.h index f329ed301b..fd0b688eb0 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.h @@ -16,7 +16,7 @@ class NumberFormatConstructor final : public NativeFunction { public: explicit NumberFormatConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~NumberFormatConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp index 78d35845c9..f19a60cd23 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.cpp @@ -23,11 +23,11 @@ NumberFormatFunction::NumberFormatFunction(NumberFormat& number_format, Object& { } -void NumberFormatFunction::initialize(GlobalObject& global_object) +void NumberFormatFunction::initialize(Realm& realm) { auto& vm = this->vm(); - Base::initialize(global_object); + Base::initialize(realm); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); define_direct_property(vm.names.name, js_string(vm, String::empty()), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h index 7b14fbc003..80971c8d6f 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h @@ -20,7 +20,7 @@ public: explicit NumberFormatFunction(NumberFormat&, Object& prototype); virtual ~NumberFormatFunction() override = default; - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp index 6c403c36b9..34b4e15032 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp @@ -19,9 +19,9 @@ NumberFormatPrototype::NumberFormatPrototype(Realm& realm) { } -void NumberFormatPrototype::initialize(GlobalObject& global_object) +void NumberFormatPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.h index f265378dd2..85e33daec9 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.h @@ -16,7 +16,7 @@ class NumberFormatPrototype final : public PrototypeObjectvm(); // 16.2.1 Intl.PluralRules.prototype, https://tc39.es/ecma402/#sec-intl.pluralrules.prototype - define_direct_property(vm.names.prototype, global_object.intl_plural_rules_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_plural_rules_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.h index eb9316a6d6..7a44f58e0d 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.h @@ -15,7 +15,7 @@ class PluralRulesConstructor final : public NativeFunction { public: explicit PluralRulesConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PluralRulesConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp index cae4f804a8..2b1e306440 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp @@ -18,9 +18,9 @@ PluralRulesPrototype::PluralRulesPrototype(Realm& realm) { } -void PluralRulesPrototype::initialize(GlobalObject& global_object) +void PluralRulesPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.h index ade0b376b9..35d794f401 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.h @@ -16,7 +16,7 @@ class PluralRulesPrototype final : public PrototypeObjectvm(); // 17.2.1 Intl.RelativeTimeFormat.prototype, https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype - define_direct_property(vm.names.prototype, global_object.intl_relative_time_format_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_relative_time_format_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.h index eb61caefba..31a14dad36 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.h @@ -15,7 +15,7 @@ class RelativeTimeFormatConstructor final : public NativeFunction { public: explicit RelativeTimeFormatConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~RelativeTimeFormatConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp index afc46675d5..abf43ee9f9 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp @@ -16,9 +16,9 @@ RelativeTimeFormatPrototype::RelativeTimeFormatPrototype(Realm& realm) { } -void RelativeTimeFormatPrototype::initialize(GlobalObject& global_object) +void RelativeTimeFormatPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.h index 095f65b28a..e7d40f780e 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.h @@ -16,7 +16,7 @@ class RelativeTimeFormatPrototype final : public PrototypeObjectvm(); // 18.6.2.2 %SegmentIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma402/#sec-%segmentiteratorprototype%.@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Segmenter String Iterator"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Segmenter String Iterator"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.next, next, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.h index dc5e287de9..de0d36d9dc 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.h @@ -16,7 +16,7 @@ class SegmentIteratorPrototype final : public PrototypeObjectvm(); // 18.2.1 Intl.Segmenter.prototype, https://tc39.es/ecma402/#sec-intl.segmenter.prototype - define_direct_property(vm.names.prototype, global_object.intl_segmenter_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().intl_segmenter_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.h b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.h index 6fd27fa26c..3931020f37 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.h @@ -15,7 +15,7 @@ class SegmenterConstructor final : public NativeFunction { public: explicit SegmenterConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~SegmenterConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp index 24a3398f71..f13448445f 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp @@ -17,9 +17,9 @@ SegmenterPrototype::SegmenterPrototype(Realm& realm) { } -void SegmenterPrototype::initialize(GlobalObject& global_object) +void SegmenterPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.h index 71e44f8cec..4f1942a055 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.h @@ -16,7 +16,7 @@ class SegmenterPrototype final : public PrototypeObjectvm(); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.h b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.h index 2fe06c10e5..142c294c10 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.h @@ -16,7 +16,7 @@ class SegmentsPrototype final : public PrototypeObjectvm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(*vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); } diff --git a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.h index 42f8d883ac..51161b6522 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.h @@ -15,7 +15,7 @@ class IteratorPrototype : public Object { public: IteratorPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~IteratorPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index 58d4ec21c5..4818ffb8d1 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -30,16 +30,16 @@ JSONObject::JSONObject(Realm& realm) { } -void JSONObject::initialize(GlobalObject& global_object) +void JSONObject::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.stringify, stringify, 3, attr); define_native_function(vm.names.parse, parse, 2, attr); // 25.5.3 JSON [ @@toStringTag ], https://tc39.es/ecma262/#sec-json-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "JSON"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "JSON"), Attribute::Configurable); } // 25.5.2 JSON.stringify ( value [ , replacer [ , space ] ] ), https://tc39.es/ecma262/#sec-json.stringify diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.h b/Userland/Libraries/LibJS/Runtime/JSONObject.h index 1be33caa06..baf452b5ac 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.h +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.h @@ -15,7 +15,7 @@ class JSONObject final : public Object { public: explicit JSONObject(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~JSONObject() override = default; // The base implementation of stringify is exposed because it is used by diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index fbb5a911ee..c319c38079 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -18,13 +18,13 @@ MapConstructor::MapConstructor(Realm& realm) { } -void MapConstructor::initialize(GlobalObject& global_object) +void MapConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 24.1.2.1 Map.prototype, https://tc39.es/ecma262/#sec-map.prototype - define_direct_property(vm.names.prototype, global_object.map_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().map_prototype(), 0); define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.h b/Userland/Libraries/LibJS/Runtime/MapConstructor.h index 2d24f9815e..ecf044339c 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.h @@ -15,7 +15,7 @@ class MapConstructor final : public NativeFunction { public: explicit MapConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~MapConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp index 1689cd7d2d..76515fcbd8 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp @@ -18,13 +18,13 @@ MapIteratorPrototype::MapIteratorPrototype(Realm& realm) { } -void MapIteratorPrototype::initialize(GlobalObject& global_object) +void MapIteratorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Map Iterator"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Map Iterator"), Attribute::Configurable); } // 24.1.5.2.1 %MapIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%mapiteratorprototype%.next diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.h index 3d3be47cf6..4aaf071e01 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.h @@ -16,7 +16,7 @@ class MapIteratorPrototype final : public PrototypeObjectvm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.clear, clear, 0, attr); @@ -36,7 +36,7 @@ void MapPrototype::initialize(GlobalObject& global_object) define_native_accessor(vm.names.size, size_getter, {}, Attribute::Configurable); define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), attr); - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.Map.as_string()), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Map.as_string()), Attribute::Configurable); } // 24.1.3.1 Map.prototype.clear ( ), https://tc39.es/ecma262/#sec-map.prototype.clear diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.h b/Userland/Libraries/LibJS/Runtime/MapPrototype.h index c617ef0ee6..d8142b82d7 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.h @@ -16,7 +16,7 @@ class MapPrototype final : public PrototypeObject { public: MapPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~MapPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.cpp b/Userland/Libraries/LibJS/Runtime/MathObject.cpp index 8e7852062d..baa01c4a81 100644 --- a/Userland/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/MathObject.cpp @@ -20,10 +20,10 @@ MathObject::MathObject(Realm& realm) { } -void MathObject::initialize(GlobalObject& global_object) +void MathObject::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.abs, abs, 1, attr); define_native_function(vm.names.random, random, 0, attr); diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.h b/Userland/Libraries/LibJS/Runtime/MathObject.h index 4e59aaeb42..5208e96d1f 100644 --- a/Userland/Libraries/LibJS/Runtime/MathObject.h +++ b/Userland/Libraries/LibJS/Runtime/MathObject.h @@ -15,7 +15,7 @@ class MathObject final : public Object { public: explicit MathObject(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~MathObject() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp index 7a3126c1be..5078b4604a 100644 --- a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.cpp @@ -22,9 +22,9 @@ ModuleNamespaceObject::ModuleNamespaceObject(Realm& realm, Module* module, Vecto }); } -void ModuleNamespaceObject::initialize(GlobalObject& global_object) +void ModuleNamespaceObject::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); // 28.3.1 @@toStringTag, https://tc39.es/ecma262/#sec-@@tostringtag define_direct_property(*vm().well_known_symbol_to_string_tag(), js_string(vm(), "Module"sv), 0); diff --git a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h index 0e2254358d..676e67a8c8 100644 --- a/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h +++ b/Userland/Libraries/LibJS/Runtime/ModuleNamespaceObject.h @@ -31,7 +31,7 @@ public: virtual ThrowCompletionOr internal_set(PropertyKey const&, Value value, Value receiver) override; virtual ThrowCompletionOr internal_delete(PropertyKey const&) override; virtual ThrowCompletionOr> internal_own_property_keys() const override; - virtual void initialize(GlobalObject& object) override; + virtual void initialize(Realm&) override; private: // FIXME: UHHH how do we want to store this to avoid cycles but be safe?? diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.h b/Userland/Libraries/LibJS/Runtime/NativeFunction.h index bbeb25241f..d129236a0d 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.h @@ -25,7 +25,7 @@ public: NativeFunction(Function(VM&, GlobalObject&)>, Object* prototype, Realm& realm); NativeFunction(FlyString name, Function(VM&, GlobalObject&)>, Object& prototype); - virtual void initialize(GlobalObject&) override { } + virtual void initialize(Realm&) override { } virtual ~NativeFunction() override = default; virtual ThrowCompletionOr internal_call(Value this_argument, MarkedVector arguments_list) override; diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp index ee96dff10d..8bcc6f7a80 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -28,21 +28,22 @@ NumberConstructor::NumberConstructor(Realm& realm) { } -void NumberConstructor::initialize(GlobalObject& global_object) +void NumberConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 21.1.2.15 Number.prototype, https://tc39.es/ecma262/#sec-number.prototype - define_direct_property(vm.names.prototype, global_object.number_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().number_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.isFinite, is_finite, 1, attr); define_native_function(vm.names.isInteger, is_integer, 1, attr); define_native_function(vm.names.isNaN, is_nan, 1, attr); define_native_function(vm.names.isSafeInteger, is_safe_integer, 1, attr); - define_direct_property(vm.names.parseInt, global_object.get_without_side_effects(vm.names.parseInt), attr); - define_direct_property(vm.names.parseFloat, global_object.get_without_side_effects(vm.names.parseFloat), attr); + // FIXME: Store these as intrinsics (`parse_int_function()`) instead of getting them from the global object + define_direct_property(vm.names.parseInt, realm.global_object().get_without_side_effects(vm.names.parseInt), attr); + define_direct_property(vm.names.parseFloat, realm.global_object().get_without_side_effects(vm.names.parseFloat), attr); define_direct_property(vm.names.EPSILON, Value(EPSILON_VALUE), 0); define_direct_property(vm.names.MAX_VALUE, Value(NumericLimits::max()), 0); define_direct_property(vm.names.MIN_VALUE, Value(NumericLimits::min()), 0); diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.h b/Userland/Libraries/LibJS/Runtime/NumberConstructor.h index cc3ecf24e0..1d2f765f38 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.h @@ -15,7 +15,7 @@ class NumberConstructor final : public NativeFunction { public: explicit NumberConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~NumberConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp index 900d7b171e..cf7436c0ec 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -88,10 +88,10 @@ NumberPrototype::NumberPrototype(Realm& realm) { } -void NumberPrototype::initialize(GlobalObject& object) +void NumberPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(object); + Object::initialize(realm); u8 attr = Attribute::Configurable | Attribute::Writable; define_native_function(vm.names.toExponential, to_exponential, 1, attr); define_native_function(vm.names.toFixed, to_fixed, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.h b/Userland/Libraries/LibJS/Runtime/NumberPrototype.h index 5630cf1bde..e4819f5073 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.h @@ -15,7 +15,7 @@ class NumberPrototype final : public NumberObject { public: explicit NumberPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~NumberPrototype() override = default; JS_DECLARE_NATIVE_FUNCTION(to_exponential); diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 824ac5e79d..015c2f0a21 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -69,7 +69,7 @@ Object::Object(Shape& shape) m_storage.resize(shape.property_count()); } -void Object::initialize(GlobalObject&) +void Object::initialize(Realm&) { } diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index ddeccc45e6..4937c91760 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -52,7 +52,7 @@ public: Object(Realm&, Object* prototype); explicit Object(Object& prototype); explicit Object(Shape&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~Object() = default; enum class PropertyKind { diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 199d8eeeaf..1014a42156 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -22,13 +22,13 @@ ObjectConstructor::ObjectConstructor(Realm& realm) { } -void ObjectConstructor::initialize(GlobalObject& global_object) +void ObjectConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 20.1.2.19 Object.prototype, https://tc39.es/ecma262/#sec-object.prototype - define_direct_property(vm.names.prototype, global_object.object_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().object_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.defineProperty, define_property, 3, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.h b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.h index 843fcd5bf1..41ece30cea 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.h @@ -16,7 +16,7 @@ class ObjectConstructor final : public NativeFunction { public: explicit ObjectConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ObjectConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 1f42b36812..19662c1dd1 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -26,10 +26,10 @@ ObjectPrototype::ObjectPrototype(Realm& realm) { } -void ObjectPrototype::initialize(GlobalObject& global_object) +void ObjectPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); // This must be called after the constructor has returned, so that the below code // can find the ObjectPrototype through normal paths. u8 attr = Attribute::Writable | Attribute::Configurable; diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.h b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.h index 700e520166..b4f31184b6 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.h @@ -16,7 +16,7 @@ class ObjectPrototype final : public Object { public: explicit ObjectPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ObjectPrototype() override = default; // 10.4.7 Immutable Prototype Exotic Objects, https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index f76ec0990e..f9e9e727ae 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -249,13 +249,13 @@ PromiseConstructor::PromiseConstructor(Realm& realm) { } -void PromiseConstructor::initialize(GlobalObject& global_object) +void PromiseConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 27.2.4.4 Promise.prototype, https://tc39.es/ecma262/#sec-promise.prototype - define_direct_property(vm.names.prototype, global_object.promise_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().promise_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.all, all, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.h b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.h index d174328358..73ba53eff0 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.h @@ -15,7 +15,7 @@ class PromiseConstructor final : public NativeFunction { public: explicit PromiseConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PromiseConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index 91b202ef36..5beb86e457 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -21,10 +21,10 @@ PromisePrototype::PromisePrototype(Realm& realm) { } -void PromisePrototype::initialize(GlobalObject& global_object) +void PromisePrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.then, then, 2, attr); diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.h b/Userland/Libraries/LibJS/Runtime/PromisePrototype.h index 56cf340224..e8e6c8cd15 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.h @@ -15,7 +15,7 @@ class PromisePrototype final : public PrototypeObject public: PromisePrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PromisePrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp index f8afad6a1f..b475f4b9ee 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.cpp @@ -29,9 +29,9 @@ PromiseResolvingElementFunction::PromiseResolvingElementFunction(size_t index, P { } -void PromiseResolvingElementFunction::initialize(GlobalObject& global_object) +void PromiseResolvingElementFunction::initialize(Realm& realm) { - Base::initialize(global_object); + Base::initialize(realm); define_direct_property(vm().names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h index 093d4ef605..3e2cc4f6cf 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingElementFunctions.h @@ -45,7 +45,7 @@ class PromiseResolvingElementFunction : public NativeFunction { JS_OBJECT(PromiseResolvingFunction, NativeFunction); public: - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PromiseResolvingElementFunction() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp b/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp index fcafeed728..8dfa505b2a 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.cpp @@ -24,9 +24,9 @@ PromiseResolvingFunction::PromiseResolvingFunction(Promise& promise, AlreadyReso { } -void PromiseResolvingFunction::initialize(GlobalObject& global_object) +void PromiseResolvingFunction::initialize(Realm& realm) { - Base::initialize(global_object); + Base::initialize(realm); define_direct_property(vm().names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.h b/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.h index 32f732c157..66f7c27b63 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.h +++ b/Userland/Libraries/LibJS/Runtime/PromiseResolvingFunction.h @@ -31,7 +31,7 @@ public: static PromiseResolvingFunction* create(GlobalObject&, Promise&, AlreadyResolved&, FunctionType); explicit PromiseResolvingFunction(Promise&, AlreadyResolved&, FunctionType, Object& prototype); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PromiseResolvingFunction() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp index 6cd280832e..50db1a1a85 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -29,10 +29,10 @@ ProxyConstructor::ProxyConstructor(Realm& realm) { } -void ProxyConstructor::initialize(GlobalObject& global_object) +void ProxyConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.revocable, revocable, 2, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.h b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.h index f6ef26148e..81bdbdd9ae 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.h @@ -16,7 +16,7 @@ class ProxyConstructor final : public NativeFunction { public: explicit ProxyConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ProxyConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp index a5458f5129..edc52b2db1 100644 --- a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -20,10 +20,10 @@ ReflectObject::ReflectObject(Realm& realm) { } -void ReflectObject::initialize(GlobalObject& global_object) +void ReflectObject::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.apply, apply, 3, attr); define_native_function(vm.names.construct, construct, 2, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.h b/Userland/Libraries/LibJS/Runtime/ReflectObject.h index e705d6d4f2..53e40c319d 100644 --- a/Userland/Libraries/LibJS/Runtime/ReflectObject.h +++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.h @@ -15,7 +15,7 @@ class ReflectObject final : public Object { public: explicit ReflectObject(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ReflectObject() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp index 4f07f86155..ae77053e5b 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -16,13 +16,13 @@ RegExpConstructor::RegExpConstructor(Realm& realm) { } -void RegExpConstructor::initialize(GlobalObject& global_object) +void RegExpConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 22.2.4.1 RegExp.prototype, https://tc39.es/ecma262/#sec-regexp.prototype - define_direct_property(vm.names.prototype, global_object.regexp_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().regexp_prototype(), 0); define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.h b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.h index 28ee58790c..543fea86f1 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.h @@ -15,7 +15,7 @@ class RegExpConstructor final : public NativeFunction { public: explicit RegExpConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~RegExpConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp b/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp index d6a1dc4cfa..d7a0c717e2 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpObject.cpp @@ -146,10 +146,10 @@ RegExpObject::RegExpObject(Regex regex, String pattern, String flags, O VERIFY(m_regex->parser_result.error == regex::Error::NoError); } -void RegExpObject::initialize(GlobalObject& global_object) +void RegExpObject::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_direct_property(vm.names.lastIndex, Value(0), Attribute::Writable); } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpObject.h b/Userland/Libraries/LibJS/Runtime/RegExpObject.h index 3d4eb7a99e..8497239813 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpObject.h +++ b/Userland/Libraries/LibJS/Runtime/RegExpObject.h @@ -45,7 +45,7 @@ public: ThrowCompletionOr regexp_initialize(GlobalObject&, Value pattern, Value flags); String escape_regexp_pattern() const; - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~RegExpObject() override = default; String const& pattern() const { return m_pattern; } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 3e483ea59c..219f5e5a05 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -26,10 +26,10 @@ RegExpPrototype::RegExpPrototype(Realm& realm) { } -void RegExpPrototype::initialize(GlobalObject& global_object) +void RegExpPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.toString, to_string, 0, attr); define_native_function(vm.names.test, test, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h index defa9981e9..6aa0da074a 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h @@ -20,7 +20,7 @@ class RegExpPrototype final : public PrototypeObjectvm(); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.next, next, 0, attr); // 22.2.7.2.2 %RegExpStringIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%regexpstringiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "RegExp String Iterator"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "RegExp String Iterator"), Attribute::Configurable); } // 22.2.7.2.1 %RegExpStringIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%regexpstringiteratorprototype%.next diff --git a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.h index ee6c2c1aae..249d8ff260 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.h @@ -18,7 +18,7 @@ public: explicit RegExpStringIteratorPrototype(Realm&); virtual ~RegExpStringIteratorPrototype() override = default; - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; private: JS_DECLARE_NATIVE_FUNCTION(next); diff --git a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp index 34a3bccbbd..eeaf366e9a 100644 --- a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp @@ -18,13 +18,13 @@ SetConstructor::SetConstructor(Realm& realm) { } -void SetConstructor::initialize(GlobalObject& global_object) +void SetConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 24.2.2.1 Set.prototype, https://tc39.es/ecma262/#sec-set.prototype - define_direct_property(vm.names.prototype, global_object.set_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().set_prototype(), 0); define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/SetConstructor.h b/Userland/Libraries/LibJS/Runtime/SetConstructor.h index 5d6d4ff7c0..e8618688e9 100644 --- a/Userland/Libraries/LibJS/Runtime/SetConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/SetConstructor.h @@ -15,7 +15,7 @@ class SetConstructor final : public NativeFunction { public: explicit SetConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~SetConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp index 51216c5c52..801fae3358 100644 --- a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp @@ -18,15 +18,15 @@ SetIteratorPrototype::SetIteratorPrototype(Realm& realm) { } -void SetIteratorPrototype::initialize(GlobalObject& global_object) +void SetIteratorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 24.2.5.2.2 %SetIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%setiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Set Iterator"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Set Iterator"), Attribute::Configurable); } // 24.2.5.2.1 %SetIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%setiteratorprototype%.next diff --git a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.h index efcd5e5169..e50c00484a 100644 --- a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.h @@ -16,7 +16,7 @@ class SetIteratorPrototype final : public PrototypeObjectvm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.add, add, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.h b/Userland/Libraries/LibJS/Runtime/SetPrototype.h index 79c0b62463..cc34da593d 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.h @@ -16,7 +16,7 @@ class SetPrototype final : public PrototypeObject { public: SetPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~SetPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp index ad1da3af2a..e475bba818 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp @@ -16,13 +16,13 @@ ShadowRealmConstructor::ShadowRealmConstructor(Realm& realm) { } -void ShadowRealmConstructor::initialize(GlobalObject& global_object) +void ShadowRealmConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 3.3.1 ShadowRealm.prototype, https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype - define_direct_property(vm.names.prototype, global_object.shadow_realm_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().shadow_realm_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.h b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.h index 24dde2aeb6..f489dbaac7 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.h @@ -15,7 +15,7 @@ class ShadowRealmConstructor final : public NativeFunction { public: explicit ShadowRealmConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ShadowRealmConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp index b261d344ec..fc527521fe 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp @@ -16,10 +16,10 @@ ShadowRealmPrototype::ShadowRealmPrototype(Realm& realm) { } -void ShadowRealmPrototype::initialize(GlobalObject& global_object) +void ShadowRealmPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.evaluate, evaluate, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.h b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.h index c97dba0fe6..e0b9f99250 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.h @@ -16,7 +16,7 @@ class ShadowRealmPrototype final : public PrototypeObjectvm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 22.1.2.3 String.prototype, https://tc39.es/ecma262/#sec-string.prototype - define_direct_property(vm.names.prototype, global_object.string_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().string_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.raw, raw, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/StringConstructor.h b/Userland/Libraries/LibJS/Runtime/StringConstructor.h index 67c99f0675..43c48449a7 100644 --- a/Userland/Libraries/LibJS/Runtime/StringConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/StringConstructor.h @@ -15,7 +15,7 @@ class StringConstructor final : public NativeFunction { public: explicit StringConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~StringConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index a987f67895..ff48e52220 100644 --- a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -18,14 +18,14 @@ StringIteratorPrototype::StringIteratorPrototype(Realm& realm) { } -void StringIteratorPrototype::initialize(GlobalObject& global_object) +void StringIteratorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 22.1.5.1.2 %StringIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%stringiteratorprototype%-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "String Iterator"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "String Iterator"), Attribute::Configurable); } // 22.1.5.1.1 %StringIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next diff --git a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.h b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.h index 69616ea2b6..75089f3365 100644 --- a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.h @@ -17,7 +17,7 @@ class StringIteratorPrototype final : public PrototypeObjectvm(); - Object::initialize(global_object); + Object::initialize(realm); define_direct_property(vm.names.length, Value(m_string.utf16_string_view().length_in_code_units()), 0); } diff --git a/Userland/Libraries/LibJS/Runtime/StringObject.h b/Userland/Libraries/LibJS/Runtime/StringObject.h index 503fa405b1..1c2c457754 100644 --- a/Userland/Libraries/LibJS/Runtime/StringObject.h +++ b/Userland/Libraries/LibJS/Runtime/StringObject.h @@ -17,7 +17,7 @@ public: static StringObject* create(GlobalObject&, PrimitiveString&, Object& prototype); StringObject(PrimitiveString&, Object& prototype); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~StringObject() override = default; PrimitiveString const& primitive_string() const { return m_string; } diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 2cbde14500..b6816fd8aa 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -107,10 +107,10 @@ StringPrototype::StringPrototype(Realm& realm) { } -void StringPrototype::initialize(GlobalObject& global_object) +void StringPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - StringObject::initialize(global_object); + StringObject::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.charAt, char_at, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.h b/Userland/Libraries/LibJS/Runtime/StringPrototype.h index 9b32f73e67..eeb3403358 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.h @@ -25,7 +25,7 @@ class StringPrototype final : public StringObject { public: explicit StringPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~StringPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp index 0633cabdfa..e8a60695ab 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -15,13 +15,13 @@ SymbolConstructor::SymbolConstructor(Realm& realm) { } -void SymbolConstructor::initialize(GlobalObject& global_object) +void SymbolConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 20.4.2.9 Symbol.prototype, https://tc39.es/ecma262/#sec-symbol.prototype - define_direct_property(vm.names.prototype, global_object.symbol_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().symbol_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.for_, for_, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.h b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.h index 88f5ea153b..2d27b474ab 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.h @@ -15,7 +15,7 @@ class SymbolConstructor final : public NativeFunction { public: explicit SymbolConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~SymbolConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp index 2ca00f223f..174889c60c 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -23,10 +23,10 @@ SymbolPrototype::SymbolPrototype(Realm& realm) { } -void SymbolPrototype::initialize(GlobalObject& global_object) +void SymbolPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.toString, to_string, 0, attr); define_native_function(vm.names.valueOf, value_of, 0, attr); @@ -34,7 +34,7 @@ void SymbolPrototype::initialize(GlobalObject& global_object) define_native_function(*vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); // 20.4.3.6 Symbol.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "Symbol"), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Symbol"), Attribute::Configurable); } // thisSymbolValue ( value ), https://tc39.es/ecma262/#thissymbolvalue diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h index e8644d0f74..d445ddaa85 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.h @@ -15,7 +15,7 @@ class SymbolPrototype final : public Object { public: explicit SymbolPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~SymbolPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp index a940d86a85..9361321e1a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp @@ -16,14 +16,14 @@ CalendarConstructor::CalendarConstructor(Realm& realm) { } -void CalendarConstructor::initialize(GlobalObject& global_object) +void CalendarConstructor::initialize(Realm& realm) { - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); auto& vm = this->vm(); // 12.3.1 Temporal.Calendar.prototype, https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype - define_direct_property(vm.names.prototype, global_object.temporal_calendar_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_calendar_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.h index af3227a880..9bf8ed4125 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.h @@ -15,7 +15,7 @@ class CalendarConstructor final : public NativeFunction { public: explicit CalendarConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~CalendarConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index 29f67ccc34..82e87ff428 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -25,9 +25,9 @@ CalendarPrototype::CalendarPrototype(Realm& realm) { } -void CalendarPrototype::initialize(GlobalObject& global_object) +void CalendarPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.h index 8b5092b40f..79b4ef726d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.h @@ -16,7 +16,7 @@ class CalendarPrototype final : public PrototypeObjectvm(); // 7.2.1 Temporal.Duration.prototype, https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype - define_direct_property(vm.names.prototype, global_object.temporal_duration_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_duration_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.h index 10f1dab59f..81dd0526c4 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.h @@ -15,7 +15,7 @@ class DurationConstructor final : public NativeFunction { public: explicit DurationConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~DurationConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index 7bd757669b..c31b7292ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -20,9 +20,9 @@ DurationPrototype::DurationPrototype(Realm& realm) { } -void DurationPrototype::initialize(GlobalObject& global_object) +void DurationPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.h index 75f156de5d..69acdc3c48 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.h @@ -16,7 +16,7 @@ class DurationPrototype final : public PrototypeObjectvm(); // 8.2.1 Temporal.Instant.prototype, https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype - define_direct_property(vm.names.prototype, global_object.temporal_instant_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_instant_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.h index 7c414ee383..f223cd7691 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.h @@ -15,7 +15,7 @@ class InstantConstructor final : public NativeFunction { public: explicit InstantConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~InstantConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index 13707ec818..15cf4e424b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -24,9 +24,9 @@ InstantPrototype::InstantPrototype(Realm& realm) { } -void InstantPrototype::initialize(GlobalObject& global_object) +void InstantPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.h index 3c0a753365..14b448c269 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.h @@ -16,7 +16,7 @@ class InstantPrototype final : public PrototypeObject public: explicit InstantPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~InstantPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp index bd1b544257..88ccb39048 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp @@ -25,9 +25,9 @@ Now::Now(Realm& realm) { } -void Now::initialize(GlobalObject& global_object) +void Now::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Now.h b/Userland/Libraries/LibJS/Runtime/Temporal/Now.h index 5297e0d486..a0486d5977 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Now.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Now.h @@ -16,7 +16,7 @@ class Now final : public Object { public: explicit Now(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~Now() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp index 777f87f283..f5f6f56577 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp @@ -20,14 +20,14 @@ PlainDateConstructor::PlainDateConstructor(Realm& realm) { } -void PlainDateConstructor::initialize(GlobalObject& global_object) +void PlainDateConstructor::initialize(Realm& realm) { - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); auto& vm = this->vm(); // 3.2.1 Temporal.PlainDate.prototype, https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype - define_direct_property(vm.names.prototype, global_object.temporal_plain_date_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_date_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.h index 77fc5ac234..05df5e88ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.h @@ -15,7 +15,7 @@ class PlainDateConstructor final : public NativeFunction { public: explicit PlainDateConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PlainDateConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index b0bcc0129b..c68578a429 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -25,9 +25,9 @@ PlainDatePrototype::PlainDatePrototype(Realm& realm) { } -void PlainDatePrototype::initialize(GlobalObject& global_object) +void PlainDatePrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.h index 04305b561f..058d8339f1 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.h @@ -16,7 +16,7 @@ class PlainDatePrototype final : public PrototypeObjectvm(); // 5.2.1 Temporal.PlainDateTime.prototype, https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype - define_direct_property(vm.names.prototype, global_object.temporal_plain_date_time_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_date_time_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h index 7678a1aaff..f67172a74d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.h @@ -15,7 +15,7 @@ class PlainDateTimeConstructor final : public NativeFunction { public: explicit PlainDateTimeConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PlainDateTimeConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index 122ea0b8e8..ef6c2dc86c 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -26,9 +26,9 @@ PlainDateTimePrototype::PlainDateTimePrototype(Realm& realm) { } -void PlainDateTimePrototype::initialize(GlobalObject& global_object) +void PlainDateTimePrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h index 9689a6d8d7..23f4a1caa2 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.h @@ -16,7 +16,7 @@ class PlainDateTimePrototype final : public PrototypeObjectvm(); // 10.2.1 Temporal.PlainMonthDay.prototype, https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype - define_direct_property(vm.names.prototype, global_object.temporal_plain_month_day_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_month_day_prototype(), 0); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.h index 555ce6585d..eea34f44f6 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.h @@ -15,7 +15,7 @@ class PlainMonthDayConstructor final : public NativeFunction { public: explicit PlainMonthDayConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PlainMonthDayConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index 4cf6963717..9fef256799 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -20,9 +20,9 @@ PlainMonthDayPrototype::PlainMonthDayPrototype(Realm& realm) { } -void PlainMonthDayPrototype::initialize(GlobalObject& global_object) +void PlainMonthDayPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.h index d99aa31435..80629771bf 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.h @@ -16,7 +16,7 @@ class PlainMonthDayPrototype final : public PrototypeObjectvm(); // 4.2.1 Temporal.PlainTime.prototype, https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype - define_direct_property(vm.names.prototype, global_object.temporal_plain_time_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_time_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.h index 66d477111a..dc2f3da126 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.h @@ -15,7 +15,7 @@ class PlainTimeConstructor final : public NativeFunction { public: explicit PlainTimeConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PlainTimeConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index 206a9f25e5..a2ec7e4d64 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -25,9 +25,9 @@ PlainTimePrototype::PlainTimePrototype(Realm& realm) { } -void PlainTimePrototype::initialize(GlobalObject& global_object) +void PlainTimePrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.h index 288f245757..1445243864 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.h @@ -16,7 +16,7 @@ class PlainTimePrototype final : public PrototypeObjectvm(); // 9.2.1 Temporal.PlainYearMonth.prototype, https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype - define_direct_property(vm.names.prototype, global_object.temporal_plain_year_month_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_year_month_prototype(), 0); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.h index f1b7381b1d..7b1e556d7a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.h @@ -15,7 +15,7 @@ class PlainYearMonthConstructor final : public NativeFunction { public: explicit PlainYearMonthConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~PlainYearMonthConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index f7a9505679..59cfaa862b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -22,9 +22,9 @@ PlainYearMonthPrototype::PlainYearMonthPrototype(Realm& realm) { } -void PlainYearMonthPrototype::initialize(GlobalObject& global_object) +void PlainYearMonthPrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.h index 9fc89e06cf..4fbeb5c01c 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.h @@ -16,7 +16,7 @@ class PlainYearMonthPrototype final : public PrototypeObjectvm(); - auto& realm = *global_object.associated_realm(); // 1.1.1 Temporal [ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_direct_property(vm.names.Now, heap().allocate(global_object, realm), attr); - define_direct_property(vm.names.Calendar, global_object.temporal_calendar_constructor(), attr); - define_direct_property(vm.names.Duration, global_object.temporal_duration_constructor(), attr); - define_direct_property(vm.names.Instant, global_object.temporal_instant_constructor(), attr); - define_direct_property(vm.names.PlainDate, global_object.temporal_plain_date_constructor(), attr); - define_direct_property(vm.names.PlainDateTime, global_object.temporal_plain_date_time_constructor(), attr); - define_direct_property(vm.names.PlainMonthDay, global_object.temporal_plain_month_day_constructor(), attr); - define_direct_property(vm.names.PlainTime, global_object.temporal_plain_time_constructor(), attr); - define_direct_property(vm.names.PlainYearMonth, global_object.temporal_plain_year_month_constructor(), attr); - define_direct_property(vm.names.TimeZone, global_object.temporal_time_zone_constructor(), attr); - define_direct_property(vm.names.ZonedDateTime, global_object.temporal_zoned_date_time_constructor(), attr); + define_direct_property(vm.names.Now, heap().allocate(realm.global_object(), realm), attr); + define_direct_property(vm.names.Calendar, realm.global_object().temporal_calendar_constructor(), attr); + define_direct_property(vm.names.Duration, realm.global_object().temporal_duration_constructor(), attr); + define_direct_property(vm.names.Instant, realm.global_object().temporal_instant_constructor(), attr); + define_direct_property(vm.names.PlainDate, realm.global_object().temporal_plain_date_constructor(), attr); + define_direct_property(vm.names.PlainDateTime, realm.global_object().temporal_plain_date_time_constructor(), attr); + define_direct_property(vm.names.PlainMonthDay, realm.global_object().temporal_plain_month_day_constructor(), attr); + define_direct_property(vm.names.PlainTime, realm.global_object().temporal_plain_time_constructor(), attr); + define_direct_property(vm.names.PlainYearMonth, realm.global_object().temporal_plain_year_month_constructor(), attr); + define_direct_property(vm.names.TimeZone, realm.global_object().temporal_time_zone_constructor(), attr); + define_direct_property(vm.names.ZonedDateTime, realm.global_object().temporal_zoned_date_time_constructor(), attr); } } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.h b/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.h index 2fde1bcd58..360cd8f27d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Temporal.h @@ -15,7 +15,7 @@ class Temporal final : public Object { public: explicit Temporal(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~Temporal() override = default; }; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp index d5ce0dc26f..eac3857367 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp @@ -16,14 +16,14 @@ TimeZoneConstructor::TimeZoneConstructor(Realm& realm) { } -void TimeZoneConstructor::initialize(GlobalObject& global_object) +void TimeZoneConstructor::initialize(Realm& realm) { - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); auto& vm = this->vm(); // 11.3.1 Temporal.TimeZone.prototype, https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype - define_direct_property(vm.names.prototype, global_object.temporal_time_zone_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_time_zone_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.h index 282f21e924..ba1481048e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.h @@ -15,7 +15,7 @@ class TimeZoneConstructor final : public NativeFunction { public: explicit TimeZoneConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~TimeZoneConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 11849ae640..36346ec323 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -22,9 +22,9 @@ TimeZonePrototype::TimeZonePrototype(Realm& realm) { } -void TimeZonePrototype::initialize(GlobalObject& global_object) +void TimeZonePrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.h index 48be78acac..08976b9396 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.h @@ -16,7 +16,7 @@ class TimeZonePrototype final : public PrototypeObjectvm(); // 6.2.1 Temporal.ZonedDateTime.prototype, https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype - define_direct_property(vm.names.prototype, global_object.temporal_zoned_date_time_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().temporal_zoned_date_time_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.h b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.h index b2d1b5303e..3fd8dcfd0f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.h @@ -15,7 +15,7 @@ class ZonedDateTimeConstructor final : public NativeFunction { public: explicit ZonedDateTimeConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~ZonedDateTimeConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index 1154fadba4..9156916d78 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -25,9 +25,9 @@ ZonedDateTimePrototype::ZonedDateTimePrototype(Realm& realm) { } -void ZonedDateTimePrototype::initialize(GlobalObject& global_object) +void ZonedDateTimePrototype::initialize(Realm& realm) { - Object::initialize(global_object); + Object::initialize(realm); auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h index 9190ed062f..8e3addd255 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h @@ -16,7 +16,7 @@ class ZonedDateTimePrototype final : public PrototypeObjectvm(); \ - Object::initialize(global_object); \ + Object::initialize(realm); \ define_direct_property(vm.names.BYTES_PER_ELEMENT, Value((i32)sizeof(Type)), 0); \ } \ \ @@ -493,13 +493,13 @@ void TypedArrayBase::visit_edges(Visitor& visitor) { \ } \ \ - void ConstructorName::initialize(GlobalObject& global_object) \ + void ConstructorName::initialize(Realm& realm) \ { \ auto& vm = this->vm(); \ - NativeFunction::initialize(global_object); \ + NativeFunction::initialize(realm); \ \ /* 23.2.6.2 TypedArray.prototype, https://tc39.es/ecma262/#sec-typedarray.prototype */ \ - define_direct_property(vm.names.prototype, global_object.snake_name##_prototype(), 0); \ + define_direct_property(vm.names.prototype, realm.global_object().snake_name##_prototype(), 0); \ \ /* 23.2.6.1 TypedArray.BYTES_PER_ELEMENT, https://tc39.es/ecma262/#sec-typedarray.bytes_per_element */ \ define_direct_property(vm.names.BYTES_PER_ELEMENT, Value((i32)sizeof(Type)), 0); \ diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index 92fb885652..c783f89962 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -472,7 +472,7 @@ ThrowCompletionOr compare_typed_array_elements(GlobalObject& global_obje \ public: \ PrototypeName(Realm&); \ - virtual void initialize(GlobalObject&) override; \ + virtual void initialize(Realm&) override; \ virtual ~PrototypeName() override; \ }; \ class ConstructorName final : public TypedArrayConstructor { \ @@ -480,7 +480,7 @@ ThrowCompletionOr compare_typed_array_elements(GlobalObject& global_obje \ public: \ explicit ConstructorName(Realm&); \ - virtual void initialize(GlobalObject&) override; \ + virtual void initialize(Realm&) override; \ virtual ~ConstructorName() override; \ \ virtual ThrowCompletionOr call() override; \ diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index dcb64765b7..4ba482655d 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -21,13 +21,13 @@ TypedArrayConstructor::TypedArrayConstructor(Realm& realm) { } -void TypedArrayConstructor::initialize(GlobalObject& global_object) +void TypedArrayConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 23.2.2.3 %TypedArray%.prototype, https://tc39.es/ecma262/#sec-%typedarray%.prototype - define_direct_property(vm.names.prototype, global_object.typed_array_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().typed_array_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.from, from, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h index 6d668e6330..a75c819f1c 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.h @@ -16,7 +16,7 @@ class TypedArrayConstructor : public NativeFunction { public: TypedArrayConstructor(FlyString const& name, Object& prototype); explicit TypedArrayConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~TypedArrayConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index 5229cedb71..ee294e4a22 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -20,10 +20,10 @@ TypedArrayPrototype::TypedArrayPrototype(Realm& realm) { } -void TypedArrayPrototype::initialize(GlobalObject& object) +void TypedArrayPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_accessor(vm.names.buffer, buffer_getter, nullptr, Attribute::Configurable); @@ -65,7 +65,7 @@ void TypedArrayPrototype::initialize(GlobalObject& object) define_native_accessor(*vm.well_known_symbol_to_string_tag(), to_string_tag_getter, nullptr, Attribute::Configurable); // 23.2.3.32 %TypedArray%.prototype.toString ( ), https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring - define_direct_property(vm.names.toString, global_object().array_prototype()->get_without_side_effects(vm.names.toString), attr); + define_direct_property(vm.names.toString, realm.global_object().array_prototype()->get_without_side_effects(vm.names.toString), attr); // 23.2.3.34 %TypedArray%.prototype [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.values), attr); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.h b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.h index 39b1ffa02d..f7ba75970e 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.h @@ -16,7 +16,7 @@ class TypedArrayPrototype final : public Object { public: explicit TypedArrayPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~TypedArrayPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp index a2e22b4db0..fb8aa0ea63 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp @@ -18,13 +18,13 @@ WeakMapConstructor::WeakMapConstructor(Realm& realm) { } -void WeakMapConstructor::initialize(GlobalObject& global_object) +void WeakMapConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 24.3.2.1 WeakMap.prototype, https://tc39.es/ecma262/#sec-weakmap.prototype - define_direct_property(vm.names.prototype, global_object.weak_map_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().weak_map_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.h b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.h index 19eb0cd345..05489291f1 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.h @@ -15,7 +15,7 @@ class WeakMapConstructor final : public NativeFunction { public: explicit WeakMapConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~WeakMapConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp index cd5ee699ed..b87bd6402b 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -16,10 +16,10 @@ WeakMapPrototype::WeakMapPrototype(Realm& realm) { } -void WeakMapPrototype::initialize(GlobalObject& global_object) +void WeakMapPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.delete_, delete_, 1, attr); diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.h b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.h index af305ca9f2..be4a3ac739 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.h @@ -16,7 +16,7 @@ class WeakMapPrototype final : public PrototypeObject public: WeakMapPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~WeakMapPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp index 7fe27eacd3..5871149ec9 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp @@ -17,13 +17,13 @@ WeakRefConstructor::WeakRefConstructor(Realm& realm) { } -void WeakRefConstructor::initialize(GlobalObject& global_object) +void WeakRefConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 26.1.2.1 WeakRef.prototype, https://tc39.es/ecma262/#sec-weak-ref.prototype - define_direct_property(vm.names.prototype, global_object.weak_ref_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().weak_ref_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.h b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.h index 24cbbd3d67..efdc7dc1e5 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.h @@ -15,7 +15,7 @@ class WeakRefConstructor final : public NativeFunction { public: explicit WeakRefConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~WeakRefConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp index 258f33ecc3..d0c00f8eba 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp @@ -14,10 +14,10 @@ WeakRefPrototype::WeakRefPrototype(Realm& realm) { } -void WeakRefPrototype::initialize(GlobalObject& global_object) +void WeakRefPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); define_native_function(vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.h b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.h index eca9dff784..a39967e6d6 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.h @@ -16,7 +16,7 @@ class WeakRefPrototype final : public PrototypeObject public: WeakRefPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~WeakRefPrototype() override = default; private: diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp index 9297c17d6c..51b4725c16 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp @@ -18,13 +18,13 @@ WeakSetConstructor::WeakSetConstructor(Realm& realm) { } -void WeakSetConstructor::initialize(GlobalObject& global_object) +void WeakSetConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); // 24.4.2.1 WeakSet.prototype, https://tc39.es/ecma262/#sec-weakset.prototype - define_direct_property(vm.names.prototype, global_object.weak_set_prototype(), 0); + define_direct_property(vm.names.prototype, realm.global_object().weak_set_prototype(), 0); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.h b/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.h index 5b80fe368a..6187a0e298 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.h +++ b/Userland/Libraries/LibJS/Runtime/WeakSetConstructor.h @@ -15,7 +15,7 @@ class WeakSetConstructor final : public NativeFunction { public: explicit WeakSetConstructor(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~WeakSetConstructor() override = default; virtual ThrowCompletionOr call() override; diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index d76131eb48..90e0b6ba99 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -16,10 +16,10 @@ WeakSetPrototype::WeakSetPrototype(Realm& realm) { } -void WeakSetPrototype::initialize(GlobalObject& global_object) +void WeakSetPrototype::initialize(Realm& realm) { auto& vm = this->vm(); - Object::initialize(global_object); + Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; define_native_function(vm.names.add, add, 1, attr); @@ -27,7 +27,7 @@ void WeakSetPrototype::initialize(GlobalObject& global_object) define_native_function(vm.names.has, has, 1, attr); // 24.4.3.5 WeakSet.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-weakset.prototype-@@tostringtag - define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), vm.names.WeakSet.as_string()), Attribute::Configurable); + define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakSet.as_string()), Attribute::Configurable); } // 24.4.3.1 WeakSet.prototype.add ( value ), https://tc39.es/ecma262/#sec-weakset.prototype.add diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.h b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.h index 93d7c16663..0ad81f9619 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.h @@ -16,7 +16,7 @@ class WeakSetPrototype final : public PrototypeObject public: WeakSetPrototype(Realm&); - virtual void initialize(GlobalObject&) override; + virtual void initialize(Realm&) override; virtual ~WeakSetPrototype() override = default; private: diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp index b881df327d..7fa1bbe632 100644 --- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp @@ -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(global_object); - NativeFunction::initialize(global_object); + auto& window = static_cast(realm.global_object()); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("HTMLAudioElement"), 0); define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h index 912bef0885..36a88b628b 100644 --- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp index a46ec1998f..943d1a0c01 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp +++ b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp @@ -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); diff --git a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h index 05d4979a4a..cdd92bdc9a 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h +++ b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h @@ -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: diff --git a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp index ee7aeaaaf6..48157f754a 100644 --- a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp @@ -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(global_object); - NativeFunction::initialize(global_object); + auto& window = static_cast(realm.global_object()); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("HTMLImageElement"), 0); define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); diff --git a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h index 3a4a603497..d16e61bbb9 100644 --- a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp index a6be55e5da..7158152b17 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationConstructor.cpp @@ -28,12 +28,12 @@ JS::ThrowCompletionOr LocationConstructor::construct(FunctionObject return vm().throw_completion(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("Location"), 0); define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/Bindings/LocationConstructor.h b/Userland/Libraries/LibWeb/Bindings/LocationConstructor.h index dd05c3551e..41b5345a24 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/LocationConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index d51a4e4bea..93b62b166e 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -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); diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.h b/Userland/Libraries/LibWeb/Bindings/LocationObject.h index 34c0684d84..f48ee23114 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.h +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.h @@ -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 internal_get_prototype_of() const override; diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp index 2deb4efef2..560033963f 100644 --- a/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.cpp @@ -28,12 +28,12 @@ JS::ThrowCompletionOr NavigatorConstructor::construct(FunctionObjec return vm().throw_completion(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("Navigator"), 0); define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.h b/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.h index 12054f5ebf..add6edde6c 100644 --- a/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/NavigatorConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp index a7f844b80f..b4c2fccc20 100644 --- a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp @@ -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 diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h index 026f65aab4..e91a7c6198 100644 --- a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h +++ b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h @@ -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: diff --git a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp index d8582e8830..330f34b334 100644 --- a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.cpp @@ -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(global_object); - NativeFunction::initialize(global_object); + auto& window = static_cast(realm.global_object()); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("HTMLOptionElement"), 0); define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); diff --git a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.h b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.h index d485f2859e..919762b970 100644 --- a/Userland/Libraries/LibWeb/Bindings/OptionConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/OptionConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp index be0d7c5cdb..185fe1d991 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowConstructor.cpp @@ -28,12 +28,12 @@ JS::ThrowCompletionOr WindowConstructor::construct(FunctionObject&) return vm().throw_completion(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("Window"), 0); define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/Bindings/WindowConstructor.h b/Userland/Libraries/LibWeb/Bindings/WindowConstructor.h index 5b25ee6c92..3dda78c0d3 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp index b7441a457c..71bf399464 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.cpp @@ -40,12 +40,12 @@ JS::ThrowCompletionOr WebAssemblyInstanceConstructor::construct(Fun return heap().allocate(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("WebAssemblyInstancePrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.h index f217182b63..98bf578947 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp index afae00d11a..2ff380e32e 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.cpp @@ -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 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 object = cache.memory_instances.get(address); if (!object.has_value()) { - object = heap().allocate(global_object, realm, address); + object = heap().allocate(realm.global_object(), realm, address); cache.memory_instances.set(address, *object); } m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h index de8cd1381e..d39b3dd8bb 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h @@ -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; } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp index 1f05165f9d..bc5580cdc9 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp @@ -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); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h index 06f51667ba..8f409538a3 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h @@ -22,7 +22,7 @@ public: { } - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; private: JS_DECLARE_NATIVE_FUNCTION(exports_getter); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp index d37649efef..077c0d8196 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.cpp @@ -54,12 +54,12 @@ JS::ThrowCompletionOr WebAssemblyMemoryConstructor::construct(Funct return vm.heap().allocate(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("WebAssemblyMemoryPrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.h index f435b0905e..df983ac235 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp index 71783240f1..30f6fa8cf2 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp @@ -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); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h index 390761f23f..ac68af75fd 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h @@ -24,7 +24,7 @@ public: { } - virtual void initialize(JS::GlobalObject&) override; + virtual void initialize(JS::Realm&) override; private: JS_DECLARE_NATIVE_FUNCTION(grow); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp index 072f0ab8cd..53705691e6 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.cpp @@ -38,12 +38,12 @@ JS::ThrowCompletionOr WebAssemblyModuleConstructor::construct(Funct return heap().allocate(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("WebAssemblyModulePrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.h index ac1dfdf8a4..911f3582a4 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index 898882e2ee..6dec92b7c4 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -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(global_object); + auto& window = static_cast(realm.global_object()); auto& memory_constructor = window.ensure_web_constructor("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"); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h index 6ada19ec3a..35080471cd 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h @@ -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; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp index 1ca586a1ce..1ff1d30ddb 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp @@ -81,12 +81,12 @@ JS::ThrowCompletionOr WebAssemblyTableConstructor::construct(Functi return vm.heap().allocate(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(global_object); + auto& window = static_cast(realm.global_object()); - NativeFunction::initialize(global_object); + NativeFunction::initialize(realm); define_direct_property(vm.names.prototype, &window.ensure_web_prototype("WebAssemblyTablePrototype"), 0); define_direct_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.h index babf1f5aed..f8c0df3225 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.h @@ -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 call() override; diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp index ac9b8704e6..91f7fe0bb4 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp @@ -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); diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h index 14067840bb..c3d576f0a9 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h @@ -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);