mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:12:43 +00:00 
			
		
		
		
	LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs. Work towards #20405
This commit is contained in:
		
							parent
							
								
									fde26c53f0
								
							
						
					
					
						commit
						18c54d8d40
					
				
					 804 changed files with 1330 additions and 2171 deletions
				
			
		|  | @ -120,7 +120,7 @@ class TestRunnerGlobalObject final : public JS::GlobalObject { | |||
| 
 | ||||
| public: | ||||
|     TestRunnerGlobalObject(JS::Realm&); | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~TestRunnerGlobalObject() override; | ||||
| 
 | ||||
| private: | ||||
|  | @ -167,13 +167,11 @@ JS_DEFINE_NATIVE_FUNCTION(TestRunnerGlobalObject::fuzzilli) | |||
|     return JS::js_undefined(); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> TestRunnerGlobalObject::initialize(JS::Realm& realm) | ||||
| void TestRunnerGlobalObject::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     define_direct_property("global", this, JS::Attribute::Enumerable); | ||||
|     define_native_function(realm, "fuzzilli", fuzzilli, 2, JS::default_attributes); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| int main(int, char**) | ||||
|  |  | |||
|  | @ -2540,12 +2540,12 @@ static void generate_prototype_or_global_mixin_definitions(IDL::Interface const& | |||
| #define define_native_function (object.define_native_function) | ||||
| #define set_prototype (object.set_prototype) | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> @class_name@::initialize(JS::Realm& realm, JS::Object& object) | ||||
| void @class_name@::initialize(JS::Realm& realm, JS::Object& object) | ||||
| { | ||||
| )~~~"); | ||||
|     } else { | ||||
|         generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<void> @class_name@::initialize(JS::Realm& realm) | ||||
| void @class_name@::initialize(JS::Realm& realm) | ||||
| { | ||||
| )~~~"); | ||||
|     } | ||||
|  | @ -2682,17 +2682,16 @@ JS::ThrowCompletionOr<void> @class_name@::initialize(JS::Realm& realm) | |||
|     } | ||||
| 
 | ||||
|     generator.append(R"~~~( | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "@namespaced_name@"sv)), JS::Attribute::Configurable); | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(JS::PrimitiveString::create(vm, "@namespaced_name@"sv)), JS::Attribute::Configurable); | ||||
| )~~~"); | ||||
| 
 | ||||
|     if (!is_global_interface) { | ||||
|         generator.append(R"~~~( | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| )~~~"); | ||||
|     } | ||||
| 
 | ||||
|     generator.append(R"~~~( | ||||
|     return {}; | ||||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|  | @ -3051,7 +3050,7 @@ class @namespace_class@ final : public JS::Object { | |||
| 
 | ||||
| public: | ||||
|     explicit @namespace_class@(JS::Realm&); | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~@namespace_class@() override; | ||||
| 
 | ||||
| private: | ||||
|  | @ -3151,12 +3150,12 @@ namespace Web::Bindings { | |||
| { | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> @namespace_class@::initialize(JS::Realm& realm) | ||||
| void @namespace_class@::initialize(JS::Realm& realm) | ||||
| { | ||||
|     [[maybe_unused]] auto& vm = this->vm(); | ||||
|     [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable; | ||||
| 
 | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
| )~~~"); | ||||
| 
 | ||||
|  | @ -3173,7 +3172,6 @@ JS::ThrowCompletionOr<void> @namespace_class@::initialize(JS::Realm& realm) | |||
|     } | ||||
| 
 | ||||
|     generator.append(R"~~~( | ||||
|     return {}; | ||||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|  | @ -3217,7 +3215,7 @@ class @constructor_class@ : public JS::NativeFunction { | |||
|     JS_OBJECT(@constructor_class@, JS::NativeFunction); | ||||
| public: | ||||
|     explicit @constructor_class@(JS::Realm&); | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~@constructor_class@() override; | ||||
| 
 | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> call() override; | ||||
|  | @ -3546,12 +3544,12 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> @constructor_class@::constru | |||
|     generator.append(R"~~~( | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> @constructor_class@::initialize(JS::Realm& realm) | ||||
| void @constructor_class@::initialize(JS::Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable; | ||||
| 
 | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     define_direct_property(vm.names.prototype, &ensure_web_prototype<@prototype_class@>(realm, "@namespaced_name@"), 0); | ||||
|     define_direct_property(vm.names.length, JS::Value(@constructor.length@), JS::Attribute::Configurable); | ||||
| 
 | ||||
|  | @ -3581,7 +3579,6 @@ JS::ThrowCompletionOr<void> @constructor_class@::initialize(JS::Realm& realm) | |||
|     } | ||||
| 
 | ||||
|     generator.append(R"~~~( | ||||
|     return {}; | ||||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|  | @ -3616,7 +3613,7 @@ class @prototype_class@ : public JS::Object { | |||
|     JS_OBJECT(@prototype_class@, JS::Object); | ||||
| public: | ||||
|     explicit @prototype_class@(JS::Realm&); | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~@prototype_class@() override; | ||||
| private: | ||||
| )~~~"); | ||||
|  | @ -3776,10 +3773,9 @@ namespace Web::Bindings { | |||
|     auto is_global_interface = interface.extended_attributes.contains("Global"); | ||||
|     if (is_global_interface) { | ||||
|         generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<void> @prototype_class@::initialize(JS::Realm& realm) | ||||
| void @prototype_class@::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     return {}; | ||||
|     Base::initialize(realm); | ||||
| } | ||||
| )~~~"); | ||||
|     } else { | ||||
|  | @ -3809,7 +3805,7 @@ class @prototype_class@ : public JS::Object { | |||
|     JS_OBJECT(@prototype_class@, JS::Object); | ||||
| public: | ||||
|     explicit @prototype_class@(JS::Realm&); | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~@prototype_class@() override; | ||||
| 
 | ||||
| private: | ||||
|  | @ -3887,14 +3883,12 @@ namespace Web::Bindings { | |||
| { | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> @prototype_class@::initialize(JS::Realm& realm) | ||||
| void @prototype_class@::initialize(JS::Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     define_native_function(realm, vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable); | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(JS::PrimitiveString::create(vm, "Iterator"sv)), JS::Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(JS::PrimitiveString::create(vm, "Iterator"sv)), JS::Attribute::Configurable); | ||||
| } | ||||
| 
 | ||||
| static JS::ThrowCompletionOr<@fully_qualified_name@*> impl_from(JS::VM& vm) | ||||
|  | @ -3930,7 +3924,7 @@ namespace Web::Bindings { | |||
| 
 | ||||
| class @class_name@ { | ||||
| public: | ||||
|     JS::ThrowCompletionOr<void> initialize(JS::Realm&, JS::Object&); | ||||
|     void initialize(JS::Realm&, JS::Object&); | ||||
|     @class_name@(); | ||||
|     virtual ~@class_name@(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ public: | |||
|         : GlobalObject(realm) | ||||
|     { | ||||
|     } | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~ReplObject() override = default; | ||||
| 
 | ||||
| private: | ||||
|  | @ -211,9 +211,9 @@ static ErrorOr<bool> parse_and_run(JS::Interpreter& interpreter, StringView sour | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> ReplObject::initialize(JS::Realm& realm) | ||||
| void ReplObject::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     define_direct_property("global", this, JS::Attribute::Enumerable); | ||||
|     u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable; | ||||
|  | @ -238,8 +238,6 @@ JS::ThrowCompletionOr<void> ReplObject::initialize(JS::Realm& realm) | |||
|             return value; | ||||
|         }, | ||||
|         attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| JS_DEFINE_NATIVE_FUNCTION(ReplObject::print) | ||||
|  |  | |||
|  | @ -70,7 +70,7 @@ public: | |||
|         instance->m_module_instance = result.release_value(); | ||||
|         return instance.ptr(); | ||||
|     } | ||||
|     JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     void initialize(JS::Realm&) override; | ||||
| 
 | ||||
|     ~WebAssemblyModule() override = default; | ||||
| 
 | ||||
|  | @ -148,13 +148,11 @@ TESTJS_GLOBAL_FUNCTION(compare_typed_arrays, compareTypedArrays) | |||
|     return JS::Value(lhs_array.viewed_array_buffer()->buffer() == rhs_array.viewed_array_buffer()->buffer()); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> WebAssemblyModule::initialize(JS::Realm& realm) | ||||
| void WebAssemblyModule::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     define_native_function(realm, "getExport", get_export, 1, JS::default_attributes); | ||||
|     define_native_function(realm, "invoke", wasm_invoke, 1, JS::default_attributes); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export) | ||||
|  |  | |||
|  | @ -144,9 +144,9 @@ JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_set(const JS::PropertyKe | |||
|     return Base::internal_set(property_name, value, receiver); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> SheetGlobalObject::initialize(JS::Realm& realm) | ||||
| void SheetGlobalObject::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable; | ||||
|     define_native_function(realm, "get_real_cell_contents", get_real_cell_contents, 1, attr); | ||||
|  | @ -157,8 +157,6 @@ JS::ThrowCompletionOr<void> SheetGlobalObject::initialize(JS::Realm& realm) | |||
|     define_native_function(realm, "column_index", column_index, 1, attr); | ||||
|     define_native_function(realm, "get_column_bound", get_column_bound, 1, attr); | ||||
|     define_native_accessor(realm, "name", get_name, nullptr, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void SheetGlobalObject::visit_edges(Visitor& visitor) | ||||
|  | @ -378,12 +376,10 @@ WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook) | |||
| { | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> WorkbookObject::initialize(JS::Realm& realm) | ||||
| void WorkbookObject::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Object::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     define_native_function(realm, "sheet", sheet, 1, JS::default_attributes); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void WorkbookObject::visit_edges(Visitor& visitor) | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ class SheetGlobalObject final : public JS::GlobalObject { | |||
| 
 | ||||
| public: | ||||
|     SheetGlobalObject(JS::Realm&, Sheet&); | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
|     virtual ~SheetGlobalObject() override = default; | ||||
| 
 | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override; | ||||
|  | @ -53,7 +53,7 @@ public: | |||
| 
 | ||||
|     virtual ~WorkbookObject() override = default; | ||||
| 
 | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | ||||
|     virtual void initialize(JS::Realm&) override; | ||||
| 
 | ||||
|     JS_DECLARE_NATIVE_FUNCTION(sheet); | ||||
| 
 | ||||
|  |  | |||
|  | @ -27,12 +27,12 @@ $262Object::$262Object(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> $262Object::initialize(Realm& realm) | ||||
| void $262Object::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     m_agent = MUST_OR_THROW_OOM(vm().heap().allocate<AgentObject>(realm, realm)); | ||||
|     m_is_htmldda = MUST_OR_THROW_OOM(vm().heap().allocate<IsHTMLDDA>(realm, realm)); | ||||
|     m_agent = MUST(vm().heap().allocate<AgentObject>(realm, realm)); | ||||
|     m_is_htmldda = MUST(vm().heap().allocate<IsHTMLDDA>(realm, realm)); | ||||
| 
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, "clearKeptObjects", clear_kept_objects, 0, attr); | ||||
|  | @ -44,8 +44,6 @@ ThrowCompletionOr<void> $262Object::initialize(Realm& realm) | |||
|     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); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void $262Object::visit_edges(Cell::Visitor& visitor) | ||||
|  | @ -68,7 +66,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::create_realm) | |||
|     VERIFY(realm_global_object); | ||||
|     realm->set_global_object(realm_global_object, nullptr); | ||||
|     set_default_global_bindings(*realm); | ||||
|     MUST_OR_THROW_OOM(realm_global_object->initialize(*realm)); | ||||
|     realm_global_object->initialize(*realm); | ||||
|     return Value(realm_global_object->$262()); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ class $262Object final : public Object { | |||
|     JS_OBJECT($262Object, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~$262Object() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -17,9 +17,9 @@ AgentObject::AgentObject(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<void> AgentObject::initialize(JS::Realm& realm) | ||||
| void AgentObject::initialize(JS::Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, "monotonicNow", monotonic_now, 0, attr); | ||||
|  | @ -27,8 +27,6 @@ JS::ThrowCompletionOr<void> AgentObject::initialize(JS::Realm& realm) | |||
|     // TODO: broadcast
 | ||||
|     // TODO: getReport
 | ||||
|     // TODO: start
 | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| JS_DEFINE_NATIVE_FUNCTION(AgentObject::monotonic_now) | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class AgentObject final : public Object { | |||
|     JS_OBJECT(AgentObject, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual JS::ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AgentObject() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -14,18 +14,16 @@ | |||
| 
 | ||||
| namespace JS::Test262 { | ||||
| 
 | ||||
| ThrowCompletionOr<void> GlobalObject::initialize(Realm& realm) | ||||
| void GlobalObject::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     m_$262 = MUST_OR_THROW_OOM(vm().heap().allocate<$262Object>(realm, realm)); | ||||
|     m_$262 = MUST(vm().heap().allocate<$262Object>(realm, realm)); | ||||
| 
 | ||||
|     // https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, "print", print, 1, attr); | ||||
|     define_direct_property("$262", m_$262, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void GlobalObject::visit_edges(Cell::Visitor& visitor) | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class GlobalObject final : public JS::GlobalObject { | |||
|     JS_OBJECT(GlobalObject, JS::GlobalObject); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~GlobalObject() override = default; | ||||
| 
 | ||||
|     $262Object* $262() const { return m_$262; } | ||||
|  |  | |||
|  | @ -11,9 +11,8 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| ThrowCompletionOr<void> JS::Cell::initialize(JS::Realm&) | ||||
| void JS::Cell::initialize(JS::Realm&) | ||||
| { | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void JS::Cell::Visitor::visit(JS::Value value) | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ class Cell { | |||
|     AK_MAKE_NONMOVABLE(Cell); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&); | ||||
|     virtual void initialize(Realm&); | ||||
|     virtual ~Cell() = default; | ||||
| 
 | ||||
|     bool is_marked() const { return m_mark; } | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ public: | |||
|         auto* memory = allocate_cell(sizeof(T)); | ||||
|         new (memory) T(forward<Args>(args)...); | ||||
|         auto* cell = static_cast<T*>(memory); | ||||
|         MUST_OR_THROW_OOM(memory->initialize(realm)); | ||||
|         memory->initialize(realm); | ||||
|         return *cell; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,17 +19,15 @@ AggregateErrorConstructor::AggregateErrorConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AggregateErrorConstructor::initialize(Realm& realm) | ||||
| void AggregateErrorConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 20.5.7.2.1 AggregateError.prototype, https://tc39.es/ecma262/#sec-aggregate-error.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().aggregate_error_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(2), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 20.5.7.1.1 AggregateError ( errors, message [ , options ] ), https://tc39.es/ecma262/#sec-aggregate-error
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AggregateErrorConstructor final : public NativeFunction { | |||
|     JS_OBJECT(AggregateErrorConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AggregateErrorConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -15,15 +15,13 @@ AggregateErrorPrototype::AggregateErrorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AggregateErrorPrototype::initialize(Realm& realm) | ||||
| void AggregateErrorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_direct_property(vm.names.name, MUST_OR_THROW_OOM(PrimitiveString::create(vm, "AggregateError"sv)), attr); | ||||
|     define_direct_property(vm.names.name, MUST(PrimitiveString::create(vm, "AggregateError"sv)), attr); | ||||
|     define_direct_property(vm.names.message, PrimitiveString::create(vm, String {}), attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AggregateErrorPrototype final : public Object { | |||
|     JS_OBJECT(AggregateErrorPrototype, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AggregateErrorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -16,13 +16,11 @@ ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ArgumentsObject::initialize(Realm& realm) | ||||
| void ArgumentsObject::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     set_has_parameter_map(); | ||||
|     m_parameter_map = Object::create(realm, nullptr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void ArgumentsObject::visit_edges(Cell::Visitor& visitor) | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class ArgumentsObject final : public Object { | |||
|     JS_OBJECT(ArgumentsObject, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ArgumentsObject() override = default; | ||||
| 
 | ||||
|     Environment& environment() { return m_environment; } | ||||
|  |  | |||
|  | @ -19,10 +19,10 @@ ArrayBufferConstructor::ArrayBufferConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ArrayBufferConstructor::initialize(Realm& realm) | ||||
| void ArrayBufferConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 25.1.4.2 ArrayBuffer.prototype, https://tc39.es/ecma262/#sec-arraybuffer.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().array_buffer_prototype(), 0); | ||||
|  | @ -34,8 +34,6 @@ ThrowCompletionOr<void> ArrayBufferConstructor::initialize(Realm& realm) | |||
|     define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 25.1.3.1 ArrayBuffer ( length ), https://tc39.es/ecma262/#sec-arraybuffer-length
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class ArrayBufferConstructor final : public NativeFunction { | |||
|     JS_OBJECT(ArrayBufferConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ArrayBufferConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -19,10 +19,10 @@ ArrayBufferPrototype::ArrayBufferPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ArrayBufferPrototype::initialize(Realm& realm) | ||||
| void ArrayBufferPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.slice, slice, 2, attr); | ||||
|     define_native_function(realm, vm.names.transfer, transfer, 0, attr); | ||||
|  | @ -32,8 +32,6 @@ ThrowCompletionOr<void> ArrayBufferPrototype::initialize(Realm& realm) | |||
| 
 | ||||
|     // 25.1.5.4 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag
 | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.ArrayBuffer.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 25.1.5.3 ArrayBuffer.prototype.slice ( start, end ), https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype, | |||
|     JS_PROTOTYPE_OBJECT(ArrayBufferPrototype, ArrayBuffer, ArrayBuffer); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ArrayBufferPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -27,10 +27,10 @@ ArrayConstructor::ArrayConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ArrayConstructor::initialize(Realm& realm) | ||||
| void ArrayConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 23.1.2.4 Array.prototype, https://tc39.es/ecma262/#sec-array.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().array_prototype(), 0); | ||||
|  | @ -45,8 +45,6 @@ ThrowCompletionOr<void> ArrayConstructor::initialize(Realm& realm) | |||
|     define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 23.1.1.1 Array ( ...values ), https://tc39.es/ecma262/#sec-array
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class ArrayConstructor final : public NativeFunction { | |||
|     JS_OBJECT(ArrayConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ArrayConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -19,17 +19,15 @@ ArrayIteratorPrototype::ArrayIteratorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ArrayIteratorPrototype::initialize(Realm& realm) | ||||
| void ArrayIteratorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     define_native_function(realm, 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(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Array Iterator"sv)), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Array Iterator"sv)), Attribute::Configurable); | ||||
| } | ||||
| 
 | ||||
| // 23.1.5.2.1 %ArrayIteratorPrototype%.next ( ), https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototy | |||
|     JS_PROTOTYPE_OBJECT(ArrayIteratorPrototype, ArrayIterator, ArrayIterator); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ArrayIteratorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -33,10 +33,10 @@ ArrayPrototype::ArrayPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ArrayPrototype::initialize(Realm& realm) | ||||
| void ArrayPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Array::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
| 
 | ||||
|     define_native_function(realm, vm.names.at, at, 1, attr); | ||||
|  | @ -104,8 +104,6 @@ ThrowCompletionOr<void> ArrayPrototype::initialize(Realm& realm) | |||
|     MUST(unscopable_list->create_data_property_or_throw(vm.names.values, Value(true))); | ||||
| 
 | ||||
|     define_direct_property(vm.well_known_symbol_unscopables(), unscopable_list, Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 10.4.2.3 ArraySpeciesCreate ( originalArray, length ), https://tc39.es/ecma262/#sec-arrayspeciescreate
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class ArrayPrototype final : public Array { | |||
|     JS_OBJECT(ArrayPrototype, Array); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ArrayPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -22,12 +22,6 @@ AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, IteratorRecord sync_i | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncFromSyncIterator::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void AsyncFromSyncIterator::visit_edges(Cell::Visitor& visitor) | ||||
| { | ||||
|     Base::visit_edges(visitor); | ||||
|  |  | |||
|  | @ -19,7 +19,6 @@ class AsyncFromSyncIterator final : public Object { | |||
| public: | ||||
|     static NonnullGCPtr<AsyncFromSyncIterator> create(Realm&, IteratorRecord sync_iterator_record); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual ~AsyncFromSyncIterator() override = default; | ||||
| 
 | ||||
|     void visit_edges(Visitor& visitor) override; | ||||
|  |  | |||
|  | @ -19,17 +19,15 @@ AsyncFromSyncIteratorPrototype::AsyncFromSyncIteratorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncFromSyncIteratorPrototype::initialize(Realm& realm) | ||||
| void AsyncFromSyncIteratorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.next, next, 1, attr); | ||||
|     define_native_function(realm, vm.names.return_, return_, 1, attr); | ||||
|     define_native_function(realm, vm.names.throw_, throw_, 1, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 27.1.4.4 AsyncFromSyncIteratorContinuation ( result, promiseCapability ), https://tc39.es/ecma262/#sec-asyncfromsynciteratorcontinuation
 | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ class AsyncFromSyncIteratorPrototype final : public PrototypeObject<AsyncFromSyn | |||
|     JS_PROTOTYPE_OBJECT(AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator, AsyncFromSyncIterator); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncFromSyncIteratorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -17,17 +17,15 @@ AsyncFunctionConstructor::AsyncFunctionConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncFunctionConstructor::initialize(Realm& realm) | ||||
| void AsyncFunctionConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 27.7.2.2 AsyncFunction.prototype, https://tc39.es/ecma262/#sec-async-function-constructor-prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().async_function_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 27.7.1.1 AsyncFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-async-function-constructor-arguments
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AsyncFunctionConstructor final : public NativeFunction { | |||
|     JS_OBJECT(AsyncFunctionConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncFunctionConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -14,15 +14,13 @@ AsyncFunctionPrototype::AsyncFunctionPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncFunctionPrototype::initialize(Realm& realm) | ||||
| void AsyncFunctionPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::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(), PrimitiveString::create(vm, vm.names.AsyncFunction.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AsyncFunctionPrototype final : public Object { | |||
|     JS_OBJECT(AsyncFunctionPrototype, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncFunctionPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -17,18 +17,16 @@ AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(Realm& real | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncGeneratorFunctionConstructor::initialize(Realm& realm) | ||||
| void AsyncGeneratorFunctionConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::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, realm.intrinsics().async_generator_function_prototype(), 0); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 27.4.1.1 AsyncGeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-asyncgeneratorfunction
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AsyncGeneratorFunctionConstructor final : public NativeFunction { | |||
|     JS_OBJECT(AsyncGeneratorFunctionConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncGeneratorFunctionConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -16,10 +16,10 @@ AsyncGeneratorFunctionPrototype::AsyncGeneratorFunctionPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncGeneratorFunctionPrototype::initialize(Realm& realm) | ||||
| void AsyncGeneratorFunctionPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // The constructor cannot be set at this point since it has not been initialized.
 | ||||
| 
 | ||||
|  | @ -28,8 +28,6 @@ ThrowCompletionOr<void> AsyncGeneratorFunctionPrototype::initialize(Realm& realm | |||
| 
 | ||||
|     // 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(), PrimitiveString::create(vm, vm.names.AsyncGeneratorFunction.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AsyncGeneratorFunctionPrototype final : public PrototypeObject<AsyncGenera | |||
|     JS_PROTOTYPE_OBJECT(AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction, AsyncGeneratorFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncGeneratorFunctionPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -18,19 +18,17 @@ AsyncGeneratorPrototype::AsyncGeneratorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncGeneratorPrototype::initialize(Realm& realm) | ||||
| void AsyncGeneratorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.next, next, 1, attr); | ||||
|     define_native_function(realm, vm.names.return_, return_, 1, attr); | ||||
|     define_native_function(realm, vm.names.throw_, throw_, 1, attr); | ||||
| 
 | ||||
|     // 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(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "AsyncGenerator"sv)), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "AsyncGenerator"sv)), Attribute::Configurable); | ||||
| } | ||||
| 
 | ||||
| // 27.6.3.3 AsyncGeneratorValidate ( generator, generatorBrand ), https://tc39.es/ecma262/#sec-asyncgeneratorvalidate
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class AsyncGeneratorPrototype final : public PrototypeObject<AsyncGeneratorProto | |||
|     JS_PROTOTYPE_OBJECT(AsyncGeneratorPrototype, AsyncGenerator, AsyncGenerator) | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncGeneratorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -13,14 +13,12 @@ AsyncIteratorPrototype::AsyncIteratorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AsyncIteratorPrototype::initialize(Realm& realm) | ||||
| void AsyncIteratorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 27.1.3.1 %AsyncIteratorPrototype% [ @@asyncIterator ] ( ), https://tc39.es/ecma262/#sec-asynciteratorprototype-asynciterator
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AsyncIteratorPrototype final : public Object { | |||
|     JS_OBJECT(AsyncIteratorPrototype, Object) | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AsyncIteratorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -129,9 +129,9 @@ AtomicsObject::AtomicsObject(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> AtomicsObject::initialize(Realm& realm) | ||||
| void AtomicsObject::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|  | @ -147,9 +147,7 @@ ThrowCompletionOr<void> AtomicsObject::initialize(Realm& realm) | |||
|     define_native_function(realm, 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(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Atomics"sv)), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Atomics"sv)), Attribute::Configurable); | ||||
| } | ||||
| 
 | ||||
| // 25.4.3 Atomics.add ( typedArray, index, value ), https://tc39.es/ecma262/#sec-atomics.add
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class AtomicsObject : public Object { | |||
|     JS_OBJECT(AtomicsObject, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~AtomicsObject() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -21,10 +21,10 @@ BigIntConstructor::BigIntConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> BigIntConstructor::initialize(Realm& realm) | ||||
| void BigIntConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 21.2.2.3 BigInt.prototype, https://tc39.es/ecma262/#sec-bigint.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().bigint_prototype(), 0); | ||||
|  | @ -34,8 +34,6 @@ ThrowCompletionOr<void> BigIntConstructor::initialize(Realm& realm) | |||
|     define_native_function(realm, vm.names.asUintN, as_uint_n, 2, attr); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 21.2.1.1 BigInt ( value ), https://tc39.es/ecma262/#sec-bigint-constructor-number-value
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class BigIntConstructor final : public NativeFunction { | |||
|     JS_OBJECT(BigIntConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~BigIntConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -22,10 +22,10 @@ BigIntPrototype::BigIntPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> BigIntPrototype::initialize(Realm& realm) | ||||
| void BigIntPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.toString, to_string, 0, attr); | ||||
|     define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); | ||||
|  | @ -33,8 +33,6 @@ ThrowCompletionOr<void> BigIntPrototype::initialize(Realm& realm) | |||
| 
 | ||||
|     // 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(), PrimitiveString::create(vm, vm.names.BigInt.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // thisBigIntValue ( value ), https://tc39.es/ecma262/#thisbigintvalue
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class BigIntPrototype final : public Object { | |||
|     JS_OBJECT(BigIntPrototype, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~BigIntPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -17,17 +17,15 @@ BooleanConstructor::BooleanConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> BooleanConstructor::initialize(Realm& realm) | ||||
| void BooleanConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 20.3.2.1 Boolean.prototype, https://tc39.es/ecma262/#sec-boolean.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().boolean_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 20.3.1.1 Boolean ( value ), https://tc39.es/ecma262/#sec-boolean-constructor-boolean-value
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class BooleanConstructor final : public NativeFunction { | |||
|     JS_OBJECT(BooleanConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~BooleanConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -18,15 +18,13 @@ BooleanPrototype::BooleanPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> BooleanPrototype::initialize(Realm& realm) | ||||
| void BooleanPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(BooleanObject::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.toString, to_string, 0, attr); | ||||
|     define_native_function(realm, vm.names.valueOf, value_of, 0, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // thisBooleanValue ( value ), https://tc39.es/ecma262/#thisbooleanvalue
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class BooleanPrototype final : public BooleanObject { | |||
|     JS_OBJECT(BooleanPrototype, BooleanObject); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~BooleanPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -18,10 +18,10 @@ ConsoleObject::ConsoleObject(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ConsoleObject::initialize(Realm& realm) | ||||
| void ConsoleObject::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Enumerable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.assert, assert_, 0, attr); | ||||
|     define_native_function(realm, vm.names.clear, clear, 0, attr); | ||||
|  | @ -40,8 +40,6 @@ ThrowCompletionOr<void> ConsoleObject::initialize(Realm& realm) | |||
|     define_native_function(realm, vm.names.time, time, 0, attr); | ||||
|     define_native_function(realm, vm.names.timeLog, time_log, 0, attr); | ||||
|     define_native_function(realm, vm.names.timeEnd, time_end, 0, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 1.1.1. assert(condition, ...data), https://console.spec.whatwg.org/#assert
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class ConsoleObject final : public Object { | |||
|     JS_OBJECT(ConsoleObject, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ConsoleObject() override = default; | ||||
| 
 | ||||
|     Console& console() { return *m_console; } | ||||
|  |  | |||
|  | @ -19,17 +19,15 @@ DataViewConstructor::DataViewConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DataViewConstructor::initialize(Realm& realm) | ||||
| void DataViewConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 25.3.3.1 DataView.prototype, https://tc39.es/ecma262/#sec-dataview.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().data_view_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 25.3.2.1 DataView ( buffer [ , byteOffset [ , byteLength ] ] ), https://tc39.es/ecma262/#sec-dataview-buffer-byteoffset-bytelength
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class DataViewConstructor final : public NativeFunction { | |||
|     JS_OBJECT(DataViewConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~DataViewConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -15,10 +15,10 @@ DataViewPrototype::DataViewPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DataViewPrototype::initialize(Realm& realm) | ||||
| void DataViewPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
| 
 | ||||
|     define_native_function(realm, vm.names.getBigInt64, get_big_int_64, 1, attr); | ||||
|  | @ -48,8 +48,6 @@ ThrowCompletionOr<void> DataViewPrototype::initialize(Realm& realm) | |||
| 
 | ||||
|     // 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(), PrimitiveString::create(vm, vm.names.DataView.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 25.3.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type ), https://tc39.es/ecma262/#sec-getviewvalue
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataVi | |||
|     JS_PROTOTYPE_OBJECT(DataViewPrototype, DataView, DataView); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~DataViewPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -185,10 +185,10 @@ DateConstructor::DateConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DateConstructor::initialize(Realm& realm) | ||||
| void DateConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 21.4.3.3 Date.prototype, https://tc39.es/ecma262/#sec-date.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().date_prototype(), 0); | ||||
|  | @ -199,8 +199,6 @@ ThrowCompletionOr<void> DateConstructor::initialize(Realm& realm) | |||
|     define_native_function(realm, vm.names.UTC, utc, 7, attr); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(7), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 21.4.2.1 Date ( ...values ), https://tc39.es/ecma262/#sec-date
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class DateConstructor final : public NativeFunction { | |||
|     JS_OBJECT(DateConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~DateConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -34,10 +34,10 @@ DatePrototype::DatePrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DatePrototype::initialize(Realm& realm) | ||||
| void DatePrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.getDate, get_date, 0, attr); | ||||
|     define_native_function(realm, vm.names.getDay, get_day, 0, attr); | ||||
|  | @ -95,8 +95,6 @@ ThrowCompletionOr<void> DatePrototype::initialize(Realm& realm) | |||
|     // B.2.4.3 Date.prototype.toGMTString ( ), https://tc39.es/ecma262/#sec-date.prototype.togmtstring
 | ||||
|     // The initial value of the "toGMTString" property is %Date.prototype.toUTCString%, defined in 21.4.4.43.
 | ||||
|     define_direct_property(vm.names.toGMTString, get_without_side_effects(vm.names.toUTCString), attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // thisTimeValue ( value ), https://tc39.es/ecma262/#thistimevalue
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class DatePrototype final : public PrototypeObject<DatePrototype, Date> { | |||
|     JS_PROTOTYPE_OBJECT(DatePrototype, Date, Date); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~DatePrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -15,17 +15,15 @@ DisposableStackConstructor::DisposableStackConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DisposableStackConstructor::initialize(Realm& realm) | ||||
| void DisposableStackConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 26.2.2.1 DisposableStack.prototype, https://tc39.es/ecma262/#sec-finalization-registry.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().disposable_stack_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(0), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 11.3.1.1 DisposableStack ( ), https://tc39.es/proposal-explicit-resource-management/#sec-disposablestack
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class DisposableStackConstructor final : public NativeFunction { | |||
|     JS_OBJECT(DisposableStackConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~DisposableStackConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -17,10 +17,10 @@ DisposableStackPrototype::DisposableStackPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DisposableStackPrototype::initialize(Realm& realm) | ||||
| void DisposableStackPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
| 
 | ||||
|     define_native_accessor(realm, vm.names.disposed, disposed_getter, {}, attr); | ||||
|  | @ -35,8 +35,6 @@ ThrowCompletionOr<void> DisposableStackPrototype::initialize(Realm& realm) | |||
| 
 | ||||
|     // 11.3.3.8 DisposableStack.prototype [ @@toStringTag ], https://tc39.es/proposal-explicit-resource-management/#sec-disposablestack.prototype-@@toStringTag
 | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, vm.names.DisposableStack.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 11.3.3.1 get DisposableStack.prototype.disposed, https://tc39.es/proposal-explicit-resource-management/#sec-get-disposablestack.prototype.disposed
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class DisposableStackPrototype final : public PrototypeObject<DisposableStackPro | |||
|     JS_PROTOTYPE_OBJECT(DisposableStackPrototype, DisposableStack, DisposableStack); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~DisposableStackPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -101,10 +101,10 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(DeprecatedFlyString name, Dep | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ECMAScriptFunctionObject::initialize(Realm& realm) | ||||
| void ECMAScriptFunctionObject::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     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
 | ||||
|  | @ -118,7 +118,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::initialize(Realm& realm) | |||
|         Object* prototype = nullptr; | ||||
|         switch (m_kind) { | ||||
|         case FunctionKind::Normal: | ||||
|             prototype = MUST_OR_THROW_OOM(vm.heap().allocate<Object>(realm, realm.intrinsics().new_ordinary_function_prototype_object_shape())); | ||||
|             prototype = MUST(vm.heap().allocate<Object>(realm, realm.intrinsics().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: | ||||
|  | @ -136,8 +136,6 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::initialize(Realm& realm) | |||
|         if (m_kind != FunctionKind::Async) | ||||
|             define_direct_property(vm.names.prototype, prototype, Attribute::Writable); | ||||
|     } | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 10.2.1 [[Call]] ( thisArgument, argumentsList ), https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist
 | ||||
|  |  | |||
|  | @ -40,7 +40,7 @@ public: | |||
|     static NonnullGCPtr<ECMAScriptFunctionObject> create(Realm&, DeprecatedFlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Vector<DeprecatedFlyString> local_variables_names, 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<PropertyKey, PrivateName, Empty> class_field_initializer_name = {}); | ||||
|     static NonnullGCPtr<ECMAScriptFunctionObject> create(Realm&, DeprecatedFlyString name, Object& prototype, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Vector<DeprecatedFlyString> local_variables_names, 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<PropertyKey, PrivateName, Empty> class_field_initializer_name = {}); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ECMAScriptFunctionObject() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|  |  | |||
|  | @ -16,17 +16,15 @@ ErrorConstructor::ErrorConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ErrorConstructor::initialize(Realm& realm) | ||||
| void ErrorConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 20.5.2.1 Error.prototype, https://tc39.es/ecma262/#sec-error.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().error_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 20.5.1.1 Error ( message [ , options ] ), https://tc39.es/ecma262/#sec-error-message
 | ||||
|  | @ -69,17 +67,15 @@ ThrowCompletionOr<NonnullGCPtr<Object>> ErrorConstructor::construct(FunctionObje | |||
|     {                                                                                                                       \ | ||||
|     }                                                                                                                       \ | ||||
|                                                                                                                             \ | ||||
|     ThrowCompletionOr<void> ConstructorName::initialize(Realm& realm)                                                       \ | ||||
|     void ConstructorName::initialize(Realm& realm)                                                                          \ | ||||
|     {                                                                                                                       \ | ||||
|         auto& vm = this->vm();                                                                                              \ | ||||
|         MUST_OR_THROW_OOM(NativeFunction::initialize(realm));                                                               \ | ||||
|         Base::initialize(realm);                                                                                            \ | ||||
|                                                                                                                             \ | ||||
|         /* 20.5.6.2.1 NativeError.prototype, https://tc39.es/ecma262/#sec-nativeerror.prototype */                          \ | ||||
|         define_direct_property(vm.names.prototype, realm.intrinsics().snake_name##_prototype(), 0);                         \ | ||||
|                                                                                                                             \ | ||||
|         define_direct_property(vm.names.length, Value(1), Attribute::Configurable);                                         \ | ||||
|                                                                                                                             \ | ||||
|         return {};                                                                                                          \ | ||||
|     }                                                                                                                       \ | ||||
|                                                                                                                             \ | ||||
|     ConstructorName::~ConstructorName() = default;                                                                          \ | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class ErrorConstructor final : public NativeFunction { | |||
|     JS_OBJECT(ErrorConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ErrorConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  | @ -32,7 +32,7 @@ private: | |||
|         JS_OBJECT(ConstructorName, NativeFunction);                                                     \ | ||||
|                                                                                                         \ | ||||
|     public:                                                                                             \ | ||||
|         virtual ThrowCompletionOr<void> initialize(Realm&) override;                                    \ | ||||
|         virtual void initialize(Realm&) override;                                                       \ | ||||
|         virtual ~ConstructorName() override;                                                            \ | ||||
|         virtual ThrowCompletionOr<Value> call() override;                                               \ | ||||
|         virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override; \ | ||||
|  |  | |||
|  | @ -19,20 +19,18 @@ ErrorPrototype::ErrorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ErrorPrototype::initialize(Realm& realm) | ||||
| void ErrorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_direct_property(vm.names.name, MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Error"sv)), attr); | ||||
|     define_direct_property(vm.names.name, MUST(PrimitiveString::create(vm, "Error"sv)), attr); | ||||
|     define_direct_property(vm.names.message, PrimitiveString::create(vm, String {}), attr); | ||||
|     define_native_function(realm, vm.names.toString, to_string, 0, attr); | ||||
|     // Non standard property "stack"
 | ||||
|     // Every other engine seems to have this in some way or another, and the spec
 | ||||
|     // proposal for this is only Stage 1
 | ||||
|     define_native_accessor(realm, vm.names.stack, stack_getter, stack_setter, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 20.5.3.4 Error.prototype.toString ( ), https://tc39.es/ecma262/#sec-error.prototype.tostring
 | ||||
|  | @ -124,21 +122,19 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_setter) | |||
|     return TRY(this_object.create_data_property_or_throw(vm.names.stack, vm.argument(0))); | ||||
| } | ||||
| 
 | ||||
| #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType)                             \ | ||||
|     PrototypeName::PrototypeName(Realm& realm)                                                                       \ | ||||
|         : PrototypeObject(realm.intrinsics().error_prototype())                                                      \ | ||||
|     {                                                                                                                \ | ||||
|     }                                                                                                                \ | ||||
|                                                                                                                      \ | ||||
|     ThrowCompletionOr<void> PrototypeName::initialize(Realm& realm)                                                  \ | ||||
|     {                                                                                                                \ | ||||
|         auto& vm = this->vm();                                                                                       \ | ||||
|         MUST_OR_THROW_OOM(Base::initialize(realm));                                                                  \ | ||||
|         u8 attr = Attribute::Writable | Attribute::Configurable;                                                     \ | ||||
|         define_direct_property(vm.names.name, MUST_OR_THROW_OOM(PrimitiveString::create(vm, #ClassName##sv)), attr); \ | ||||
|         define_direct_property(vm.names.message, PrimitiveString::create(vm, String {}), attr);                      \ | ||||
|                                                                                                                      \ | ||||
|         return {};                                                                                                   \ | ||||
| #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType)                \ | ||||
|     PrototypeName::PrototypeName(Realm& realm)                                                          \ | ||||
|         : PrototypeObject(realm.intrinsics().error_prototype())                                         \ | ||||
|     {                                                                                                   \ | ||||
|     }                                                                                                   \ | ||||
|                                                                                                         \ | ||||
|     void PrototypeName::initialize(Realm& realm)                                                        \ | ||||
|     {                                                                                                   \ | ||||
|         auto& vm = this->vm();                                                                          \ | ||||
|         Base::initialize(realm);                                                                        \ | ||||
|         u8 attr = Attribute::Writable | Attribute::Configurable;                                        \ | ||||
|         define_direct_property(vm.names.name, MUST(PrimitiveString::create(vm, #ClassName##sv)), attr); \ | ||||
|         define_direct_property(vm.names.message, PrimitiveString::create(vm, String {}), attr);         \ | ||||
|     } | ||||
| 
 | ||||
| JS_ENUMERATE_NATIVE_ERRORS | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class ErrorPrototype final : public PrototypeObject<ErrorPrototype, Error> { | |||
|     JS_PROTOTYPE_OBJECT(ErrorPrototype, Error, Error); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ErrorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  | @ -32,7 +32,7 @@ private: | |||
|         JS_PROTOTYPE_OBJECT(PrototypeName, ClassName, ClassName);                             \ | ||||
|                                                                                               \ | ||||
|     public:                                                                                   \ | ||||
|         virtual ThrowCompletionOr<void> initialize(Realm&) override;                          \ | ||||
|         virtual void initialize(Realm&) override;                                             \ | ||||
|         virtual ~PrototypeName() override = default;                                          \ | ||||
|                                                                                               \ | ||||
|     private:                                                                                  \ | ||||
|  |  | |||
|  | @ -18,17 +18,15 @@ FinalizationRegistryConstructor::FinalizationRegistryConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> FinalizationRegistryConstructor::initialize(Realm& realm) | ||||
| void FinalizationRegistryConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 26.2.2.1 FinalizationRegistry.prototype, https://tc39.es/ecma262/#sec-finalization-registry.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().finalization_registry_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 26.2.1.1 FinalizationRegistry ( cleanupCallback ), https://tc39.es/ecma262/#sec-finalization-registry-cleanup-callback
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class FinalizationRegistryConstructor final : public NativeFunction { | |||
|     JS_OBJECT(FinalizationRegistryConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~FinalizationRegistryConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -15,10 +15,10 @@ FinalizationRegistryPrototype::FinalizationRegistryPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> FinalizationRegistryPrototype::initialize(Realm& realm) | ||||
| void FinalizationRegistryPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
| 
 | ||||
|     define_native_function(realm, vm.names.cleanupSome, cleanup_some, 0, attr); | ||||
|  | @ -27,8 +27,6 @@ ThrowCompletionOr<void> FinalizationRegistryPrototype::initialize(Realm& realm) | |||
| 
 | ||||
|     // 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(), PrimitiveString::create(vm, vm.names.FinalizationRegistry.as_string()), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class FinalizationRegistryPrototype final : public PrototypeObject<FinalizationR | |||
|     JS_PROTOTYPE_OBJECT(FinalizationRegistryPrototype, FinalizationRegistry, FinalizationRegistry); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~FinalizationRegistryPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -23,17 +23,15 @@ FunctionConstructor::FunctionConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> FunctionConstructor::initialize(Realm& realm) | ||||
| void FunctionConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 20.2.2.2 Function.prototype, https://tc39.es/ecma262/#sec-function.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().function_prototype(), 0); | ||||
| 
 | ||||
|     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 20.2.1.1.1 CreateDynamicFunction ( constructor, newTarget, kind, args ), https://tc39.es/ecma262/#sec-createdynamicfunction
 | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ class FunctionConstructor final : public NativeFunction { | |||
| public: | ||||
|     static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(VM&, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~FunctionConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -20,7 +20,6 @@ class FunctionObject : public Object { | |||
| 
 | ||||
| public: | ||||
|     virtual ~FunctionObject() = default; | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override { return {}; } | ||||
| 
 | ||||
|     // Table 7: Additional Essential Internal Methods of Function Objects, https://tc39.es/ecma262/#table-additional-essential-internal-methods-of-function-objects
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,10 +25,10 @@ FunctionPrototype::FunctionPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> FunctionPrototype::initialize(Realm& realm) | ||||
| void FunctionPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.apply, apply, 2, attr); | ||||
|     define_native_function(realm, vm.names.bind, bind, 1, attr); | ||||
|  | @ -37,8 +37,6 @@ ThrowCompletionOr<void> FunctionPrototype::initialize(Realm& realm) | |||
|     define_native_function(realm, vm.well_known_symbol_has_instance(), symbol_has_instance, 1, 0); | ||||
|     define_direct_property(vm.names.length, Value(0), Attribute::Configurable); | ||||
|     define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<Value> FunctionPrototype::internal_call(Value, MarkedVector<Value>) | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class FunctionPrototype final : public FunctionObject { | |||
|     JS_OBJECT(FunctionPrototype, FunctionObject); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~FunctionPrototype() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|  |  | |||
|  | @ -16,17 +16,15 @@ GeneratorFunctionConstructor::GeneratorFunctionConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> GeneratorFunctionConstructor::initialize(Realm& realm) | ||||
| void GeneratorFunctionConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::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, realm.intrinsics().generator_function_prototype(), 0); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 27.3.1.1 GeneratorFunction ( p1, p2, … , pn, body ), https://tc39.es/ecma262/#sec-generatorfunction
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class GeneratorFunctionConstructor final : public NativeFunction { | |||
|     JS_OBJECT(GeneratorFunctionConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~GeneratorFunctionConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -15,17 +15,15 @@ GeneratorFunctionPrototype::GeneratorFunctionPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> GeneratorFunctionPrototype::initialize(Realm& realm) | ||||
| void GeneratorFunctionPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     // 27.3.3.2 GeneratorFunction.prototype.prototype, https://tc39.es/ecma262/#sec-generatorfunction.prototype.prototype
 | ||||
|     define_direct_property(vm.names.prototype, realm.intrinsics().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(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "GeneratorFunction"sv)), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "GeneratorFunction"sv)), Attribute::Configurable); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class GeneratorFunctionPrototype final : public Object { | |||
|     JS_OBJECT(GeneratorFunctionPrototype, Object); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~GeneratorFunctionPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -14,19 +14,17 @@ GeneratorPrototype::GeneratorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> GeneratorPrototype::initialize(Realm& realm) | ||||
| void GeneratorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.next, next, 1, attr); | ||||
|     define_native_function(realm, vm.names.return_, return_, 1, attr); | ||||
|     define_native_function(realm, vm.names.throw_, throw_, 1, attr); | ||||
| 
 | ||||
|     // 27.5.1.5 Generator.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-generator.prototype-@@tostringtag
 | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Generator"sv)), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Generator"sv)), Attribute::Configurable); | ||||
| } | ||||
| 
 | ||||
| // 27.5.1.2 Generator.prototype.next ( value ), https://tc39.es/ecma262/#sec-generator.prototype.next
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, Gene | |||
|     JS_PROTOTYPE_OBJECT(GeneratorPrototype, GeneratorObject, Generator); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~GeneratorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -194,17 +194,15 @@ Object& set_default_global_bindings(Realm& realm) | |||
|     return global; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> GlobalObject::initialize(Realm& realm) | ||||
| void GlobalObject::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Base::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|     // Non-standard
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.gc, gc, 0, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| GlobalObject::~GlobalObject() = default; | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ class GlobalObject : public Object { | |||
|     friend class Intrinsics; | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~GlobalObject() override; | ||||
| 
 | ||||
| protected: | ||||
|  |  | |||
|  | @ -22,13 +22,11 @@ CollatorCompareFunction::CollatorCompareFunction(Realm& realm, Collator& collato | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> CollatorCompareFunction::initialize(Realm&) | ||||
| void CollatorCompareFunction::initialize(Realm&) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     define_direct_property(vm.names.length, Value(2), Attribute::Configurable); | ||||
|     define_direct_property(vm.names.name, PrimitiveString::create(vm, String {}), Attribute::Configurable); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 10.3.3.2 CompareStrings ( collator, x, y ), https://tc39.es/ecma402/#sec-collator-comparestrings
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ class CollatorCompareFunction : public NativeFunction { | |||
| public: | ||||
|     static NonnullGCPtr<CollatorCompareFunction> create(Realm&, Collator&); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~CollatorCompareFunction() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -135,9 +135,9 @@ CollatorConstructor::CollatorConstructor(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> CollatorConstructor::initialize(Realm& realm) | ||||
| void CollatorConstructor::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -147,8 +147,6 @@ ThrowCompletionOr<void> CollatorConstructor::initialize(Realm& realm) | |||
| 
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 10.1.1 Intl.Collator ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.collator
 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class CollatorConstructor final : public NativeFunction { | |||
|     JS_OBJECT(CollatorConstructor, NativeFunction); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~CollatorConstructor() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> call() override; | ||||
|  |  | |||
|  | @ -17,20 +17,18 @@ CollatorPrototype::CollatorPrototype(Realm& realm) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> CollatorPrototype::initialize(Realm& realm) | ||||
| void CollatorPrototype::initialize(Realm& realm) | ||||
| { | ||||
|     MUST_OR_THROW_OOM(Object::initialize(realm)); | ||||
|     Base::initialize(realm); | ||||
| 
 | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|     // 10.3.2 Intl.Collator.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.collator.prototype-@@tostringtag
 | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Intl.Collator"sv)), Attribute::Configurable); | ||||
|     define_direct_property(vm.well_known_symbol_to_string_tag(), MUST(PrimitiveString::create(vm, "Intl.Collator"sv)), Attribute::Configurable); | ||||
| 
 | ||||
|     u8 attr = Attribute::Writable | Attribute::Configurable; | ||||
|     define_native_accessor(realm, vm.names.compare, compare_getter, {}, attr); | ||||
|     define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); | ||||
| 
 | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| // 10.3.3 get Intl.Collator.prototype.compare, https://tc39.es/ecma402/#sec-intl.collator.prototype.compare
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collat | |||
|     JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator); | ||||
| 
 | ||||
| public: | ||||
|     virtual ThrowCompletionOr<void> initialize(Realm&) override; | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~CollatorPrototype() override = default; | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling