diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
97 files changed, 784 insertions, 785 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index b912fae44c..96f72f372d 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -1117,6 +1117,7 @@ Object* create_mapped_arguments_object(VM& vm, FunctionObject& function, Vector< // 2. Let p be MakeArgSetter(name, env). // 3. Perform ! map.[[DefineOwnProperty]](! ToString(𝔽(index)), PropertyDescriptor { [[Set]]: p, [[Get]]: g, [[Enumerable]]: false, [[Configurable]]: true }). object->parameter_map().define_native_accessor( + realm, PropertyKey { index }, [&environment, name](VM& vm) -> ThrowCompletionOr<Value> { return MUST(environment.get_binding_value(vm, name, false)); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp index 94c56f6d62..64519d44dd 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp @@ -27,10 +27,10 @@ void ArrayBufferConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().array_buffer_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.isView, is_view, 1, attr); + define_native_function(realm, vm.names.isView, is_view, 1, attr); // 25.1.5.4 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp index 23d8021d3a..d312b5c5c5 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp @@ -24,8 +24,8 @@ void ArrayBufferPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.slice, slice, 2, attr); - define_native_accessor(vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable); + define_native_function(realm, vm.names.slice, slice, 2, attr); + define_native_accessor(realm, vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable); // 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(), js_string(vm, vm.names.ArrayBuffer.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp index c06637492c..c025cf0a88 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -30,12 +30,12 @@ void ArrayConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().array_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.isArray, is_array, 1, attr); - define_native_function(vm.names.of, of, 0, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.isArray, is_array, 1, attr); + define_native_function(realm, vm.names.of, of, 0, attr); // 23.1.2.5 get Array [ @@species ], https://tc39.es/ecma262/#sec-get-array-@@species - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp index 2b179c49e0..ce00356f78 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp @@ -24,7 +24,7 @@ void ArrayIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); - define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); + 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(), js_string(vm, "Array Iterator"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 1218fcd175..d34d388260 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -39,46 +39,46 @@ void ArrayPrototype::initialize(Realm& realm) Array::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.at, at, 1, attr); - define_native_function(vm.names.concat, concat, 1, attr); - define_native_function(vm.names.copyWithin, copy_within, 2, attr); - define_native_function(vm.names.entries, entries, 0, attr); - define_native_function(vm.names.every, every, 1, attr); - define_native_function(vm.names.fill, fill, 1, attr); - define_native_function(vm.names.filter, filter, 1, attr); - define_native_function(vm.names.find, find, 1, attr); - define_native_function(vm.names.findIndex, find_index, 1, attr); - define_native_function(vm.names.findLast, find_last, 1, attr); - define_native_function(vm.names.findLastIndex, find_last_index, 1, attr); - define_native_function(vm.names.flat, flat, 0, attr); - define_native_function(vm.names.flatMap, flat_map, 1, attr); - define_native_function(vm.names.forEach, for_each, 1, attr); - define_native_function(vm.names.group, group, 1, attr); - define_native_function(vm.names.groupToMap, group_to_map, 1, attr); - define_native_function(vm.names.includes, includes, 1, attr); - define_native_function(vm.names.indexOf, index_of, 1, attr); - define_native_function(vm.names.join, join, 1, attr); - define_native_function(vm.names.keys, keys, 0, attr); - define_native_function(vm.names.lastIndexOf, last_index_of, 1, attr); - define_native_function(vm.names.map, map, 1, attr); - define_native_function(vm.names.pop, pop, 0, attr); - define_native_function(vm.names.push, push, 1, attr); - define_native_function(vm.names.reduce, reduce, 1, attr); - define_native_function(vm.names.reduceRight, reduce_right, 1, attr); - define_native_function(vm.names.reverse, reverse, 0, attr); - define_native_function(vm.names.shift, shift, 0, attr); - define_native_function(vm.names.slice, slice, 2, attr); - define_native_function(vm.names.some, some, 1, attr); - define_native_function(vm.names.sort, sort, 1, attr); - define_native_function(vm.names.splice, splice, 2, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toReversed, to_reversed, 0, attr); - define_native_function(vm.names.toSorted, to_sorted, 1, attr); - define_native_function(vm.names.toSpliced, to_spliced, 2, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.unshift, unshift, 1, attr); - define_native_function(vm.names.values, values, 0, attr); - define_native_function(vm.names.with, with, 2, attr); + define_native_function(realm, vm.names.at, at, 1, attr); + define_native_function(realm, vm.names.concat, concat, 1, attr); + define_native_function(realm, vm.names.copyWithin, copy_within, 2, attr); + define_native_function(realm, vm.names.entries, entries, 0, attr); + define_native_function(realm, vm.names.every, every, 1, attr); + define_native_function(realm, vm.names.fill, fill, 1, attr); + define_native_function(realm, vm.names.filter, filter, 1, attr); + define_native_function(realm, vm.names.find, find, 1, attr); + define_native_function(realm, vm.names.findIndex, find_index, 1, attr); + define_native_function(realm, vm.names.findLast, find_last, 1, attr); + define_native_function(realm, vm.names.findLastIndex, find_last_index, 1, attr); + define_native_function(realm, vm.names.flat, flat, 0, attr); + define_native_function(realm, vm.names.flatMap, flat_map, 1, attr); + define_native_function(realm, vm.names.forEach, for_each, 1, attr); + define_native_function(realm, vm.names.group, group, 1, attr); + define_native_function(realm, vm.names.groupToMap, group_to_map, 1, attr); + define_native_function(realm, vm.names.includes, includes, 1, attr); + define_native_function(realm, vm.names.indexOf, index_of, 1, attr); + define_native_function(realm, vm.names.join, join, 1, attr); + define_native_function(realm, vm.names.keys, keys, 0, attr); + define_native_function(realm, vm.names.lastIndexOf, last_index_of, 1, attr); + define_native_function(realm, vm.names.map, map, 1, attr); + define_native_function(realm, vm.names.pop, pop, 0, attr); + define_native_function(realm, vm.names.push, push, 1, attr); + define_native_function(realm, vm.names.reduce, reduce, 1, attr); + define_native_function(realm, vm.names.reduceRight, reduce_right, 1, attr); + define_native_function(realm, vm.names.reverse, reverse, 0, attr); + define_native_function(realm, vm.names.shift, shift, 0, attr); + define_native_function(realm, vm.names.slice, slice, 2, attr); + define_native_function(realm, vm.names.some, some, 1, attr); + define_native_function(realm, vm.names.sort, sort, 1, attr); + define_native_function(realm, vm.names.splice, splice, 2, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toReversed, to_reversed, 0, attr); + define_native_function(realm, vm.names.toSorted, to_sorted, 1, attr); + define_native_function(realm, vm.names.toSpliced, to_spliced, 2, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.unshift, unshift, 1, attr); + define_native_function(realm, vm.names.values, values, 0, attr); + define_native_function(realm, vm.names.with, with, 2, attr); // Use define_direct_property here instead of define_native_function so that // Object.is(Array.prototype[Symbol.iterator], Array.prototype.values) diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index fc886df38e..99f10dabfe 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp @@ -25,9 +25,9 @@ void AsyncFromSyncIteratorPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.next, next, 1, attr); - define_native_function(vm.names.return_, return_, 1, attr); - define_native_function(vm.names.throw_, throw_, 1, attr); + 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.1.4.4 AsyncFromSyncIteratorContinuation ( result, promiseCapability ), https://tc39.es/ecma262/#sec-asyncfromsynciteratorcontinuation diff --git a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp index 508f35023d..20a4bc3862 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp @@ -18,7 +18,7 @@ void AsyncIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(*vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr); + define_native_function(realm, *vm.well_known_symbol_async_iterator(), symbol_async_iterator, 0, attr); } // 27.1.3.1 %AsyncIteratorPrototype% [ @@asyncIterator ] ( ), https://tc39.es/ecma262/#sec-asynciteratorprototype-asynciterator diff --git a/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp b/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp index 4889ed0a7b..74c5a85561 100644 --- a/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp @@ -133,16 +133,16 @@ void AtomicsObject::initialize(Realm& realm) auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.add, add, 3, attr); - define_native_function(vm.names.and_, and_, 3, attr); - define_native_function(vm.names.compareExchange, compare_exchange, 4, attr); - define_native_function(vm.names.exchange, exchange, 3, attr); - define_native_function(vm.names.isLockFree, is_lock_free, 1, attr); - define_native_function(vm.names.load, load, 2, attr); - define_native_function(vm.names.or_, or_, 3, attr); - define_native_function(vm.names.store, store, 3, attr); - define_native_function(vm.names.sub, sub, 3, attr); - define_native_function(vm.names.xor_, xor_, 3, attr); + define_native_function(realm, vm.names.add, add, 3, attr); + define_native_function(realm, vm.names.and_, and_, 3, attr); + define_native_function(realm, vm.names.compareExchange, compare_exchange, 4, attr); + define_native_function(realm, vm.names.exchange, exchange, 3, attr); + define_native_function(realm, vm.names.isLockFree, is_lock_free, 1, attr); + define_native_function(realm, vm.names.load, load, 2, attr); + define_native_function(realm, vm.names.or_, or_, 3, attr); + define_native_function(realm, vm.names.store, store, 3, attr); + define_native_function(realm, vm.names.sub, sub, 3, attr); + 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(), js_string(vm, "Atomics"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp index 9359a92afd..6564178d65 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -31,8 +31,8 @@ void BigIntConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().bigint_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.asIntN, as_int_n, 2, attr); - define_native_function(vm.names.asUintN, as_uint_n, 2, attr); + define_native_function(realm, vm.names.asIntN, as_int_n, 2, attr); + define_native_function(realm, vm.names.asUintN, as_uint_n, 2, attr); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp index 1e75e493f5..1f8e9963eb 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp @@ -27,9 +27,9 @@ void BigIntPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); // 21.2.3.5 BigInt.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-bigint.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.BigInt.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp index 95ae6c21ae..836cd6e0f9 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -22,8 +22,8 @@ void BooleanPrototype::initialize(Realm& realm) auto& vm = this->vm(); BooleanObject::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); } // 20.3.3.2 Boolean.prototype.toString ( ), https://tc39.es/ecma262/#sec-boolean.prototype.tostring diff --git a/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp b/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp index ffa78e123b..b44eb60fe3 100644 --- a/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp @@ -22,22 +22,22 @@ void ConsoleObject::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Enumerable | Attribute::Configurable; - define_native_function(vm.names.log, log, 0, attr); - define_native_function(vm.names.debug, debug, 0, attr); - define_native_function(vm.names.info, info, 0, attr); - define_native_function(vm.names.warn, warn, 0, attr); - define_native_function(vm.names.error, error, 0, attr); - define_native_function(vm.names.trace, trace, 0, attr); - define_native_function(vm.names.count, count, 0, attr); - define_native_function(vm.names.countReset, count_reset, 0, attr); - define_native_function(vm.names.clear, clear, 0, attr); - define_native_function(vm.names.assert, assert_, 0, attr); - define_native_function(vm.names.group, group, 0, attr); - define_native_function(vm.names.groupCollapsed, group_collapsed, 0, attr); - define_native_function(vm.names.groupEnd, group_end, 0, attr); - define_native_function(vm.names.time, time, 0, attr); - define_native_function(vm.names.timeLog, time_log, 0, attr); - define_native_function(vm.names.timeEnd, time_end, 0, attr); + define_native_function(realm, vm.names.log, log, 0, attr); + define_native_function(realm, vm.names.debug, debug, 0, attr); + define_native_function(realm, vm.names.info, info, 0, attr); + define_native_function(realm, vm.names.warn, warn, 0, attr); + define_native_function(realm, vm.names.error, error, 0, attr); + define_native_function(realm, vm.names.trace, trace, 0, attr); + define_native_function(realm, vm.names.count, count, 0, attr); + define_native_function(realm, vm.names.countReset, count_reset, 0, attr); + define_native_function(realm, vm.names.clear, clear, 0, attr); + define_native_function(realm, vm.names.assert, assert_, 0, attr); + define_native_function(realm, vm.names.group, group, 0, attr); + define_native_function(realm, vm.names.groupCollapsed, group_collapsed, 0, attr); + define_native_function(realm, vm.names.groupEnd, group_end, 0, attr); + 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); } // 1.1.6. log(...data), https://console.spec.whatwg.org/#log diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp index 9346e50ffb..16fadda126 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -21,30 +21,30 @@ void DataViewPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.getBigInt64, get_big_int_64, 1, attr); - define_native_function(vm.names.getBigUint64, get_big_uint_64, 1, attr); - define_native_function(vm.names.getFloat32, get_float_32, 1, attr); - define_native_function(vm.names.getFloat64, get_float_64, 1, attr); - define_native_function(vm.names.getInt8, get_int_8, 1, attr); - define_native_function(vm.names.getInt16, get_int_16, 1, attr); - define_native_function(vm.names.getInt32, get_int_32, 1, attr); - define_native_function(vm.names.getUint8, get_uint_8, 1, attr); - define_native_function(vm.names.getUint16, get_uint_16, 1, attr); - define_native_function(vm.names.getUint32, get_uint_32, 1, attr); - define_native_function(vm.names.setBigInt64, set_big_int_64, 2, attr); - define_native_function(vm.names.setBigUint64, set_big_uint_64, 2, attr); - define_native_function(vm.names.setFloat32, set_float_32, 2, attr); - define_native_function(vm.names.setFloat64, set_float_64, 2, attr); - define_native_function(vm.names.setInt8, set_int_8, 2, attr); - define_native_function(vm.names.setInt16, set_int_16, 2, attr); - define_native_function(vm.names.setInt32, set_int_32, 2, attr); - define_native_function(vm.names.setUint8, set_uint_8, 2, attr); - define_native_function(vm.names.setUint16, set_uint_16, 2, attr); - define_native_function(vm.names.setUint32, set_uint_32, 2, attr); - - define_native_accessor(vm.names.buffer, buffer_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.byteOffset, byte_offset_getter, {}, Attribute::Configurable); + define_native_function(realm, vm.names.getBigInt64, get_big_int_64, 1, attr); + define_native_function(realm, vm.names.getBigUint64, get_big_uint_64, 1, attr); + define_native_function(realm, vm.names.getFloat32, get_float_32, 1, attr); + define_native_function(realm, vm.names.getFloat64, get_float_64, 1, attr); + define_native_function(realm, vm.names.getInt8, get_int_8, 1, attr); + define_native_function(realm, vm.names.getInt16, get_int_16, 1, attr); + define_native_function(realm, vm.names.getInt32, get_int_32, 1, attr); + define_native_function(realm, vm.names.getUint8, get_uint_8, 1, attr); + define_native_function(realm, vm.names.getUint16, get_uint_16, 1, attr); + define_native_function(realm, vm.names.getUint32, get_uint_32, 1, attr); + define_native_function(realm, vm.names.setBigInt64, set_big_int_64, 2, attr); + define_native_function(realm, vm.names.setBigUint64, set_big_uint_64, 2, attr); + define_native_function(realm, vm.names.setFloat32, set_float_32, 2, attr); + define_native_function(realm, vm.names.setFloat64, set_float_64, 2, attr); + define_native_function(realm, vm.names.setInt8, set_int_8, 2, attr); + define_native_function(realm, vm.names.setInt16, set_int_16, 2, attr); + define_native_function(realm, vm.names.setInt32, set_int_32, 2, attr); + define_native_function(realm, vm.names.setUint8, set_uint_8, 2, attr); + define_native_function(realm, vm.names.setUint16, set_uint_16, 2, attr); + define_native_function(realm, vm.names.setUint32, set_uint_32, 2, attr); + + define_native_accessor(realm, vm.names.buffer, buffer_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.byteLength, byte_length_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.byteOffset, byte_offset_getter, {}, Attribute::Configurable); // 25.3.4.25 DataView.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-dataview.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.DataView.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp index 7fd53f1810..1c7e80ae28 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -176,9 +176,9 @@ void DateConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().date_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.now, now, 0, attr); - define_native_function(vm.names.parse, parse, 1, attr); - define_native_function(vm.names.UTC, utc, 7, attr); + define_native_function(realm, vm.names.now, now, 0, attr); + define_native_function(realm, vm.names.parse, parse, 1, attr); + define_native_function(realm, vm.names.UTC, utc, 7, attr); define_direct_property(vm.names.length, Value(7), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index ffabb25ac0..c49512fab7 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -40,58 +40,58 @@ void DatePrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.getDate, get_date, 0, attr); - define_native_function(vm.names.getDay, get_day, 0, attr); - define_native_function(vm.names.getFullYear, get_full_year, 0, attr); - define_native_function(vm.names.getHours, get_hours, 0, attr); - define_native_function(vm.names.getMilliseconds, get_milliseconds, 0, attr); - define_native_function(vm.names.getMinutes, get_minutes, 0, attr); - define_native_function(vm.names.getMonth, get_month, 0, attr); - define_native_function(vm.names.getSeconds, get_seconds, 0, attr); - define_native_function(vm.names.getTime, get_time, 0, attr); - define_native_function(vm.names.getTimezoneOffset, get_timezone_offset, 0, attr); - define_native_function(vm.names.getUTCDate, get_utc_date, 0, attr); - define_native_function(vm.names.getUTCDay, get_utc_day, 0, attr); - define_native_function(vm.names.getUTCFullYear, get_utc_full_year, 0, attr); - define_native_function(vm.names.getUTCHours, get_utc_hours, 0, attr); - define_native_function(vm.names.getUTCMilliseconds, get_utc_milliseconds, 0, attr); - define_native_function(vm.names.getUTCMinutes, get_utc_minutes, 0, attr); - define_native_function(vm.names.getUTCMonth, get_utc_month, 0, attr); - define_native_function(vm.names.getUTCSeconds, get_utc_seconds, 0, attr); - define_native_function(vm.names.setDate, set_date, 1, attr); - define_native_function(vm.names.setFullYear, set_full_year, 3, attr); - define_native_function(vm.names.setHours, set_hours, 4, attr); - define_native_function(vm.names.setMilliseconds, set_milliseconds, 1, attr); - define_native_function(vm.names.setMinutes, set_minutes, 3, attr); - define_native_function(vm.names.setMonth, set_month, 2, attr); - define_native_function(vm.names.setSeconds, set_seconds, 2, attr); - define_native_function(vm.names.setTime, set_time, 1, attr); - define_native_function(vm.names.setUTCDate, set_utc_date, 1, attr); - define_native_function(vm.names.setUTCFullYear, set_utc_full_year, 3, attr); - define_native_function(vm.names.setUTCHours, set_utc_hours, 4, attr); - define_native_function(vm.names.setUTCMilliseconds, set_utc_milliseconds, 1, attr); - define_native_function(vm.names.setUTCMinutes, set_utc_minutes, 3, attr); - define_native_function(vm.names.setUTCMonth, set_utc_month, 2, attr); - define_native_function(vm.names.setUTCSeconds, set_utc_seconds, 2, attr); - define_native_function(vm.names.toDateString, to_date_string, 0, attr); - define_native_function(vm.names.toISOString, to_iso_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 1, attr); - define_native_function(vm.names.toLocaleDateString, to_locale_date_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toLocaleTimeString, to_locale_time_string, 0, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toTemporalInstant, to_temporal_instant, 0, attr); - define_native_function(vm.names.toTimeString, to_time_string, 0, attr); - define_native_function(vm.names.toUTCString, to_utc_string, 0, attr); - - define_native_function(vm.names.getYear, get_year, 0, attr); - define_native_function(vm.names.setYear, set_year, 1, attr); + define_native_function(realm, vm.names.getDate, get_date, 0, attr); + define_native_function(realm, vm.names.getDay, get_day, 0, attr); + define_native_function(realm, vm.names.getFullYear, get_full_year, 0, attr); + define_native_function(realm, vm.names.getHours, get_hours, 0, attr); + define_native_function(realm, vm.names.getMilliseconds, get_milliseconds, 0, attr); + define_native_function(realm, vm.names.getMinutes, get_minutes, 0, attr); + define_native_function(realm, vm.names.getMonth, get_month, 0, attr); + define_native_function(realm, vm.names.getSeconds, get_seconds, 0, attr); + define_native_function(realm, vm.names.getTime, get_time, 0, attr); + define_native_function(realm, vm.names.getTimezoneOffset, get_timezone_offset, 0, attr); + define_native_function(realm, vm.names.getUTCDate, get_utc_date, 0, attr); + define_native_function(realm, vm.names.getUTCDay, get_utc_day, 0, attr); + define_native_function(realm, vm.names.getUTCFullYear, get_utc_full_year, 0, attr); + define_native_function(realm, vm.names.getUTCHours, get_utc_hours, 0, attr); + define_native_function(realm, vm.names.getUTCMilliseconds, get_utc_milliseconds, 0, attr); + define_native_function(realm, vm.names.getUTCMinutes, get_utc_minutes, 0, attr); + define_native_function(realm, vm.names.getUTCMonth, get_utc_month, 0, attr); + define_native_function(realm, vm.names.getUTCSeconds, get_utc_seconds, 0, attr); + define_native_function(realm, vm.names.setDate, set_date, 1, attr); + define_native_function(realm, vm.names.setFullYear, set_full_year, 3, attr); + define_native_function(realm, vm.names.setHours, set_hours, 4, attr); + define_native_function(realm, vm.names.setMilliseconds, set_milliseconds, 1, attr); + define_native_function(realm, vm.names.setMinutes, set_minutes, 3, attr); + define_native_function(realm, vm.names.setMonth, set_month, 2, attr); + define_native_function(realm, vm.names.setSeconds, set_seconds, 2, attr); + define_native_function(realm, vm.names.setTime, set_time, 1, attr); + define_native_function(realm, vm.names.setUTCDate, set_utc_date, 1, attr); + define_native_function(realm, vm.names.setUTCFullYear, set_utc_full_year, 3, attr); + define_native_function(realm, vm.names.setUTCHours, set_utc_hours, 4, attr); + define_native_function(realm, vm.names.setUTCMilliseconds, set_utc_milliseconds, 1, attr); + define_native_function(realm, vm.names.setUTCMinutes, set_utc_minutes, 3, attr); + define_native_function(realm, vm.names.setUTCMonth, set_utc_month, 2, attr); + define_native_function(realm, vm.names.setUTCSeconds, set_utc_seconds, 2, attr); + define_native_function(realm, vm.names.toDateString, to_date_string, 0, attr); + define_native_function(realm, vm.names.toISOString, to_iso_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 1, attr); + define_native_function(realm, vm.names.toLocaleDateString, to_locale_date_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toLocaleTimeString, to_locale_time_string, 0, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toTemporalInstant, to_temporal_instant, 0, attr); + define_native_function(realm, vm.names.toTimeString, to_time_string, 0, attr); + define_native_function(realm, vm.names.toUTCString, to_utc_string, 0, attr); + + define_native_function(realm, vm.names.getYear, get_year, 0, attr); + define_native_function(realm, vm.names.setYear, set_year, 1, attr); // 21.4.4.45 Date.prototype [ @@toPrimitive ] ( hint ), https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive - define_native_function(*vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); + define_native_function(realm, *vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); // Aliases. - define_native_function(vm.names.valueOf, get_time, 0, attr); + define_native_function(realm, vm.names.valueOf, get_time, 0, attr); // 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. diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index ca4e6b921a..ec00be85fd 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -27,11 +27,11 @@ void ErrorPrototype::initialize(Realm& realm) u8 attr = Attribute::Writable | Attribute::Configurable; define_direct_property(vm.names.name, js_string(vm, "Error"), attr); define_direct_property(vm.names.message, js_string(vm, ""), attr); - define_native_function(vm.names.toString, to_string, 0, 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(vm.names.stack, stack_getter, stack_setter, attr); + define_native_accessor(realm, vm.names.stack, stack_getter, stack_setter, attr); } // 20.5.3.4 Error.prototype.toString ( ), https://tc39.es/ecma262/#sec-error.prototype.tostring diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp index e09d286e47..029a2f80a4 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -20,9 +20,9 @@ void FinalizationRegistryPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.cleanupSome, cleanup_some, 0, attr); - define_native_function(vm.names.register_, register_, 2, attr); - define_native_function(vm.names.unregister, unregister, 1, attr); + define_native_function(realm, vm.names.cleanupSome, cleanup_some, 0, attr); + define_native_function(realm, vm.names.register_, register_, 2, attr); + define_native_function(realm, vm.names.unregister, unregister, 1, attr); // 26.2.3.4 FinalizationRegistry.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-finalization-registry.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.FinalizationRegistry.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index c009def7e4..d9f7b40a13 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -30,11 +30,11 @@ void FunctionPrototype::initialize(Realm& realm) auto& vm = this->vm(); Base::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.apply, apply, 2, attr); - define_native_function(vm.names.bind, bind, 1, attr); - define_native_function(vm.names.call, call, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(*vm.well_known_symbol_has_instance(), symbol_has_instance, 1, 0); + define_native_function(realm, vm.names.apply, apply, 2, attr); + define_native_function(realm, vm.names.bind, bind, 1, attr); + define_native_function(realm, vm.names.call, call, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + 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, js_string(heap(), ""), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp index e398123e64..49c452e24c 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp @@ -19,9 +19,9 @@ void GeneratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.next, next, 1, attr); - define_native_function(vm.names.return_, return_, 1, attr); - define_native_function(vm.names.throw_, throw_, 1, attr); + 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(), js_string(vm, "Generator"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index ceb9718c93..4f0b65b597 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -215,12 +215,12 @@ void GlobalObject::initialize_global_object(Realm& realm) #undef __JS_ENUMERATE u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.gc, gc, 0, attr); - define_native_function(vm.names.isNaN, is_nan, 1, attr); - define_native_function(vm.names.isFinite, is_finite, 1, attr); - define_native_function(vm.names.parseFloat, parse_float, 1, attr); - define_native_function(vm.names.parseInt, parse_int, 2, attr); - define_native_function(vm.names.eval, eval, 1, attr); + define_native_function(realm, vm.names.gc, gc, 0, attr); + define_native_function(realm, vm.names.isNaN, is_nan, 1, attr); + define_native_function(realm, vm.names.isFinite, is_finite, 1, attr); + define_native_function(realm, vm.names.parseFloat, parse_float, 1, attr); + define_native_function(realm, vm.names.parseInt, parse_int, 2, attr); + define_native_function(realm, vm.names.eval, eval, 1, attr); // 10.2.4.1 %ThrowTypeError% ( ), https://tc39.es/ecma262/#sec-%throwtypeerror% m_throw_type_error_function = NativeFunction::create( @@ -236,12 +236,12 @@ void GlobalObject::initialize_global_object(Realm& realm) m_function_prototype->define_direct_accessor(vm.names.caller, m_throw_type_error_function, m_throw_type_error_function, Attribute::Configurable); m_function_prototype->define_direct_accessor(vm.names.arguments, m_throw_type_error_function, m_throw_type_error_function, Attribute::Configurable); - define_native_function(vm.names.encodeURI, encode_uri, 1, attr); - define_native_function(vm.names.decodeURI, decode_uri, 1, attr); - define_native_function(vm.names.encodeURIComponent, encode_uri_component, 1, attr); - define_native_function(vm.names.decodeURIComponent, decode_uri_component, 1, attr); - define_native_function(vm.names.escape, escape, 1, attr); - define_native_function(vm.names.unescape, unescape, 1, attr); + define_native_function(realm, vm.names.encodeURI, encode_uri, 1, attr); + define_native_function(realm, vm.names.decodeURI, decode_uri, 1, attr); + define_native_function(realm, vm.names.encodeURIComponent, encode_uri_component, 1, attr); + define_native_function(realm, vm.names.decodeURIComponent, decode_uri_component, 1, attr); + define_native_function(realm, vm.names.escape, escape, 1, attr); + define_native_function(realm, vm.names.unescape, unescape, 1, attr); define_direct_property(vm.names.NaN, js_nan(), 0); define_direct_property(vm.names.Infinity, js_infinity(), 0); diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp index 68a90c2161..3e0078f861 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp @@ -146,7 +146,7 @@ void CollatorConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); } // 10.1.1 Intl.Collator ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.collator diff --git a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp index 02bc8856c4..467e185c65 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp @@ -27,8 +27,8 @@ void CollatorPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.Collator"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_accessor(vm.names.compare, compare_getter, {}, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_accessor(realm, vm.names.compare, compare_getter, {}, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 10.3.3 get Intl.Collator.prototype.compare, https://tc39.es/ecma402/#sec-intl.collator.prototype.compare diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp index 1866defec5..cba490fe7e 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp @@ -32,7 +32,7 @@ void DateTimeFormatConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().intl_date_time_format_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp index a1354504e2..19818edda7 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp @@ -28,13 +28,13 @@ void DateTimeFormatPrototype::initialize(Realm& realm) // 11.3.2 Intl.DateTimeFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.DateTimeFormat"), Attribute::Configurable); - define_native_accessor(vm.names.format, format, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.names.format, format, nullptr, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.formatToParts, format_to_parts, 1, attr); - define_native_function(vm.names.formatRange, format_range, 2, attr); - define_native_function(vm.names.formatRangeToParts, format_range_to_parts, 2, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.formatToParts, format_to_parts, 1, attr); + define_native_function(realm, vm.names.formatRange, format_range, 2, attr); + define_native_function(realm, vm.names.formatRangeToParts, format_range_to_parts, 2, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 11.3.3 get Intl.DateTimeFormat.prototype.format, https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype.format diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp index bb4f7bf733..23639a2748 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp @@ -31,7 +31,7 @@ void DisplayNamesConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().intl_display_names_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp index c6f8f5e1f2..e1a695c32c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp @@ -29,8 +29,8 @@ void DisplayNamesPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.DisplayNames"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.of, of, 1, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.of, of, 1, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 12.3.3 Intl.DisplayNames.prototype.of ( code ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.of diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp index 255d042efe..25ad59d859 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp @@ -30,7 +30,7 @@ void DurationFormatConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); } // 1.2.1 Intl.DurationFormat ( [ locales [ , options ] ] ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp index 4a4e503b44..620e632920 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp @@ -26,9 +26,9 @@ void DurationFormatPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.DurationFormat"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.format, format, 1, attr); - define_native_function(vm.names.formatToParts, format_to_parts, 1, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.format, format, 1, attr); + define_native_function(realm, vm.names.formatToParts, format_to_parts, 1, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 1.4.3 Intl.DurationFormat.prototype.format ( duration ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.prototype.format diff --git a/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp b/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp index e99001aa63..23db1e7bd0 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp @@ -54,8 +54,8 @@ void Intl::initialize(Realm& realm) define_direct_property(vm.names.RelativeTimeFormat, realm.global_object().intl_relative_time_format_constructor(), attr); define_direct_property(vm.names.Segmenter, realm.global_object().intl_segmenter_constructor(), attr); - define_native_function(vm.names.getCanonicalLocales, get_canonical_locales, 1, attr); - define_native_function(vm.names.supportedValuesOf, supported_values_of, 1, attr); + define_native_function(realm, vm.names.getCanonicalLocales, get_canonical_locales, 1, attr); + define_native_function(realm, vm.names.supportedValuesOf, supported_values_of, 1, attr); } // 8.3.1 Intl.getCanonicalLocales ( locales ), https://tc39.es/ecma402/#sec-intl.getcanonicallocales diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp index 3106583001..4fff63e226 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp @@ -30,7 +30,7 @@ void ListFormatConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().intl_list_format_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp index 94fe068d90..5368c75a42 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp @@ -28,9 +28,9 @@ void ListFormatPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.ListFormat"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.format, format, 1, attr); - define_native_function(vm.names.formatToParts, format_to_parts, 1, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.format, format, 1, attr); + define_native_function(realm, vm.names.formatToParts, format_to_parts, 1, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 13.3.3 Intl.ListFormat.prototype.format ( list ), https://tc39.es/ecma402/#sec-Intl.ListFormat.prototype.format diff --git a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp index a0fe4479ab..4408032d8c 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp @@ -26,30 +26,30 @@ void LocalePrototype::initialize(Realm& realm) auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.maximize, maximize, 0, attr); - define_native_function(vm.names.minimize, minimize, 0, attr); - define_native_function(vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.maximize, maximize, 0, attr); + define_native_function(realm, vm.names.minimize, minimize, 0, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); // 14.3.2 Intl.Locale.prototype[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl.Locale.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.Locale"), Attribute::Configurable); - define_native_accessor(vm.names.baseName, base_name, {}, Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar, {}, Attribute::Configurable); - define_native_accessor(vm.names.calendars, calendars, {}, Attribute::Configurable); - define_native_accessor(vm.names.caseFirst, case_first, {}, Attribute::Configurable); - define_native_accessor(vm.names.collation, collation, {}, Attribute::Configurable); - define_native_accessor(vm.names.collations, collations, {}, Attribute::Configurable); - define_native_accessor(vm.names.hourCycle, hour_cycle, {}, Attribute::Configurable); - define_native_accessor(vm.names.hourCycles, hour_cycles, {}, Attribute::Configurable); - define_native_accessor(vm.names.numberingSystem, numbering_system, {}, Attribute::Configurable); - define_native_accessor(vm.names.numberingSystems, numbering_systems, {}, Attribute::Configurable); - define_native_accessor(vm.names.numeric, numeric, {}, Attribute::Configurable); - define_native_accessor(vm.names.language, language, {}, Attribute::Configurable); - define_native_accessor(vm.names.script, script, {}, Attribute::Configurable); - define_native_accessor(vm.names.region, region, {}, Attribute::Configurable); - define_native_accessor(vm.names.timeZones, time_zones, {}, Attribute::Configurable); - define_native_accessor(vm.names.textInfo, text_info, {}, Attribute::Configurable); - define_native_accessor(vm.names.weekInfo, week_info, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.baseName, base_name, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendars, calendars, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.caseFirst, case_first, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.collation, collation, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.collations, collations, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hourCycle, hour_cycle, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hourCycles, hour_cycles, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.numberingSystem, numbering_system, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.numberingSystems, numbering_systems, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.numeric, numeric, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.language, language, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.script, script, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.region, region, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.timeZones, time_zones, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.textInfo, text_info, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.weekInfo, week_info, {}, Attribute::Configurable); } // 14.3.3 Intl.Locale.prototype.maximize ( ), https://tc39.es/ecma402/#sec-Intl.Locale.prototype.maximize diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp index 46a254b2d1..9c4df7ca91 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp @@ -29,7 +29,7 @@ void NumberFormatConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().intl_number_format_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp index 2486888d55..f3fafaf2a0 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp @@ -28,13 +28,13 @@ void NumberFormatPrototype::initialize(Realm& realm) // 15.3.2 Intl.NumberFormat.prototype [ @@toStringTag ], https://tc39.es/ecma402/#sec-intl.numberformat.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.NumberFormat"), Attribute::Configurable); - define_native_accessor(vm.names.format, format, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.names.format, format, nullptr, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.formatToParts, format_to_parts, 1, attr); - define_native_function(vm.names.formatRange, format_range, 2, attr); - define_native_function(vm.names.formatRangeToParts, format_range_to_parts, 2, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.formatToParts, format_to_parts, 1, attr); + define_native_function(realm, vm.names.formatRange, format_range, 2, attr); + define_native_function(realm, vm.names.formatRangeToParts, format_range_to_parts, 2, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 15.3.3 get Intl.NumberFormat.prototype.format, https://tc39.es/ecma402/#sec-intl.numberformat.prototype.format diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp index ecc0deffc1..aa301d0788 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp @@ -32,7 +32,7 @@ void PluralRulesConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); } // 16.1.1 Intl.PluralRules ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.pluralrules diff --git a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp index e4ec32fd68..5245d708a5 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp @@ -28,9 +28,9 @@ void PluralRulesPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.PluralRules"sv), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.select, select, 1, attr); - define_native_function(vm.names.selectRange, select_range, 2, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.select, select, 1, attr); + define_native_function(realm, vm.names.selectRange, select_range, 2, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 16.3.3 Intl.PluralRules.prototype.select ( value ), https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.select diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp index cc1f196c06..d985b6c13f 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp @@ -35,7 +35,7 @@ void RelativeTimeFormatConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); } // 17.1.1 Intl.RelativeTimeFormat ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat diff --git a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp index 0ca5450c96..583d011513 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp @@ -26,9 +26,9 @@ void RelativeTimeFormatPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.RelativeTimeFormat"sv), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.format, format, 2, attr); - define_native_function(vm.names.formatToParts, format_to_parts, 2, attr); - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.format, format, 2, attr); + define_native_function(realm, vm.names.formatToParts, format_to_parts, 2, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); } // 17.3.3 Intl.RelativeTimeFormat.prototype.format ( value, unit ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.format diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp index dcf0f36d00..cdafeeb66e 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp @@ -28,7 +28,7 @@ void SegmentIteratorPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Segmenter String Iterator"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.next, next, 0, attr); + define_native_function(realm, vm.names.next, next, 0, attr); } // 18.6.2.1 %SegmentIteratorPrototype%.next ( ), https://tc39.es/ecma402/#sec-%segmentiteratorprototype%.next diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp index 927ffecdd4..e10e8760d0 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp @@ -31,7 +31,7 @@ void SegmenterConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(0), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr); + define_native_function(realm, vm.names.supportedLocalesOf, supported_locales_of, 1, attr); } // 18.1.1 Intl.Segmenter ( [ locales [ , options ] ] ), https://tc39.es/ecma402/#sec-intl.segmenter diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp index c1cf4e0554..a883115b6b 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp @@ -27,8 +27,8 @@ void SegmenterPrototype::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl.Segmenter"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.resolvedOptions, resolved_options, 0, attr); - define_native_function(vm.names.segment, segment, 1, attr); + define_native_function(realm, vm.names.resolvedOptions, resolved_options, 0, attr); + define_native_function(realm, vm.names.segment, segment, 1, attr); } // 18.3.4 Intl.Segmenter.prototype.resolvedOptions ( ), https://tc39.es/ecma402/#sec-intl.segmenter.prototype.resolvedoptions diff --git a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp index b5fa596b45..aa59db6850 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp @@ -24,8 +24,8 @@ void SegmentsPrototype::initialize(Realm& realm) auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(*vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); - define_native_function(vm.names.containing, containing, 1, attr); + define_native_function(realm, *vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(realm, vm.names.containing, containing, 1, attr); } // 18.5.2.1 %SegmentsPrototype%.containing ( index ), https://tc39.es/ecma402/#sec-%segmentsprototype%.containing diff --git a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp index 1f68bdbcc2..8c8eef569e 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp @@ -21,7 +21,7 @@ void IteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(*vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(realm, *vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); } // 27.1.2.1 %IteratorPrototype% [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index cbe259c3a1..d471bff14a 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -35,8 +35,8 @@ void JSONObject::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.stringify, stringify, 3, attr); - define_native_function(vm.names.parse, parse, 2, attr); + define_native_function(realm, vm.names.stringify, stringify, 3, attr); + define_native_function(realm, vm.names.parse, parse, 2, attr); // 25.5.3 JSON [ @@toStringTag ], https://tc39.es/ecma262/#sec-json-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "JSON"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index 349796fc4d..bc61a2ff9d 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -26,7 +26,7 @@ void MapConstructor::initialize(Realm& realm) // 24.1.2.1 Map.prototype, https://tc39.es/ecma262/#sec-map.prototype define_direct_property(vm.names.prototype, realm.global_object().map_prototype(), 0); - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp index 55a4f77539..d45810aac7 100644 --- a/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp @@ -23,7 +23,7 @@ void MapIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); - define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); + define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Map Iterator"), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp index 9d736acf06..19dcf8e2f3 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -23,17 +23,17 @@ void MapPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.clear, clear, 0, attr); - define_native_function(vm.names.delete_, delete_, 1, attr); - define_native_function(vm.names.entries, entries, 0, attr); - define_native_function(vm.names.forEach, for_each, 1, attr); - define_native_function(vm.names.get, get, 1, attr); - define_native_function(vm.names.has, has, 1, attr); - define_native_function(vm.names.keys, keys, 0, attr); - define_native_function(vm.names.set, set, 2, attr); - define_native_function(vm.names.values, values, 0, attr); - - define_native_accessor(vm.names.size, size_getter, {}, Attribute::Configurable); + define_native_function(realm, vm.names.clear, clear, 0, attr); + define_native_function(realm, vm.names.delete_, delete_, 1, attr); + define_native_function(realm, vm.names.entries, entries, 0, attr); + define_native_function(realm, vm.names.forEach, for_each, 1, attr); + define_native_function(realm, vm.names.get, get, 1, attr); + define_native_function(realm, vm.names.has, has, 1, attr); + define_native_function(realm, vm.names.keys, keys, 0, attr); + define_native_function(realm, vm.names.set, set, 2, attr); + define_native_function(realm, vm.names.values, values, 0, attr); + + define_native_accessor(realm, vm.names.size, size_getter, {}, Attribute::Configurable); define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), attr); define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Map.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/MathObject.cpp b/Userland/Libraries/LibJS/Runtime/MathObject.cpp index 64cae95132..bf212c4b5f 100644 --- a/Userland/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/MathObject.cpp @@ -25,41 +25,41 @@ void MathObject::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.abs, abs, 1, attr); - define_native_function(vm.names.random, random, 0, attr); - define_native_function(vm.names.sqrt, sqrt, 1, attr); - define_native_function(vm.names.floor, floor, 1, attr); - define_native_function(vm.names.ceil, ceil, 1, attr); - define_native_function(vm.names.round, round, 1, attr); - define_native_function(vm.names.max, max, 2, attr); - define_native_function(vm.names.min, min, 2, attr); - define_native_function(vm.names.trunc, trunc, 1, attr); - define_native_function(vm.names.sin, sin, 1, attr); - define_native_function(vm.names.cos, cos, 1, attr); - define_native_function(vm.names.tan, tan, 1, attr); - define_native_function(vm.names.pow, pow, 2, attr); - define_native_function(vm.names.exp, exp, 1, attr); - define_native_function(vm.names.expm1, expm1, 1, attr); - define_native_function(vm.names.sign, sign, 1, attr); - define_native_function(vm.names.clz32, clz32, 1, attr); - define_native_function(vm.names.acos, acos, 1, attr); - define_native_function(vm.names.acosh, acosh, 1, attr); - define_native_function(vm.names.asin, asin, 1, attr); - define_native_function(vm.names.asinh, asinh, 1, attr); - define_native_function(vm.names.atan, atan, 1, attr); - define_native_function(vm.names.atanh, atanh, 1, attr); - define_native_function(vm.names.log1p, log1p, 1, attr); - define_native_function(vm.names.cbrt, cbrt, 1, attr); - define_native_function(vm.names.atan2, atan2, 2, attr); - define_native_function(vm.names.fround, fround, 1, attr); - define_native_function(vm.names.hypot, hypot, 2, attr); - define_native_function(vm.names.imul, imul, 2, attr); - define_native_function(vm.names.log, log, 1, attr); - define_native_function(vm.names.log2, log2, 1, attr); - define_native_function(vm.names.log10, log10, 1, attr); - define_native_function(vm.names.sinh, sinh, 1, attr); - define_native_function(vm.names.cosh, cosh, 1, attr); - define_native_function(vm.names.tanh, tanh, 1, attr); + define_native_function(realm, vm.names.abs, abs, 1, attr); + define_native_function(realm, vm.names.random, random, 0, attr); + define_native_function(realm, vm.names.sqrt, sqrt, 1, attr); + define_native_function(realm, vm.names.floor, floor, 1, attr); + define_native_function(realm, vm.names.ceil, ceil, 1, attr); + define_native_function(realm, vm.names.round, round, 1, attr); + define_native_function(realm, vm.names.max, max, 2, attr); + define_native_function(realm, vm.names.min, min, 2, attr); + define_native_function(realm, vm.names.trunc, trunc, 1, attr); + define_native_function(realm, vm.names.sin, sin, 1, attr); + define_native_function(realm, vm.names.cos, cos, 1, attr); + define_native_function(realm, vm.names.tan, tan, 1, attr); + define_native_function(realm, vm.names.pow, pow, 2, attr); + define_native_function(realm, vm.names.exp, exp, 1, attr); + define_native_function(realm, vm.names.expm1, expm1, 1, attr); + define_native_function(realm, vm.names.sign, sign, 1, attr); + define_native_function(realm, vm.names.clz32, clz32, 1, attr); + define_native_function(realm, vm.names.acos, acos, 1, attr); + define_native_function(realm, vm.names.acosh, acosh, 1, attr); + define_native_function(realm, vm.names.asin, asin, 1, attr); + define_native_function(realm, vm.names.asinh, asinh, 1, attr); + define_native_function(realm, vm.names.atan, atan, 1, attr); + define_native_function(realm, vm.names.atanh, atanh, 1, attr); + define_native_function(realm, vm.names.log1p, log1p, 1, attr); + define_native_function(realm, vm.names.cbrt, cbrt, 1, attr); + define_native_function(realm, vm.names.atan2, atan2, 2, attr); + define_native_function(realm, vm.names.fround, fround, 1, attr); + define_native_function(realm, vm.names.hypot, hypot, 2, attr); + define_native_function(realm, vm.names.imul, imul, 2, attr); + define_native_function(realm, vm.names.log, log, 1, attr); + define_native_function(realm, vm.names.log2, log2, 1, attr); + define_native_function(realm, vm.names.log10, log10, 1, attr); + define_native_function(realm, vm.names.sinh, sinh, 1, attr); + define_native_function(realm, vm.names.cosh, cosh, 1, attr); + define_native_function(realm, vm.names.tanh, tanh, 1, attr); // 21.3.1 Value Properties of the Math Object, https://tc39.es/ecma262/#sec-value-properties-of-the-math-object define_direct_property(vm.names.E, Value(M_E), 0); diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp index 9a56419f29..bbff170620 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -37,10 +37,10 @@ void NumberConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().number_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.isFinite, is_finite, 1, attr); - define_native_function(vm.names.isInteger, is_integer, 1, attr); - define_native_function(vm.names.isNaN, is_nan, 1, attr); - define_native_function(vm.names.isSafeInteger, is_safe_integer, 1, attr); + define_native_function(realm, vm.names.isFinite, is_finite, 1, attr); + define_native_function(realm, vm.names.isInteger, is_integer, 1, attr); + define_native_function(realm, vm.names.isNaN, is_nan, 1, attr); + define_native_function(realm, vm.names.isSafeInteger, is_safe_integer, 1, attr); // FIXME: Store these as intrinsics (`parse_int_function()`) instead of getting them from the global object define_direct_property(vm.names.parseInt, realm.global_object().get_without_side_effects(vm.names.parseInt), attr); define_direct_property(vm.names.parseFloat, realm.global_object().get_without_side_effects(vm.names.parseFloat), attr); diff --git a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp index 763047c19f..1a6b02cf5a 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -93,12 +93,12 @@ void NumberPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Configurable | Attribute::Writable; - define_native_function(vm.names.toExponential, to_exponential, 1, attr); - define_native_function(vm.names.toFixed, to_fixed, 1, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toPrecision, to_precision, 1, attr); - define_native_function(vm.names.toString, to_string, 1, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toExponential, to_exponential, 1, attr); + define_native_function(realm, vm.names.toFixed, to_fixed, 1, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toPrecision, to_precision, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 1, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); } // thisNumberValue ( value ), https://tc39.es/ecma262/#thisnumbervalue diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 396e79c4d6..638b676725 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1073,9 +1073,8 @@ void Object::set_prototype(Object* new_prototype) m_shape = shape.create_prototype_transition(new_prototype); } -void Object::define_native_accessor(PropertyKey const& property_key, Function<ThrowCompletionOr<Value>(VM&)> getter, Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attribute) +void Object::define_native_accessor(Realm& realm, PropertyKey const& property_key, Function<ThrowCompletionOr<Value>(VM&)> getter, Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attribute) { - auto& realm = *global_object().associated_realm(); FunctionObject* getter_function = nullptr; if (getter) getter_function = NativeFunction::create(realm, move(getter), 0, property_key, &realm, {}, "get"sv); @@ -1123,9 +1122,8 @@ Value Object::get_without_side_effects(PropertyKey const& property_key) const return {}; } -void Object::define_native_function(PropertyKey const& property_key, Function<ThrowCompletionOr<Value>(VM&)> native_function, i32 length, PropertyAttributes attribute) +void Object::define_native_function(Realm& realm, PropertyKey const& property_key, Function<ThrowCompletionOr<Value>(VM&)> native_function, i32 length, PropertyAttributes attribute) { - auto& realm = *global_object().associated_realm(); auto* function = NativeFunction::create(realm, move(native_function), length, property_key, &realm); define_direct_property(property_key, function, attribute); } diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index fa29bbe48b..27491d9ec7 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -157,8 +157,8 @@ public: void define_direct_property(PropertyKey const& property_key, Value value, PropertyAttributes attributes) { storage_set(property_key, { value, attributes }); }; void define_direct_accessor(PropertyKey const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes); - void define_native_function(PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&)>, i32 length, PropertyAttributes attributes); - void define_native_accessor(PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&)> getter, Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attributes); + void define_native_function(Realm&, PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&)>, i32 length, PropertyAttributes attributes); + void define_native_accessor(Realm&, PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&)> getter, Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attributes); virtual bool is_function() const { return false; } virtual bool is_typed_array() const { return false; } diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 66936bc157..3b4671d884 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -31,28 +31,28 @@ void ObjectConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().object_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.defineProperty, define_property, 3, attr); - define_native_function(vm.names.defineProperties, define_properties, 2, attr); - define_native_function(vm.names.is, is, 2, attr); - define_native_function(vm.names.getOwnPropertyDescriptor, get_own_property_descriptor, 2, attr); - define_native_function(vm.names.getOwnPropertyDescriptors, get_own_property_descriptors, 1, attr); - define_native_function(vm.names.getOwnPropertyNames, get_own_property_names, 1, attr); - define_native_function(vm.names.getOwnPropertySymbols, get_own_property_symbols, 1, attr); - define_native_function(vm.names.getPrototypeOf, get_prototype_of, 1, attr); - define_native_function(vm.names.setPrototypeOf, set_prototype_of, 2, attr); - define_native_function(vm.names.isExtensible, is_extensible, 1, attr); - define_native_function(vm.names.isFrozen, is_frozen, 1, attr); - define_native_function(vm.names.isSealed, is_sealed, 1, attr); - define_native_function(vm.names.preventExtensions, prevent_extensions, 1, attr); - define_native_function(vm.names.freeze, freeze, 1, attr); - define_native_function(vm.names.fromEntries, from_entries, 1, attr); - define_native_function(vm.names.seal, seal, 1, attr); - define_native_function(vm.names.keys, keys, 1, attr); - define_native_function(vm.names.values, values, 1, attr); - define_native_function(vm.names.entries, entries, 1, attr); - define_native_function(vm.names.create, create, 2, attr); - define_native_function(vm.names.hasOwn, has_own, 2, attr); - define_native_function(vm.names.assign, assign, 2, attr); + define_native_function(realm, vm.names.defineProperty, define_property, 3, attr); + define_native_function(realm, vm.names.defineProperties, define_properties, 2, attr); + define_native_function(realm, vm.names.is, is, 2, attr); + define_native_function(realm, vm.names.getOwnPropertyDescriptor, get_own_property_descriptor, 2, attr); + define_native_function(realm, vm.names.getOwnPropertyDescriptors, get_own_property_descriptors, 1, attr); + define_native_function(realm, vm.names.getOwnPropertyNames, get_own_property_names, 1, attr); + define_native_function(realm, vm.names.getOwnPropertySymbols, get_own_property_symbols, 1, attr); + define_native_function(realm, vm.names.getPrototypeOf, get_prototype_of, 1, attr); + define_native_function(realm, vm.names.setPrototypeOf, set_prototype_of, 2, attr); + define_native_function(realm, vm.names.isExtensible, is_extensible, 1, attr); + define_native_function(realm, vm.names.isFrozen, is_frozen, 1, attr); + define_native_function(realm, vm.names.isSealed, is_sealed, 1, attr); + define_native_function(realm, vm.names.preventExtensions, prevent_extensions, 1, attr); + define_native_function(realm, vm.names.freeze, freeze, 1, attr); + define_native_function(realm, vm.names.fromEntries, from_entries, 1, attr); + define_native_function(realm, vm.names.seal, seal, 1, attr); + define_native_function(realm, vm.names.keys, keys, 1, attr); + define_native_function(realm, vm.names.values, values, 1, attr); + define_native_function(realm, vm.names.entries, entries, 1, attr); + define_native_function(realm, vm.names.create, create, 2, attr); + define_native_function(realm, vm.names.hasOwn, has_own, 2, attr); + define_native_function(realm, vm.names.assign, assign, 2, attr); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 3f5997df5a..3db3320f4f 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -33,19 +33,19 @@ void ObjectPrototype::initialize(Realm& realm) // This must be called after the constructor has returned, so that the below code // can find the ObjectPrototype through normal paths. u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.hasOwnProperty, has_own_property, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.propertyIsEnumerable, property_is_enumerable, 1, attr); - define_native_function(vm.names.isPrototypeOf, is_prototype_of, 1, attr); + define_native_function(realm, vm.names.hasOwnProperty, has_own_property, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.propertyIsEnumerable, property_is_enumerable, 1, attr); + define_native_function(realm, vm.names.isPrototypeOf, is_prototype_of, 1, attr); // Annex B - define_native_function(vm.names.__defineGetter__, define_getter, 2, attr); - define_native_function(vm.names.__defineSetter__, define_setter, 2, attr); - define_native_function(vm.names.__lookupGetter__, lookup_getter, 1, attr); - define_native_function(vm.names.__lookupSetter__, lookup_setter, 1, attr); - define_native_accessor(vm.names.__proto__, proto_getter, proto_setter, Attribute::Configurable); + define_native_function(realm, vm.names.__defineGetter__, define_getter, 2, attr); + define_native_function(realm, vm.names.__defineSetter__, define_setter, 2, attr); + define_native_function(realm, vm.names.__lookupGetter__, lookup_getter, 1, attr); + define_native_function(realm, vm.names.__lookupSetter__, lookup_setter, 1, attr); + define_native_accessor(realm, vm.names.__proto__, proto_getter, proto_setter, Attribute::Configurable); } // 10.4.7.1 [[SetPrototypeOf]] ( V ), https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects-setprototypeof-v diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index c9418c5dae..a2ae7a4511 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -253,14 +253,14 @@ void PromiseConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().promise_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.all, all, 1, attr); - define_native_function(vm.names.allSettled, all_settled, 1, attr); - define_native_function(vm.names.any, any, 1, attr); - define_native_function(vm.names.race, race, 1, attr); - define_native_function(vm.names.reject, reject, 1, attr); - define_native_function(vm.names.resolve, resolve, 1, attr); - - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_function(realm, vm.names.all, all, 1, attr); + define_native_function(realm, vm.names.allSettled, all_settled, 1, attr); + define_native_function(realm, vm.names.any, any, 1, attr); + define_native_function(realm, vm.names.race, race, 1, attr); + define_native_function(realm, vm.names.reject, reject, 1, attr); + define_native_function(realm, vm.names.resolve, resolve, 1, attr); + + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index 3bff025998..3a28aa5821 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -27,9 +27,9 @@ void PromisePrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.then, then, 2, attr); - define_native_function(vm.names.catch_, catch_, 1, attr); - define_native_function(vm.names.finally, finally, 1, attr); + define_native_function(realm, vm.names.then, then, 2, attr); + define_native_function(realm, vm.names.catch_, catch_, 1, attr); + define_native_function(realm, vm.names.finally, finally, 1, attr); // 27.2.5.5 Promise.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-promise.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Promise.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp index 772ab46ed7..81926730ab 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -34,7 +34,7 @@ void ProxyConstructor::initialize(Realm& realm) auto& vm = this->vm(); NativeFunction::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.revocable, revocable, 2, attr); + define_native_function(realm, vm.names.revocable, revocable, 2, attr); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp index cbe5cfc629..8c74732106 100644 --- a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -25,19 +25,19 @@ void ReflectObject::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.apply, apply, 3, attr); - define_native_function(vm.names.construct, construct, 2, attr); - define_native_function(vm.names.defineProperty, define_property, 3, attr); - define_native_function(vm.names.deleteProperty, delete_property, 2, attr); - define_native_function(vm.names.get, get, 2, attr); - define_native_function(vm.names.getOwnPropertyDescriptor, get_own_property_descriptor, 2, attr); - define_native_function(vm.names.getPrototypeOf, get_prototype_of, 1, attr); - define_native_function(vm.names.has, has, 2, attr); - define_native_function(vm.names.isExtensible, is_extensible, 1, attr); - define_native_function(vm.names.ownKeys, own_keys, 1, attr); - define_native_function(vm.names.preventExtensions, prevent_extensions, 1, attr); - define_native_function(vm.names.set, set, 3, attr); - define_native_function(vm.names.setPrototypeOf, set_prototype_of, 2, attr); + define_native_function(realm, vm.names.apply, apply, 3, attr); + define_native_function(realm, vm.names.construct, construct, 2, attr); + define_native_function(realm, vm.names.defineProperty, define_property, 3, attr); + define_native_function(realm, vm.names.deleteProperty, delete_property, 2, attr); + define_native_function(realm, vm.names.get, get, 2, attr); + define_native_function(realm, vm.names.getOwnPropertyDescriptor, get_own_property_descriptor, 2, attr); + define_native_function(realm, vm.names.getPrototypeOf, get_prototype_of, 1, attr); + define_native_function(realm, vm.names.has, has, 2, attr); + define_native_function(realm, vm.names.isExtensible, is_extensible, 1, attr); + define_native_function(realm, vm.names.ownKeys, own_keys, 1, attr); + define_native_function(realm, vm.names.preventExtensions, prevent_extensions, 1, attr); + define_native_function(realm, vm.names.set, set, 3, attr); + define_native_function(realm, vm.names.setPrototypeOf, set_prototype_of, 2, attr); // 28.1.14 Reflect [ @@toStringTag ], https://tc39.es/ecma262/#sec-reflect-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.Reflect.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp index c95ca2c937..b40387d28d 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -24,7 +24,7 @@ void RegExpConstructor::initialize(Realm& realm) // 22.2.4.1 RegExp.prototype, https://tc39.es/ecma262/#sec-regexp.prototype define_direct_property(vm.names.prototype, realm.global_object().regexp_prototype(), 0); - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index fba131b0fc..3c2e45ffd5 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -31,22 +31,22 @@ void RegExpPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.test, test, 1, attr); - define_native_function(vm.names.exec, exec, 1, attr); - define_native_function(vm.names.compile, compile, 2, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.test, test, 1, attr); + define_native_function(realm, vm.names.exec, exec, 1, attr); + define_native_function(realm, vm.names.compile, compile, 2, attr); - define_native_function(*vm.well_known_symbol_match(), symbol_match, 1, attr); - define_native_function(*vm.well_known_symbol_match_all(), symbol_match_all, 1, attr); - define_native_function(*vm.well_known_symbol_replace(), symbol_replace, 2, attr); - define_native_function(*vm.well_known_symbol_search(), symbol_search, 1, attr); - define_native_function(*vm.well_known_symbol_split(), symbol_split, 2, attr); + define_native_function(realm, *vm.well_known_symbol_match(), symbol_match, 1, attr); + define_native_function(realm, *vm.well_known_symbol_match_all(), symbol_match_all, 1, attr); + define_native_function(realm, *vm.well_known_symbol_replace(), symbol_replace, 2, attr); + define_native_function(realm, *vm.well_known_symbol_search(), symbol_search, 1, attr); + define_native_function(realm, *vm.well_known_symbol_split(), symbol_split, 2, attr); - define_native_accessor(vm.names.flags, flags, {}, Attribute::Configurable); - define_native_accessor(vm.names.source, source, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.flags, flags, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.source, source, {}, Attribute::Configurable); #define __JS_ENUMERATE(flagName, flag_name, flag_char) \ - define_native_accessor(vm.names.flagName, flag_name, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.flagName, flag_name, {}, Attribute::Configurable); JS_ENUMERATE_REGEXP_FLAGS #undef __JS_ENUMERATE } diff --git a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp index 95cfd18f82..bc76b94ec5 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp @@ -23,7 +23,7 @@ void RegExpStringIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.next, next, 0, attr); + define_native_function(realm, vm.names.next, next, 0, attr); // 22.2.7.2.2 %RegExpStringIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%regexpstringiteratorprototype%-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "RegExp String Iterator"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp index 62c5609987..4754c4fc54 100644 --- a/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetConstructor.cpp @@ -26,7 +26,7 @@ void SetConstructor::initialize(Realm& realm) // 24.2.2.1 Set.prototype, https://tc39.es/ecma262/#sec-set.prototype define_direct_property(vm.names.prototype, realm.global_object().set_prototype(), 0); - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp index a64146300a..2f976e1a5f 100644 --- a/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp @@ -23,7 +23,7 @@ void SetIteratorPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); - define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); + define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 24.2.5.2.2 %SetIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%setiteratorprototype%-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Set Iterator"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp index 1502e98529..0a9bea3abf 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -23,14 +23,14 @@ void SetPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.clear, clear, 0, attr); - define_native_function(vm.names.delete_, delete_, 1, attr); - define_native_function(vm.names.entries, entries, 0, attr); - define_native_function(vm.names.forEach, for_each, 1, attr); - define_native_function(vm.names.has, has, 1, attr); - define_native_function(vm.names.values, values, 0, attr); - define_native_accessor(vm.names.size, size_getter, {}, Attribute::Configurable); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.clear, clear, 0, attr); + define_native_function(realm, vm.names.delete_, delete_, 1, attr); + define_native_function(realm, vm.names.entries, entries, 0, attr); + define_native_function(realm, vm.names.forEach, for_each, 1, attr); + define_native_function(realm, vm.names.has, has, 1, attr); + define_native_function(realm, vm.names.values, values, 0, attr); + define_native_accessor(realm, vm.names.size, size_getter, {}, Attribute::Configurable); define_direct_property(vm.names.keys, get_without_side_effects(vm.names.values), attr); diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp index cf5d7b8bb4..ca96c2f721 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp @@ -22,8 +22,8 @@ void ShadowRealmPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.evaluate, evaluate, 1, attr); - define_native_function(vm.names.importValue, import_value, 2, attr); + define_native_function(realm, vm.names.evaluate, evaluate, 1, attr); + define_native_function(realm, vm.names.importValue, import_value, 2, attr); // 3.4.3 ShadowRealm.prototype [ @@toStringTag ], https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.ShadowRealm.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp index b91f3aa57d..06bc2bb193 100644 --- a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -31,9 +31,9 @@ void StringConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().string_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.raw, raw, 1, attr); - define_native_function(vm.names.fromCharCode, from_char_code, 1, attr); - define_native_function(vm.names.fromCodePoint, from_code_point, 1, attr); + define_native_function(realm, vm.names.raw, raw, 1, attr); + define_native_function(realm, vm.names.fromCharCode, from_char_code, 1, attr); + define_native_function(realm, vm.names.fromCodePoint, from_code_point, 1, attr); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index e321564cc8..71e056bacb 100644 --- a/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -22,7 +22,7 @@ void StringIteratorPrototype::initialize(Realm& realm) { auto& vm = this->vm(); Object::initialize(realm); - define_native_function(vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); + define_native_function(realm, vm.names.next, next, 0, Attribute::Configurable | Attribute::Writable); // 22.1.5.1.2 %StringIteratorPrototype% [ @@toStringTag ], https://tc39.es/ecma262/#sec-%stringiteratorprototype%-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "String Iterator"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 9e919f0f2b..ce10ba34fa 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -113,55 +113,55 @@ void StringPrototype::initialize(Realm& realm) StringObject::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.charAt, char_at, 1, attr); - define_native_function(vm.names.charCodeAt, char_code_at, 1, attr); - define_native_function(vm.names.codePointAt, code_point_at, 1, attr); - define_native_function(vm.names.repeat, repeat, 1, attr); - define_native_function(vm.names.startsWith, starts_with, 1, attr); - define_native_function(vm.names.endsWith, ends_with, 1, attr); - define_native_function(vm.names.indexOf, index_of, 1, attr); - define_native_function(vm.names.toLocaleLowerCase, to_locale_lowercase, 0, attr); - define_native_function(vm.names.toLocaleUpperCase, to_locale_uppercase, 0, attr); - define_native_function(vm.names.toLowerCase, to_lowercase, 0, attr); - define_native_function(vm.names.toUpperCase, to_uppercase, 0, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.padStart, pad_start, 1, attr); - define_native_function(vm.names.padEnd, pad_end, 1, attr); - define_native_function(vm.names.trim, trim, 0, attr); - define_native_function(vm.names.trimStart, trim_start, 0, attr); + define_native_function(realm, vm.names.charAt, char_at, 1, attr); + define_native_function(realm, vm.names.charCodeAt, char_code_at, 1, attr); + define_native_function(realm, vm.names.codePointAt, code_point_at, 1, attr); + define_native_function(realm, vm.names.repeat, repeat, 1, attr); + define_native_function(realm, vm.names.startsWith, starts_with, 1, attr); + define_native_function(realm, vm.names.endsWith, ends_with, 1, attr); + define_native_function(realm, vm.names.indexOf, index_of, 1, attr); + define_native_function(realm, vm.names.toLocaleLowerCase, to_locale_lowercase, 0, attr); + define_native_function(realm, vm.names.toLocaleUpperCase, to_locale_uppercase, 0, attr); + define_native_function(realm, vm.names.toLowerCase, to_lowercase, 0, attr); + define_native_function(realm, vm.names.toUpperCase, to_uppercase, 0, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.padStart, pad_start, 1, attr); + define_native_function(realm, vm.names.padEnd, pad_end, 1, attr); + define_native_function(realm, vm.names.trim, trim, 0, attr); + define_native_function(realm, vm.names.trimStart, trim_start, 0, attr); define_direct_property(vm.names.trimLeft, get_without_side_effects(vm.names.trimStart), attr); - define_native_function(vm.names.trimEnd, trim_end, 0, attr); + define_native_function(realm, vm.names.trimEnd, trim_end, 0, attr); define_direct_property(vm.names.trimRight, get_without_side_effects(vm.names.trimEnd), attr); - define_native_function(vm.names.concat, concat, 1, attr); - define_native_function(vm.names.substr, substr, 2, attr); - define_native_function(vm.names.substring, substring, 2, attr); - define_native_function(vm.names.includes, includes, 1, attr); - define_native_function(vm.names.slice, slice, 2, attr); - define_native_function(vm.names.split, split, 2, attr); - define_native_function(vm.names.lastIndexOf, last_index_of, 1, attr); - define_native_function(vm.names.at, at, 1, attr); - define_native_function(vm.names.match, match, 1, attr); - define_native_function(vm.names.matchAll, match_all, 1, attr); - define_native_function(vm.names.normalize, normalize, 0, attr); - define_native_function(vm.names.replace, replace, 2, attr); - define_native_function(vm.names.replaceAll, replace_all, 2, attr); - define_native_function(vm.names.search, search, 1, attr); - define_native_function(vm.names.anchor, anchor, 1, attr); - define_native_function(vm.names.big, big, 0, attr); - define_native_function(vm.names.blink, blink, 0, attr); - define_native_function(vm.names.bold, bold, 0, attr); - define_native_function(vm.names.fixed, fixed, 0, attr); - define_native_function(vm.names.fontcolor, fontcolor, 1, attr); - define_native_function(vm.names.fontsize, fontsize, 1, attr); - define_native_function(vm.names.italics, italics, 0, attr); - define_native_function(vm.names.link, link, 1, attr); - define_native_function(vm.names.small, small, 0, attr); - define_native_function(vm.names.strike, strike, 0, attr); - define_native_function(vm.names.sub, sub, 0, attr); - define_native_function(vm.names.sup, sup, 0, attr); - define_native_function(vm.names.localeCompare, locale_compare, 1, attr); - define_native_function(*vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); + define_native_function(realm, vm.names.concat, concat, 1, attr); + define_native_function(realm, vm.names.substr, substr, 2, attr); + define_native_function(realm, vm.names.substring, substring, 2, attr); + define_native_function(realm, vm.names.includes, includes, 1, attr); + define_native_function(realm, vm.names.slice, slice, 2, attr); + define_native_function(realm, vm.names.split, split, 2, attr); + define_native_function(realm, vm.names.lastIndexOf, last_index_of, 1, attr); + define_native_function(realm, vm.names.at, at, 1, attr); + define_native_function(realm, vm.names.match, match, 1, attr); + define_native_function(realm, vm.names.matchAll, match_all, 1, attr); + define_native_function(realm, vm.names.normalize, normalize, 0, attr); + define_native_function(realm, vm.names.replace, replace, 2, attr); + define_native_function(realm, vm.names.replaceAll, replace_all, 2, attr); + define_native_function(realm, vm.names.search, search, 1, attr); + define_native_function(realm, vm.names.anchor, anchor, 1, attr); + define_native_function(realm, vm.names.big, big, 0, attr); + define_native_function(realm, vm.names.blink, blink, 0, attr); + define_native_function(realm, vm.names.bold, bold, 0, attr); + define_native_function(realm, vm.names.fixed, fixed, 0, attr); + define_native_function(realm, vm.names.fontcolor, fontcolor, 1, attr); + define_native_function(realm, vm.names.fontsize, fontsize, 1, attr); + define_native_function(realm, vm.names.italics, italics, 0, attr); + define_native_function(realm, vm.names.link, link, 1, attr); + define_native_function(realm, vm.names.small, small, 0, attr); + define_native_function(realm, vm.names.strike, strike, 0, attr); + define_native_function(realm, vm.names.sub, sub, 0, attr); + define_native_function(realm, vm.names.sup, sup, 0, attr); + define_native_function(realm, vm.names.localeCompare, locale_compare, 1, attr); + define_native_function(realm, *vm.well_known_symbol_iterator(), symbol_iterator, 0, attr); } // thisStringValue ( value ), https://tc39.es/ecma262/#thisstringvalue diff --git a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp index eed3c8e16c..13847b1cb9 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -24,8 +24,8 @@ void SymbolConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().symbol_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.for_, for_, 1, attr); - define_native_function(vm.names.keyFor, key_for, 1, attr); + define_native_function(realm, vm.names.for_, for_, 1, attr); + define_native_function(realm, vm.names.keyFor, key_for, 1, attr); #define __JS_ENUMERATE(SymbolName, snake_name) \ define_direct_property(vm.names.SymbolName, vm.well_known_symbol_##snake_name(), 0); diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp index cefa0f4671..bc7981e1a8 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -28,10 +28,10 @@ void SymbolPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_accessor(vm.names.description, description_getter, {}, Attribute::Configurable); - define_native_function(*vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_accessor(realm, vm.names.description, description_getter, {}, Attribute::Configurable); + define_native_function(realm, *vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); // 20.4.3.6 Symbol.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Symbol"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp index fdffc9b6e0..4f3da005bf 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp @@ -26,7 +26,7 @@ void CalendarConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_calendar_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.from, from, 1, attr); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index cf826752ff..29727665cf 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -34,32 +34,32 @@ void CalendarPrototype::initialize(Realm& realm) // 12.4.2 Temporal.Calendar.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Calendar"), Attribute::Configurable); - define_native_accessor(vm.names.id, id_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.id, id_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.dateFromFields, date_from_fields, 1, attr); - define_native_function(vm.names.yearMonthFromFields, year_month_from_fields, 1, attr); - define_native_function(vm.names.monthDayFromFields, month_day_from_fields, 1, attr); - define_native_function(vm.names.dateAdd, date_add, 2, attr); - define_native_function(vm.names.dateUntil, date_until, 2, attr); - define_native_function(vm.names.year, year, 1, attr); - define_native_function(vm.names.month, month, 1, attr); - define_native_function(vm.names.monthCode, month_code, 1, attr); - define_native_function(vm.names.day, day, 1, attr); - define_native_function(vm.names.dayOfWeek, day_of_week, 1, attr); - define_native_function(vm.names.dayOfYear, day_of_year, 1, attr); - define_native_function(vm.names.weekOfYear, week_of_year, 1, attr); - define_native_function(vm.names.daysInWeek, days_in_week, 1, attr); - define_native_function(vm.names.daysInMonth, days_in_month, 1, attr); - define_native_function(vm.names.daysInYear, days_in_year, 1, attr); - define_native_function(vm.names.monthsInYear, months_in_year, 1, attr); - define_native_function(vm.names.inLeapYear, in_leap_year, 1, attr); - define_native_function(vm.names.fields, fields, 1, attr); - define_native_function(vm.names.mergeFields, merge_fields, 2, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.era, era, 1, attr); - define_native_function(vm.names.eraYear, era_year, 1, attr); + define_native_function(realm, vm.names.dateFromFields, date_from_fields, 1, attr); + define_native_function(realm, vm.names.yearMonthFromFields, year_month_from_fields, 1, attr); + define_native_function(realm, vm.names.monthDayFromFields, month_day_from_fields, 1, attr); + define_native_function(realm, vm.names.dateAdd, date_add, 2, attr); + define_native_function(realm, vm.names.dateUntil, date_until, 2, attr); + define_native_function(realm, vm.names.year, year, 1, attr); + define_native_function(realm, vm.names.month, month, 1, attr); + define_native_function(realm, vm.names.monthCode, month_code, 1, attr); + define_native_function(realm, vm.names.day, day, 1, attr); + define_native_function(realm, vm.names.dayOfWeek, day_of_week, 1, attr); + define_native_function(realm, vm.names.dayOfYear, day_of_year, 1, attr); + define_native_function(realm, vm.names.weekOfYear, week_of_year, 1, attr); + define_native_function(realm, vm.names.daysInWeek, days_in_week, 1, attr); + define_native_function(realm, vm.names.daysInMonth, days_in_month, 1, attr); + define_native_function(realm, vm.names.daysInYear, days_in_year, 1, attr); + define_native_function(realm, vm.names.monthsInYear, months_in_year, 1, attr); + define_native_function(realm, vm.names.inLeapYear, in_leap_year, 1, attr); + define_native_function(realm, vm.names.fields, fields, 1, attr); + define_native_function(realm, vm.names.mergeFields, merge_fields, 2, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.era, era, 1, attr); + define_native_function(realm, vm.names.eraYear, era_year, 1, attr); } // 12.4.3 get Temporal.Calendar.prototype.id, https://tc39.es/proposal-temporal/#sec-get-temporal.calendar.prototype.id diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp index c1e983ce83..9242488464 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp @@ -29,8 +29,8 @@ void DurationConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_duration_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index 9c34d4b6d1..6165511ffd 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -29,31 +29,31 @@ void DurationPrototype::initialize(Realm& realm) // 7.3.2 Temporal.Duration.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Duration"), Attribute::Configurable); - define_native_accessor(vm.names.years, years_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.months, months_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.weeks, weeks_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.days, days_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.hours, hours_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.minutes, minutes_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.seconds, seconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.milliseconds, milliseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.microseconds, microseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.nanoseconds, nanoseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.sign, sign_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.blank, blank_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.years, years_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.months, months_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.weeks, weeks_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.days, days_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hours, hours_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.minutes, minutes_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.seconds, seconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.milliseconds, milliseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.microseconds, microseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.nanoseconds, nanoseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.sign, sign_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.blank, blank_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.negated, negated, 0, attr); - define_native_function(vm.names.abs, abs, 0, attr); - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.round, round, 1, attr); - define_native_function(vm.names.total, total, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.negated, negated, 0, attr); + define_native_function(realm, vm.names.abs, abs, 0, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.round, round, 1, attr); + define_native_function(realm, vm.names.total, total, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); } // 7.3.3 get Temporal.Duration.prototype.years, https://tc39.es/proposal-temporal/#sec-get-temporal.duration.prototype.years diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp index da7f0f86df..f0d9ba895a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp @@ -28,12 +28,12 @@ void InstantConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_instant_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.fromEpochSeconds, from_epoch_seconds, 1, attr); - define_native_function(vm.names.fromEpochMilliseconds, from_epoch_milliseconds, 1, attr); - define_native_function(vm.names.fromEpochMicroseconds, from_epoch_microseconds, 1, attr); - define_native_function(vm.names.fromEpochNanoseconds, from_epoch_nanoseconds, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.fromEpochSeconds, from_epoch_seconds, 1, attr); + define_native_function(realm, vm.names.fromEpochMilliseconds, from_epoch_milliseconds, 1, attr); + define_native_function(realm, vm.names.fromEpochMicroseconds, from_epoch_microseconds, 1, attr); + define_native_function(realm, vm.names.fromEpochNanoseconds, from_epoch_nanoseconds, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index fb70f61861..6325b02421 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -33,24 +33,24 @@ void InstantPrototype::initialize(Realm& realm) // 8.3.2 Temporal.Instant.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Instant"), Attribute::Configurable); - define_native_accessor(vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochMicroseconds, epoch_microseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochNanoseconds, epoch_nanoseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochMicroseconds, epoch_microseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochNanoseconds, epoch_nanoseconds_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.until, until, 1, attr); - define_native_function(vm.names.since, since, 1, attr); - define_native_function(vm.names.round, round, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); - define_native_function(vm.names.toZonedDateTimeISO, to_zoned_date_time_iso, 1, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.until, until, 1, attr); + define_native_function(realm, vm.names.since, since, 1, attr); + define_native_function(realm, vm.names.round, round, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); + define_native_function(realm, vm.names.toZonedDateTimeISO, to_zoned_date_time_iso, 1, attr); } // 8.3.3 get Temporal.Instant.prototype.epochSeconds, https://tc39.es/proposal-temporal/#sec-get-temporal.instant.prototype.epochseconds diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp index e732924a3f..2aa66dd3de 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp @@ -35,15 +35,15 @@ void Now::initialize(Realm& realm) define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.Now"), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.timeZone, time_zone, 0, attr); - define_native_function(vm.names.instant, instant, 0, attr); - define_native_function(vm.names.plainDateTime, plain_date_time, 1, attr); - define_native_function(vm.names.plainDateTimeISO, plain_date_time_iso, 0, attr); - define_native_function(vm.names.zonedDateTime, zoned_date_time, 1, attr); - define_native_function(vm.names.zonedDateTimeISO, zoned_date_time_iso, 0, attr); - define_native_function(vm.names.plainDate, plain_date, 1, attr); - define_native_function(vm.names.plainDateISO, plain_date_iso, 0, attr); - define_native_function(vm.names.plainTimeISO, plain_time_iso, 0, attr); + define_native_function(realm, vm.names.timeZone, time_zone, 0, attr); + define_native_function(realm, vm.names.instant, instant, 0, attr); + define_native_function(realm, vm.names.plainDateTime, plain_date_time, 1, attr); + define_native_function(realm, vm.names.plainDateTimeISO, plain_date_time_iso, 0, attr); + define_native_function(realm, vm.names.zonedDateTime, zoned_date_time, 1, attr); + define_native_function(realm, vm.names.zonedDateTimeISO, zoned_date_time_iso, 0, attr); + define_native_function(realm, vm.names.plainDate, plain_date, 1, attr); + define_native_function(realm, vm.names.plainDateISO, plain_date_iso, 0, attr); + define_native_function(realm, vm.names.plainTimeISO, plain_time_iso, 0, attr); } // 2.2.1 Temporal.Now.timeZone ( ), https://tc39.es/proposal-temporal/#sec-temporal.now.timezone diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp index 6e50f03b9d..29153665de 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp @@ -30,8 +30,8 @@ void PlainDateConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_date_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); define_direct_property(vm.names.length, Value(3), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index a08cbaf67c..9ba70eaa67 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -34,39 +34,39 @@ void PlainDatePrototype::initialize(Realm& realm) // 3.3.2 Temporal.PlainDate.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainDate"), Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.month, month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.era, era_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.month, month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.day, day_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.era, era_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.toPlainYearMonth, to_plain_year_month, 0, attr); - define_native_function(vm.names.toPlainMonthDay, to_plain_month_day, 0, attr); - define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr); - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.withCalendar, with_calendar, 1, attr); - define_native_function(vm.names.until, until, 1, attr); - define_native_function(vm.names.since, since, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toPlainDateTime, to_plain_date_time, 0, attr); - define_native_function(vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toPlainYearMonth, to_plain_year_month, 0, attr); + define_native_function(realm, vm.names.toPlainMonthDay, to_plain_month_day, 0, attr); + define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.withCalendar, with_calendar, 1, attr); + define_native_function(realm, vm.names.until, until, 1, attr); + define_native_function(realm, vm.names.since, since, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toPlainDateTime, to_plain_date_time, 0, attr); + define_native_function(realm, vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); } // 3.3.3 get Temporal.PlainDate.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindate.prototype.calendar diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp index 0e4d1147f8..0ce85372d5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp @@ -30,8 +30,8 @@ void PlainDateTimeConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_date_time_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); define_direct_property(vm.names.length, Value(3), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index 30a4738391..25cac88f60 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -35,49 +35,49 @@ void PlainDateTimePrototype::initialize(Realm& realm) // 5.3.2 Temporal.PlainDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainDateTime"), Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.month, month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.minute, minute_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.second, second_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.era, era_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.month, month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.day, day_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hour, hour_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.minute, minute_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.second, second_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.era, era_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.withPlainTime, with_plain_time, 1, attr); - define_native_function(vm.names.withPlainDate, with_plain_date, 1, attr); - define_native_function(vm.names.withCalendar, with_calendar, 1, attr); - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.until, until, 1, attr); - define_native_function(vm.names.since, since, 1, attr); - define_native_function(vm.names.round, round, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); - define_native_function(vm.names.toPlainDate, to_plain_date, 0, attr); - define_native_function(vm.names.toPlainYearMonth, to_plain_year_month, 0, attr); - define_native_function(vm.names.toPlainMonthDay, to_plain_month_day, 0, attr); - define_native_function(vm.names.toPlainTime, to_plain_time, 0, attr); - define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.withPlainTime, with_plain_time, 1, attr); + define_native_function(realm, vm.names.withPlainDate, with_plain_date, 1, attr); + define_native_function(realm, vm.names.withCalendar, with_calendar, 1, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.until, until, 1, attr); + define_native_function(realm, vm.names.since, since, 1, attr); + define_native_function(realm, vm.names.round, round, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); + define_native_function(realm, vm.names.toPlainDate, to_plain_date, 0, attr); + define_native_function(realm, vm.names.toPlainYearMonth, to_plain_year_month, 0, attr); + define_native_function(realm, vm.names.toPlainMonthDay, to_plain_month_day, 0, attr); + define_native_function(realm, vm.names.toPlainTime, to_plain_time, 0, attr); + define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr); } // 5.3.3 get Temporal.PlainDateTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.calendar diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp index 807e1017b5..4cc51a6aa9 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp @@ -31,7 +31,7 @@ void PlainMonthDayConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(2), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.from, from, 1, attr); } // 10.1.1 Temporal.PlainMonthDay ( isoMonth, isoDay [ , calendarLike [ , referenceISOYear ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index aa996c5f20..2c31946da7 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -29,19 +29,19 @@ void PlainMonthDayPrototype::initialize(Realm& realm) // 10.3.2 Temporal.PlainMonthDay.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainMonthDay"), Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.day, day_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.toPlainDate, to_plain_date, 1, attr); - define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toPlainDate, to_plain_date, 1, attr); + define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr); } // 10.3.3 get Temporal.PlainMonthDay.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plainmonthday.prototype.calendar diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp index e4586962c8..6d156a43a3 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp @@ -28,8 +28,8 @@ void PlainTimeConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_plain_time_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index 34e154dc12..7d5f42e237 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -34,29 +34,29 @@ void PlainTimePrototype::initialize(Realm& realm) // 4.3.2 Temporal.PlainTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainTime"), Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.minute, minute_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.second, second_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hour, hour_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.minute, minute_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.second, second_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.until, until, 1, attr); - define_native_function(vm.names.since, since, 1, attr); - define_native_function(vm.names.round, round, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toPlainDateTime, to_plain_date_time, 1, attr); - define_native_function(vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); - define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.until, until, 1, attr); + define_native_function(realm, vm.names.since, since, 1, attr); + define_native_function(realm, vm.names.round, round, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toPlainDateTime, to_plain_date_time, 1, attr); + define_native_function(realm, vm.names.toZonedDateTime, to_zoned_date_time, 1, attr); + define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); } // 4.3.3 get Temporal.PlainTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plaintime.prototype.calendar diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp index ad4da09218..72f43002da 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp @@ -32,8 +32,8 @@ void PlainYearMonthConstructor::initialize(Realm& realm) define_direct_property(vm.names.length, Value(2), Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); } // 9.1.1 Temporal.PlainYearMonth ( isoYear, isoMonth [ , calendarLike [ , referenceISODay ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index abdeb27a7d..0f49d70672 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -31,30 +31,30 @@ void PlainYearMonthPrototype::initialize(Realm& realm) // 9.3.2 Temporal.PlainYearMonth.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.PlainYearMonth"), Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.month, month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.era, era_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.month, month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.era, era_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.until, until, 1, attr); - define_native_function(vm.names.since, since, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.toPlainDate, to_plain_date, 1, attr); - define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.until, until, 1, attr); + define_native_function(realm, vm.names.since, since, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.toPlainDate, to_plain_date, 1, attr); + define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr); } // 9.3.3 get Temporal.PlainYearMonth.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.plainyearmonth.prototype.calendar diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp index c1b0e301c5..9ee77b5887 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp @@ -26,7 +26,7 @@ void TimeZoneConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_time_zone_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.from, from, 1, attr); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 64ae66263f..8b5bb8204b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -29,16 +29,16 @@ void TimeZonePrototype::initialize(Realm& realm) auto& vm = this->vm(); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_accessor(vm.names.id, id_getter, {}, Attribute::Configurable); - define_native_function(vm.names.getOffsetNanosecondsFor, get_offset_nanoseconds_for, 1, attr); - define_native_function(vm.names.getOffsetStringFor, get_offset_string_for, 1, attr); - define_native_function(vm.names.getPlainDateTimeFor, get_plain_date_time_for, 1, attr); - define_native_function(vm.names.getInstantFor, get_instant_for, 1, attr); - define_native_function(vm.names.getPossibleInstantsFor, get_possible_instants_for, 1, attr); - define_native_function(vm.names.getNextTransition, get_next_transition, 1, attr); - define_native_function(vm.names.getPreviousTransition, get_previous_transition, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); + define_native_accessor(realm, vm.names.id, id_getter, {}, Attribute::Configurable); + define_native_function(realm, vm.names.getOffsetNanosecondsFor, get_offset_nanoseconds_for, 1, attr); + define_native_function(realm, vm.names.getOffsetStringFor, get_offset_string_for, 1, attr); + define_native_function(realm, vm.names.getPlainDateTimeFor, get_plain_date_time_for, 1, attr); + define_native_function(realm, vm.names.getInstantFor, get_instant_for, 1, attr); + define_native_function(realm, vm.names.getPossibleInstantsFor, get_possible_instants_for, 1, attr); + define_native_function(realm, vm.names.getNextTransition, get_next_transition, 1, attr); + define_native_function(realm, vm.names.getPreviousTransition, get_previous_transition, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); // 11.4.2 Temporal.TimeZone.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.TimeZone"), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp index 42fe4a6f4b..d695455c51 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp @@ -31,8 +31,8 @@ void ZonedDateTimeConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().temporal_zoned_date_time_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.compare, compare, 2, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.compare, compare, 2, attr); define_direct_property(vm.names.length, Value(2), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index f4d9113ce4..e0e8660802 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -34,60 +34,60 @@ void ZonedDateTimePrototype::initialize(Realm& realm) // 6.3.2 Temporal.ZonedDateTime.prototype[ @@toStringTag ], https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Temporal.ZonedDateTime"), Attribute::Configurable); - define_native_accessor(vm.names.calendar, calendar_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.timeZone, time_zone_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.year, year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.month, month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.minute, minute_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.second, second_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochMicroseconds, epoch_microseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.epochNanoseconds, epoch_nanoseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.hoursInDay, hours_in_day_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.offsetNanoseconds, offset_nanoseconds_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.offset, offset_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.era, era_getter, {}, Attribute::Configurable); - define_native_accessor(vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.calendar, calendar_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.timeZone, time_zone_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.year, year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.month, month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthCode, month_code_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.day, day_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hour, hour_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.minute, minute_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.second, second_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.millisecond, millisecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.microsecond, microsecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.nanosecond, nanosecond_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochSeconds, epoch_seconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochMilliseconds, epoch_milliseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochMicroseconds, epoch_microseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.epochNanoseconds, epoch_nanoseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.dayOfWeek, day_of_week_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.dayOfYear, day_of_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.weekOfYear, week_of_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.hoursInDay, hours_in_day_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInWeek, days_in_week_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInMonth, days_in_month_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.daysInYear, days_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.monthsInYear, months_in_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.inLeapYear, in_leap_year_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.offsetNanoseconds, offset_nanoseconds_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.offset, offset_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.era, era_getter, {}, Attribute::Configurable); + define_native_accessor(realm, vm.names.eraYear, era_year_getter, {}, Attribute::Configurable); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.with, with, 1, attr); - define_native_function(vm.names.withPlainTime, with_plain_time, 0, attr); - define_native_function(vm.names.withPlainDate, with_plain_date, 1, attr); - define_native_function(vm.names.withTimeZone, with_time_zone, 1, attr); - define_native_function(vm.names.withCalendar, with_calendar, 1, attr); - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.subtract, subtract, 1, attr); - define_native_function(vm.names.until, until, 1, attr); - define_native_function(vm.names.since, since, 1, attr); - define_native_function(vm.names.round, round, 1, attr); - define_native_function(vm.names.equals, equals, 1, attr); - define_native_function(vm.names.toString, to_string, 0, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toJSON, to_json, 0, attr); - define_native_function(vm.names.valueOf, value_of, 0, attr); - define_native_function(vm.names.startOfDay, start_of_day, 0, attr); - define_native_function(vm.names.toInstant, to_instant, 0, attr); - define_native_function(vm.names.toPlainDate, to_plain_date, 0, attr); - define_native_function(vm.names.toPlainTime, to_plain_time, 0, attr); - define_native_function(vm.names.toPlainDateTime, to_plain_date_time, 0, attr); - define_native_function(vm.names.toPlainYearMonth, to_plain_year_month, 0, attr); - define_native_function(vm.names.toPlainMonthDay, to_plain_month_day, 0, attr); - define_native_function(vm.names.getISOFields, get_iso_fields, 0, attr); + define_native_function(realm, vm.names.with, with, 1, attr); + define_native_function(realm, vm.names.withPlainTime, with_plain_time, 0, attr); + define_native_function(realm, vm.names.withPlainDate, with_plain_date, 1, attr); + define_native_function(realm, vm.names.withTimeZone, with_time_zone, 1, attr); + define_native_function(realm, vm.names.withCalendar, with_calendar, 1, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.subtract, subtract, 1, attr); + define_native_function(realm, vm.names.until, until, 1, attr); + define_native_function(realm, vm.names.since, since, 1, attr); + define_native_function(realm, vm.names.round, round, 1, attr); + define_native_function(realm, vm.names.equals, equals, 1, attr); + define_native_function(realm, vm.names.toString, to_string, 0, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toJSON, to_json, 0, attr); + define_native_function(realm, vm.names.valueOf, value_of, 0, attr); + define_native_function(realm, vm.names.startOfDay, start_of_day, 0, attr); + define_native_function(realm, vm.names.toInstant, to_instant, 0, attr); + define_native_function(realm, vm.names.toPlainDate, to_plain_date, 0, attr); + define_native_function(realm, vm.names.toPlainTime, to_plain_time, 0, attr); + define_native_function(realm, vm.names.toPlainDateTime, to_plain_date_time, 0, attr); + define_native_function(realm, vm.names.toPlainYearMonth, to_plain_year_month, 0, attr); + define_native_function(realm, vm.names.toPlainMonthDay, to_plain_month_day, 0, attr); + define_native_function(realm, vm.names.getISOFields, get_iso_fields, 0, attr); } // 6.3.3 get Temporal.ZonedDateTime.prototype.calendar, https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.calendar diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index 0d7390f0a3..2282b0f3b8 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -30,10 +30,10 @@ void TypedArrayConstructor::initialize(Realm& realm) define_direct_property(vm.names.prototype, realm.global_object().typed_array_prototype(), 0); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.from, from, 1, attr); - define_native_function(vm.names.of, of, 0, attr); + define_native_function(realm, vm.names.from, from, 1, attr); + define_native_function(realm, vm.names.of, of, 0, attr); - define_native_accessor(*vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); + define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); define_direct_property(vm.names.length, Value(0), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index 48389d04c1..f410547197 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -26,43 +26,43 @@ void TypedArrayPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_accessor(vm.names.buffer, buffer_getter, nullptr, Attribute::Configurable); - define_native_accessor(vm.names.byteLength, byte_length_getter, nullptr, Attribute::Configurable); - define_native_accessor(vm.names.byteOffset, byte_offset_getter, nullptr, Attribute::Configurable); - define_native_accessor(vm.names.length, length_getter, nullptr, Attribute::Configurable); - - define_native_function(vm.names.at, at, 1, attr); - define_native_function(vm.names.copyWithin, copy_within, 2, attr); - define_native_function(vm.names.entries, entries, 0, attr); - define_native_function(vm.names.every, every, 1, attr); - define_native_function(vm.names.fill, fill, 1, attr); - define_native_function(vm.names.filter, filter, 1, attr); - define_native_function(vm.names.find, find, 1, attr); - define_native_function(vm.names.findIndex, find_index, 1, attr); - define_native_function(vm.names.findLast, find_last, 1, attr); - define_native_function(vm.names.findLastIndex, find_last_index, 1, attr); - define_native_function(vm.names.forEach, for_each, 1, attr); - define_native_function(vm.names.includes, includes, 1, attr); - define_native_function(vm.names.indexOf, index_of, 1, attr); - define_native_function(vm.names.join, join, 1, attr); - define_native_function(vm.names.keys, keys, 0, attr); - define_native_function(vm.names.lastIndexOf, last_index_of, 1, attr); - define_native_function(vm.names.map, map, 1, attr); - define_native_function(vm.names.reduce, reduce, 1, attr); - define_native_function(vm.names.reduceRight, reduce_right, 1, attr); - define_native_function(vm.names.reverse, reverse, 0, attr); - define_native_function(vm.names.set, set, 1, attr); - define_native_function(vm.names.slice, slice, 2, attr); - define_native_function(vm.names.some, some, 1, attr); - define_native_function(vm.names.sort, sort, 1, attr); - define_native_function(vm.names.subarray, subarray, 2, attr); - define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); - define_native_function(vm.names.toReversed, to_reversed, 0, attr); - define_native_function(vm.names.toSorted, to_sorted, 1, attr); - define_native_function(vm.names.with, with, 2, attr); - define_native_function(vm.names.values, values, 0, attr); - - define_native_accessor(*vm.well_known_symbol_to_string_tag(), to_string_tag_getter, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.names.buffer, buffer_getter, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.names.byteLength, byte_length_getter, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.names.byteOffset, byte_offset_getter, nullptr, Attribute::Configurable); + define_native_accessor(realm, vm.names.length, length_getter, nullptr, Attribute::Configurable); + + define_native_function(realm, vm.names.at, at, 1, attr); + define_native_function(realm, vm.names.copyWithin, copy_within, 2, attr); + define_native_function(realm, vm.names.entries, entries, 0, attr); + define_native_function(realm, vm.names.every, every, 1, attr); + define_native_function(realm, vm.names.fill, fill, 1, attr); + define_native_function(realm, vm.names.filter, filter, 1, attr); + define_native_function(realm, vm.names.find, find, 1, attr); + define_native_function(realm, vm.names.findIndex, find_index, 1, attr); + define_native_function(realm, vm.names.findLast, find_last, 1, attr); + define_native_function(realm, vm.names.findLastIndex, find_last_index, 1, attr); + define_native_function(realm, vm.names.forEach, for_each, 1, attr); + define_native_function(realm, vm.names.includes, includes, 1, attr); + define_native_function(realm, vm.names.indexOf, index_of, 1, attr); + define_native_function(realm, vm.names.join, join, 1, attr); + define_native_function(realm, vm.names.keys, keys, 0, attr); + define_native_function(realm, vm.names.lastIndexOf, last_index_of, 1, attr); + define_native_function(realm, vm.names.map, map, 1, attr); + define_native_function(realm, vm.names.reduce, reduce, 1, attr); + define_native_function(realm, vm.names.reduceRight, reduce_right, 1, attr); + define_native_function(realm, vm.names.reverse, reverse, 0, attr); + define_native_function(realm, vm.names.set, set, 1, attr); + define_native_function(realm, vm.names.slice, slice, 2, attr); + define_native_function(realm, vm.names.some, some, 1, attr); + define_native_function(realm, vm.names.sort, sort, 1, attr); + define_native_function(realm, vm.names.subarray, subarray, 2, attr); + define_native_function(realm, vm.names.toLocaleString, to_locale_string, 0, attr); + define_native_function(realm, vm.names.toReversed, to_reversed, 0, attr); + define_native_function(realm, vm.names.toSorted, to_sorted, 1, attr); + define_native_function(realm, vm.names.with, with, 2, attr); + define_native_function(realm, vm.names.values, values, 0, attr); + + define_native_accessor(realm, *vm.well_known_symbol_to_string_tag(), to_string_tag_getter, nullptr, Attribute::Configurable); // 23.2.3.32 %TypedArray%.prototype.toString ( ), https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring define_direct_property(vm.names.toString, realm.global_object().array_prototype()->get_without_side_effects(vm.names.toString), attr); diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp index 539807fca1..8f311fcb2d 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -22,10 +22,10 @@ void WeakMapPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.delete_, delete_, 1, attr); - define_native_function(vm.names.get, get, 1, attr); - define_native_function(vm.names.has, has, 1, attr); - define_native_function(vm.names.set, set, 2, attr); + define_native_function(realm, vm.names.delete_, delete_, 1, attr); + define_native_function(realm, vm.names.get, get, 1, attr); + define_native_function(realm, vm.names.has, has, 1, attr); + define_native_function(realm, vm.names.set, set, 2, attr); // 24.3.3.6 WeakMap.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-weakmap.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakMap.as_string()), Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp index d282d4a07a..bd90ec7865 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp @@ -19,7 +19,7 @@ void WeakRefPrototype::initialize(Realm& realm) auto& vm = this->vm(); Object::initialize(realm); - define_native_function(vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable); + define_native_function(realm, vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable); define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakRef.as_string()), Attribute::Configurable); } diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index 9040447d7a..f1c0833b75 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -22,9 +22,9 @@ void WeakSetPrototype::initialize(Realm& realm) Object::initialize(realm); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.add, add, 1, attr); - define_native_function(vm.names.delete_, delete_, 1, attr); - define_native_function(vm.names.has, has, 1, attr); + define_native_function(realm, vm.names.add, add, 1, attr); + define_native_function(realm, vm.names.delete_, delete_, 1, attr); + define_native_function(realm, vm.names.has, has, 1, attr); // 24.4.3.5 WeakSet.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-weakset.prototype-@@tostringtag define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakSet.as_string()), Attribute::Configurable); |