Pārlūkot izejas kodu

LibJS: Pass Realm to define_native_{accessor,function}()

This is needed so that the allocated NativeFunction receives the correct
realm, usually forwarded from the Object's initialize() function, rather
than using the current realm.
Linus Groh 2 gadi atpakaļ
vecāks
revīzija
e3895e6c80
100 mainītis faili ar 767 papildinājumiem un 768 dzēšanām
  1. 1 1
      Meta/Lagom/Fuzzers/FuzzilliJs.cpp
  2. 9 9
      Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp
  3. 2 2
      Tests/LibWasm/test-wasm.cpp
  4. 9 9
      Userland/Applications/Spreadsheet/JSIntegration.cpp
  5. 4 4
      Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp
  6. 2 2
      Userland/Libraries/LibJS/Contrib/Test262/AgentObject.cpp
  7. 1 1
      Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp
  8. 1 0
      Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
  9. 2 2
      Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp
  10. 2 2
      Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.cpp
  11. 4 4
      Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp
  12. 1 1
      Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.cpp
  13. 40 40
      Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
  14. 3 3
      Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp
  15. 1 1
      Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.cpp
  16. 10 10
      Userland/Libraries/LibJS/Runtime/AtomicsObject.cpp
  17. 2 2
      Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp
  18. 3 3
      Userland/Libraries/LibJS/Runtime/BigIntPrototype.cpp
  19. 2 2
      Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp
  20. 16 16
      Userland/Libraries/LibJS/Runtime/ConsoleObject.cpp
  21. 24 24
      Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp
  22. 3 3
      Userland/Libraries/LibJS/Runtime/DateConstructor.cpp
  23. 48 48
      Userland/Libraries/LibJS/Runtime/DatePrototype.cpp
  24. 2 2
      Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp
  25. 3 3
      Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp
  26. 5 5
      Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp
  27. 3 3
      Userland/Libraries/LibJS/Runtime/GeneratorPrototype.cpp
  28. 12 12
      Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
  29. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp
  30. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.cpp
  31. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
  32. 5 5
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.cpp
  33. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp
  34. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.cpp
  35. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp
  36. 3 3
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.cpp
  37. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/Intl.cpp
  38. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp
  39. 3 3
      Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.cpp
  40. 20 20
      Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.cpp
  41. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp
  42. 5 5
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.cpp
  43. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
  44. 3 3
      Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.cpp
  45. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp
  46. 3 3
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.cpp
  47. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.cpp
  48. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp
  49. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.cpp
  50. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.cpp
  51. 1 1
      Userland/Libraries/LibJS/Runtime/IteratorPrototype.cpp
  52. 2 2
      Userland/Libraries/LibJS/Runtime/JSONObject.cpp
  53. 1 1
      Userland/Libraries/LibJS/Runtime/MapConstructor.cpp
  54. 1 1
      Userland/Libraries/LibJS/Runtime/MapIteratorPrototype.cpp
  55. 11 11
      Userland/Libraries/LibJS/Runtime/MapPrototype.cpp
  56. 35 35
      Userland/Libraries/LibJS/Runtime/MathObject.cpp
  57. 4 4
      Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
  58. 6 6
      Userland/Libraries/LibJS/Runtime/NumberPrototype.cpp
  59. 2 4
      Userland/Libraries/LibJS/Runtime/Object.cpp
  60. 2 2
      Userland/Libraries/LibJS/Runtime/Object.h
  61. 22 22
      Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
  62. 11 11
      Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp
  63. 8 8
      Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
  64. 3 3
      Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp
  65. 1 1
      Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp
  66. 13 13
      Userland/Libraries/LibJS/Runtime/ReflectObject.cpp
  67. 1 1
      Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp
  68. 12 12
      Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
  69. 1 1
      Userland/Libraries/LibJS/Runtime/RegExpStringIteratorPrototype.cpp
  70. 1 1
      Userland/Libraries/LibJS/Runtime/SetConstructor.cpp
  71. 1 1
      Userland/Libraries/LibJS/Runtime/SetIteratorPrototype.cpp
  72. 8 8
      Userland/Libraries/LibJS/Runtime/SetPrototype.cpp
  73. 2 2
      Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp
  74. 3 3
      Userland/Libraries/LibJS/Runtime/StringConstructor.cpp
  75. 1 1
      Userland/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp
  76. 47 47
      Userland/Libraries/LibJS/Runtime/StringPrototype.cpp
  77. 2 2
      Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp
  78. 4 4
      Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp
  79. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp
  80. 24 24
      Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp
  81. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp
  82. 23 23
      Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp
  83. 6 6
      Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp
  84. 16 16
      Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp
  85. 9 9
      Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp
  86. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp
  87. 31 31
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp
  88. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
  89. 41 41
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp
  90. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp
  91. 11 11
      Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp
  92. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp
  93. 21 21
      Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp
  94. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp
  95. 22 22
      Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp
  96. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp
  97. 10 10
      Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp
  98. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp
  99. 52 52
      Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp
  100. 3 3
      Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp

+ 1 - 1
Meta/Lagom/Fuzzers/FuzzilliJs.cpp

@@ -172,7 +172,7 @@ void TestRunnerGlobalObject::initialize_global_object(JS::Realm& realm)
 {
     Base::initialize_global_object(realm);
     define_direct_property("global", this, JS::Attribute::Enumerable);
-    define_native_function("fuzzilli", fuzzilli, 2, JS::default_attributes);
+    define_native_function(realm, "fuzzilli", fuzzilli, 2, JS::default_attributes);
 }
 
 int main(int, char**)

+ 9 - 9
Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp

@@ -3033,7 +3033,7 @@ void @constructor_class@::initialize(JS::Realm& realm)
         function_generator.set("function.length", String::number(get_shortest_function_length(overload_set.value)));
 
         function_generator.append(R"~~~(
-    define_native_function("@function.name@", @function.name:snakecase@, @function.length@, default_attributes);
+    define_native_function(realm, "@function.name@", @function.name:snakecase@, @function.length@, default_attributes);
 )~~~");
     }
 
@@ -3280,7 +3280,7 @@ void @prototype_class@::initialize(JS::Realm& realm)
         }
 
         attribute_generator.append(R"~~~(
-    define_native_accessor("@attribute.name@", @attribute.getter_callback@, @attribute.setter_callback@, default_attributes);
+    define_native_accessor(realm, "@attribute.name@", @attribute.getter_callback@, @attribute.setter_callback@, default_attributes);
 )~~~");
     }
 
@@ -3313,7 +3313,7 @@ void @prototype_class@::initialize(JS::Realm& realm)
         }
 
         function_generator.append(R"~~~(
-    define_native_function("@function.name@", @function.name:snakecase@, @function.length@, default_attributes);
+    define_native_function(realm, "@function.name@", @function.name:snakecase@, @function.length@, default_attributes);
 )~~~");
     }
 
@@ -3322,7 +3322,7 @@ void @prototype_class@::initialize(JS::Realm& realm)
 
         auto stringifier_generator = generator.fork();
         stringifier_generator.append(R"~~~(
-    define_native_function("toString", to_string, 0, default_attributes);
+    define_native_function(realm, "toString", to_string, 0, default_attributes);
 )~~~");
     }
 
@@ -3349,10 +3349,10 @@ void @prototype_class@::initialize(JS::Realm& realm)
 
         auto iterator_generator = generator.fork();
         iterator_generator.append(R"~~~(
-    define_native_function(vm.names.entries, entries, 0, default_attributes);
-    define_native_function(vm.names.forEach, for_each, 1, default_attributes);
-    define_native_function(vm.names.keys, keys, 0, default_attributes);
-    define_native_function(vm.names.values, values, 0, default_attributes);
+    define_native_function(realm, vm.names.entries, entries, 0, default_attributes);
+    define_native_function(realm, vm.names.forEach, for_each, 1, default_attributes);
+    define_native_function(realm, vm.names.keys, keys, 0, default_attributes);
+    define_native_function(realm, vm.names.values, values, 0, default_attributes);
 
     define_direct_property(*vm.well_known_symbol_iterator(), get_without_side_effects(vm.names.entries), JS::Attribute::Configurable | JS::Attribute::Writable);
 )~~~");
@@ -3809,7 +3809,7 @@ void @prototype_class@::initialize(JS::Realm& realm)
     auto& vm = this->vm();
     Object::initialize(realm);
 
-    define_native_function(vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
+    define_native_function(realm, vm.names.next, next, 0, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
     define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Iterator"), JS::Attribute::Configurable);
 }
 

+ 2 - 2
Tests/LibWasm/test-wasm.cpp

@@ -153,8 +153,8 @@ TESTJS_GLOBAL_FUNCTION(compare_typed_arrays, compareTypedArrays)
 void WebAssemblyModule::initialize(JS::Realm& realm)
 {
     Base::initialize(realm);
-    define_native_function("getExport", get_export, 1, JS::default_attributes);
-    define_native_function("invoke", wasm_invoke, 1, JS::default_attributes);
+    define_native_function(realm, "getExport", get_export, 1, JS::default_attributes);
+    define_native_function(realm, "invoke", wasm_invoke, 1, JS::default_attributes);
 }
 
 JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export)

+ 9 - 9
Userland/Applications/Spreadsheet/JSIntegration.cpp

@@ -148,14 +148,14 @@ void SheetGlobalObject::initialize_global_object(JS::Realm& realm)
 {
     Base::initialize_global_object(realm);
     u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
-    define_native_function("get_real_cell_contents", get_real_cell_contents, 1, attr);
-    define_native_function("set_real_cell_contents", set_real_cell_contents, 2, attr);
-    define_native_function("parse_cell_name", parse_cell_name, 1, attr);
-    define_native_function("current_cell_position", current_cell_position, 0, attr);
-    define_native_function("column_arithmetic", column_arithmetic, 2, attr);
-    define_native_function("column_index", column_index, 1, attr);
-    define_native_function("get_column_bound", get_column_bound, 1, attr);
-    define_native_accessor("name", get_name, nullptr, attr);
+    define_native_function(realm, "get_real_cell_contents", get_real_cell_contents, 1, attr);
+    define_native_function(realm, "set_real_cell_contents", set_real_cell_contents, 2, attr);
+    define_native_function(realm, "parse_cell_name", parse_cell_name, 1, attr);
+    define_native_function(realm, "current_cell_position", current_cell_position, 0, attr);
+    define_native_function(realm, "column_arithmetic", column_arithmetic, 2, attr);
+    define_native_function(realm, "column_index", column_index, 1, attr);
+    define_native_function(realm, "get_column_bound", get_column_bound, 1, attr);
+    define_native_accessor(realm, "name", get_name, nullptr, attr);
 }
 
 void SheetGlobalObject::visit_edges(Visitor& visitor)
@@ -378,7 +378,7 @@ WorkbookObject::WorkbookObject(JS::Realm& realm, Workbook& workbook)
 void WorkbookObject::initialize(JS::Realm& realm)
 {
     Object::initialize(realm);
-    define_native_function("sheet", sheet, 1, JS::default_attributes);
+    define_native_function(realm, "sheet", sheet, 1, JS::default_attributes);
 }
 
 void WorkbookObject::visit_edges(Visitor& visitor)

+ 4 - 4
Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp

@@ -31,10 +31,10 @@ void $262Object::initialize(Realm& realm)
     m_is_htmldda = vm().heap().allocate<IsHTMLDDA>(realm, realm);
 
     u8 attr = Attribute::Writable | Attribute::Configurable;
-    define_native_function("clearKeptObjects", clear_kept_objects, 0, attr);
-    define_native_function("createRealm", create_realm, 0, attr);
-    define_native_function("detachArrayBuffer", detach_array_buffer, 1, attr);
-    define_native_function("evalScript", eval_script, 1, attr);
+    define_native_function(realm, "clearKeptObjects", clear_kept_objects, 0, attr);
+    define_native_function(realm, "createRealm", create_realm, 0, attr);
+    define_native_function(realm, "detachArrayBuffer", detach_array_buffer, 1, attr);
+    define_native_function(realm, "evalScript", eval_script, 1, attr);
 
     define_direct_property("agent", m_agent, attr);
     define_direct_property("gc", realm.global_object().get_without_side_effects("gc"), attr);

+ 2 - 2
Userland/Libraries/LibJS/Contrib/Test262/AgentObject.cpp

@@ -22,8 +22,8 @@ void AgentObject::initialize(JS::Realm& realm)
     Base::initialize(realm);
 
     u8 attr = Attribute::Writable | Attribute::Configurable;
-    define_native_function("monotonicNow", monotonic_now, 0, attr);
-    define_native_function("sleep", sleep, 1, attr);
+    define_native_function(realm, "monotonicNow", monotonic_now, 0, attr);
+    define_native_function(realm, "sleep", sleep, 1, attr);
     // TODO: broadcast
     // TODO: getReport
     // TODO: start

+ 1 - 1
Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.cpp

@@ -22,7 +22,7 @@ void GlobalObject::initialize_global_object(Realm& realm)
 
     // https://github.com/tc39/test262/blob/master/INTERPRETING.md#host-defined-functions
     u8 attr = Attribute::Writable | Attribute::Configurable;
-    define_native_function("print", print, 1, attr);
+    define_native_function(realm, "print", print, 1, attr);
     define_direct_property("$262", m_$262, attr);
 }
 

+ 1 - 0
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));

+ 2 - 2
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);
 }

+ 2 - 2
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);

+ 4 - 4
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);
 }

+ 1 - 1
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);

+ 40 - 40
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)

+ 3 - 3
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

+ 1 - 1
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

+ 10 - 10
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);

+ 2 - 2
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);
 }

+ 3 - 3
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);

+ 2 - 2
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

+ 16 - 16
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

+ 24 - 24
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);

+ 3 - 3
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);
 }

+ 48 - 48
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.

+ 2 - 2
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

+ 3 - 3
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);

+ 5 - 5
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);
 }

+ 3 - 3
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);

+ 12 - 12
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);

+ 1 - 1
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

+ 2 - 2
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

+ 1 - 1
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);
 }

+ 5 - 5
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

+ 1 - 1
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);
 }

+ 2 - 2
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

+ 1 - 1
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

+ 3 - 3
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

+ 2 - 2
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

+ 1 - 1
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);
 }

+ 3 - 3
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

+ 20 - 20
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

+ 1 - 1
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);
 }

+ 5 - 5
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

+ 1 - 1
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

+ 3 - 3
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

+ 1 - 1
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

+ 3 - 3
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

+ 1 - 1
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

+ 1 - 1
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

+ 2 - 2
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

+ 2 - 2
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

+ 1 - 1
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

+ 2 - 2
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);

+ 1 - 1
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);
 }

+ 1 - 1
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);
 }
 

+ 11 - 11
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);

+ 35 - 35
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);

+ 4 - 4
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);

+ 6 - 6
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

+ 2 - 4
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);
 }

+ 2 - 2
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; }

+ 22 - 22
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);
 }

+ 11 - 11
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

+ 8 - 8
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);
 }

+ 3 - 3
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);

+ 1 - 1
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);
 }

+ 13 - 13
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);

+ 1 - 1
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);
 }

+ 12 - 12
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
 }

+ 1 - 1
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);

+ 1 - 1
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);
 }

+ 1 - 1
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);

+ 8 - 8
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);
 

+ 2 - 2
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);

+ 3 - 3
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);
 }

+ 1 - 1
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);

+ 47 - 47
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

+ 2 - 2
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);

+ 4 - 4
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);

+ 1 - 1
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);
 }

+ 24 - 24
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

+ 2 - 2
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);
 }

+ 23 - 23
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

+ 6 - 6
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);
 }

+ 16 - 16
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

+ 9 - 9
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

+ 2 - 2
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);
 }

+ 31 - 31
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

+ 2 - 2
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);
 }

+ 41 - 41
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

+ 1 - 1
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

+ 11 - 11
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

+ 2 - 2
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);
 }

+ 21 - 21
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

+ 2 - 2
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

+ 22 - 22
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

+ 1 - 1
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);
 }

+ 10 - 10
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);

+ 2 - 2
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);
 }

+ 52 - 52
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

+ 3 - 3
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);
 }

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels