Truly independent web browser
LibJS: Allocate every object in an explicit realm
Shannon Booth5ea69e019d45
diff --git a/Libraries/LibJS/Rust/src/contrib/test262/is_htmldda.rs b/Libraries/LibJS/Rust/src/contrib/test262/is_htmldda.rsindex 69134fa0c92..d7ea73282cf 100644--- a/Libraries/LibJS/Rust/src/contrib/test262/is_htmldda.rs+++ b/Libraries/LibJS/Rust/src/contrib/test262/is_htmldda.rs@@ -56,11 +56,12 @@ impl Deref for IsHTMLDDA {impl IsHTMLDDA {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<IsHTMLDDA> {// NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)- let base = NativeFunction::new_with_name(+ let base = NativeFunction::new_with_prototype(vm,Self::CLASS,- Utf16FlyString::from_utf8("IsHTMLDDA"),+ realm,realm.function_prototype(),+ Some(Utf16FlyString::from_utf8("IsHTMLDDA")),);base.set_is_htmldda(vm);realm.create_object(vm, |_| IsHTMLDDA { base })diff --git a/Libraries/LibJS/Rust/src/embedding/error.rs b/Libraries/LibJS/Rust/src/embedding/error.rsindex 174ad03554d..54a9b7b248c 100644--- a/Libraries/LibJS/Rust/src/embedding/error.rs+++ b/Libraries/LibJS/Rust/src/embedding/error.rs@@ -102,7 +102,7 @@ pub unsafe extern "C" fn js_error_create_with_prototype(let vm = unsafe { vm_from_abi(vm) };// SAFETY: The caller passes a realm and an object of the VM.let (realm, prototype) = unsafe { (cell_from_abi(realm), cell_from_abi(prototype)) };- let error = realm.create_object(vm, |_| Error::new(vm, Error::CLASS, prototype));+ let error = realm.create_object(vm, |_| Error::new(vm, realm, Error::CLASS, prototype));cell_into_abi(error.upcast())}diff --git a/Libraries/LibJS/Rust/src/embedding/host/host_function.rs b/Libraries/LibJS/Rust/src/embedding/host/host_function.rsindex 686e8eba174..33b526aa6cb 100644--- a/Libraries/LibJS/Rust/src/embedding/host/host_function.rs+++ b/Libraries/LibJS/Rust/src/embedding/host/host_function.rs@@ -168,7 +168,7 @@ impl HostFunction {}/// HostFunction::create_without_own_properties(): for a caller that defines the function's own properties- /// itself, in an order of its own. The function's realm is that of the shape of its prototype, which defaults to+ /// itself, in an order of its own. The function's realm is `realm`, and its prototype defaults to the realm's/// %Function.prototype%.////// # Safety@@ -184,7 +184,7 @@ impl HostFunction {) -> Gc<HostFunction> {let (class, allocator) = runtime_class_and_allocator_of_host_class(vm, table, JS_HOST_CLASS_FUNCTION);let prototype = prototype.unwrap_or_else(|| realm.function_prototype());- let base = NativeFunction::new_with_name(vm, class, name, prototype);+ let base = NativeFunction::new_with_prototype(vm, class, realm, prototype, Some(name));copy_host_class_flags_into_object(vm, table, &base);let function = HostFunction {base,@@ -203,7 +203,7 @@ impl HostFunction {/// HostFunction::create(): a function of `host_class`, a table of kind JS_HOST_CLASS_FUNCTION, whose name is a copy of/// the code units `name` views. It defines "length" and then "name", as CreateBuiltinFunction does. Its [[Prototype]]-/// is `prototype_or_null`, or %Function.prototype% of the realm for null, and its realm that of the prototype's shape.+/// is `prototype_or_null`, or %Function.prototype% of the realm for null, and its realm `realm`./// The function keeps `host_data_or_null` alive. Returns an unrooted function. Main thread only.#[unsafe(no_mangle)]pub unsafe extern "C" fn js_host_function_create(diff --git a/Libraries/LibJS/Rust/src/embedding/host/host_object.rs b/Libraries/LibJS/Rust/src/embedding/host/host_object.rsindex b255772ea9d..e26592c7dd3 100644--- a/Libraries/LibJS/Rust/src/embedding/host/host_object.rs+++ b/Libraries/LibJS/Rust/src/embedding/host/host_object.rs@@ -444,7 +444,7 @@ impl HostObject {}Object::new_with_shape(class, shape, MayInterfereWithIndexedPropertyAccess::No)} else {- Object::new_with_realm_and_prototype(vm, class, realm, prototype, MayInterfereWithIndexedPropertyAccess::No)+ Object::new_with_prototype(vm, class, realm, prototype, MayInterfereWithIndexedPropertyAccess::No)};copy_host_class_flags_into_object(vm, table, &base);let host_object = HostObject {diff --git a/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rs b/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rsindex 49e72e6e94e..14dd0b305e4 100644--- a/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rs+++ b/Libraries/LibJS/Rust/src/interpreter/slow_paths/calls.rs@@ -642,7 +642,12 @@ pub fn call_construct(get_prototype_from_constructor(vm, function.as_function_object_gc(), Intrinsics::object_prototype));// NB: OrdinaryObjectCreate(prototype), with room for the properties the constructor is known to add.- let this_object = Object::create_for_construct(vm, prototype, function.shared_data());+ let this_object = Object::create_for_construct(+ vm,+ vm.current_realm().expect("a construction runs in a realm"),+ prototype,+ function.shared_data(),+ );let Some(context) = vm.push_inline_frame(function,function.inline_call_executable(),diff --git a/Libraries/LibJS/Rust/src/jit/calls.rs b/Libraries/LibJS/Rust/src/jit/calls.rsindex 2ea59e0edc0..a84bc6b8d79 100644--- a/Libraries/LibJS/Rust/src/jit/calls.rs+++ b/Libraries/LibJS/Rust/src/jit/calls.rs@@ -204,7 +204,14 @@ fn construct_ecmascript_function_from_jit(// a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%Object.prototype%").// NB: With room for the properties the constructor is known to add.match get_prototype_from_constructor(vm, function.as_function_object_gc(), Intrinsics::object_prototype) {- Ok(prototype) => this_argument = Some(Object::create_for_construct(vm, prototype, function.shared_data())),+ Ok(prototype) => {+ this_argument = Some(Object::create_for_construct(+ vm,+ vm.current_realm().expect("a construction runs in a realm"),+ prototype,+ function.shared_data(),+ ));+ }Err(throw) => return handle_asm_exception(vm, site.pc, throw.value()),}}diff --git a/Libraries/LibJS/Rust/src/runtime/abstract_operations.rs b/Libraries/LibJS/Rust/src/runtime/abstract_operations.rsindex 73d0403051e..a3814b75a3c 100644--- a/Libraries/LibJS/Rust/src/runtime/abstract_operations.rs+++ b/Libraries/LibJS/Rust/src/runtime/abstract_operations.rs@@ -772,7 +772,13 @@ pub fn ordinary_create_from_constructor(intrinsic_default_prototype: IntrinsicDefaultPrototype,) -> ThrowCompletionOr<Gc<Object>> {ordinary_create_from_constructor_of(vm, realm, constructor, intrinsic_default_prototype, |_, prototype| {- Object::new_with_prototype(vm, Object::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No)+ Object::new_with_prototype(+ vm,+ Object::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ )})}diff --git a/Libraries/LibJS/Rust/src/runtime/aggregate_error.rs b/Libraries/LibJS/Rust/src/runtime/aggregate_error.rsindex a379a485435..414ac5be028 100644--- a/Libraries/LibJS/Rust/src/runtime/aggregate_error.rs+++ b/Libraries/LibJS/Rust/src/runtime/aggregate_error.rs@@ -32,21 +32,21 @@ impl Deref for AggregateError {}impl AggregateError {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> AggregateError {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> AggregateError {AggregateError {- base: Error::new(vm, Self::CLASS, prototype),+ base: Error::new(vm, realm, Self::CLASS, prototype),}}- pub fn new_in_constructor(vm: &Vm, prototype: Gc<Object>) -> AggregateError {+ pub fn new_in_constructor(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> AggregateError {AggregateError {- base: Error::new_in_constructor(vm, Self::CLASS, prototype),+ base: Error::new_in_constructor(vm, realm, Self::CLASS, prototype),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<AggregateError> {realm.create_object(vm, |_| {- AggregateError::new(vm, realm.intrinsics().aggregate_error_prototype(vm))+ AggregateError::new(vm, realm, realm.intrinsics().aggregate_error_prototype(vm))})}}diff --git a/Libraries/LibJS/Rust/src/runtime/aggregate_error_constructor.rs b/Libraries/LibJS/Rust/src/runtime/aggregate_error_constructor.rsindex 76fa7f35c43..155d576c6f0 100644--- a/Libraries/LibJS/Rust/src/runtime/aggregate_error_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/aggregate_error_constructor.rs@@ -43,7 +43,9 @@ impl AggregateErrorConstructor {base: NativeFunction::new_with_prototype(vm,Self::CLASS,+ realm,realm.intrinsics().error_constructor(vm).upcast(),+ None,),})}@@ -85,7 +87,7 @@ impl AggregateErrorConstructor {// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%AggregateError.prototype%", « [[ErrorData]] »).let prototype = get_prototype_from_constructor(vm, new_target, Intrinsics::aggregate_error_prototype)?;- let aggregate_error = realm.create_object(vm, |_| AggregateError::new_in_constructor(vm, prototype));+ let aggregate_error = realm.create_object(vm, |_| AggregateError::new_in_constructor(vm, realm, prototype));// 3. If message is not undefined, thenif !message.is_undefined() {diff --git a/Libraries/LibJS/Rust/src/runtime/aggregate_error_prototype.rs b/Libraries/LibJS/Rust/src/runtime/aggregate_error_prototype.rsindex 2097453880a..46dc1cd5579 100644--- a/Libraries/LibJS/Rust/src/runtime/aggregate_error_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/aggregate_error_prototype.rs@@ -34,7 +34,8 @@ impl AggregateErrorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().error_prototype(vm),+ realm,+ Some(realm.intrinsics().error_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/array.rs b/Libraries/LibJS/Rust/src/runtime/array.rsindex 8faea5a336c..778c054e5c3 100644--- a/Libraries/LibJS/Rust/src/runtime/array.rs+++ b/Libraries/LibJS/Rust/src/runtime/array.rs@@ -89,7 +89,13 @@ impl Array {shape.create_prototype_transition(vm, Some(prototype)),MayInterfereWithIndexedPropertyAccess::No,),- None => Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ None => Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),};let array = Self { base };array.base.set_has_magical_length_property();diff --git a/Libraries/LibJS/Rust/src/runtime/array_buffer.rs b/Libraries/LibJS/Rust/src/runtime/array_buffer.rsindex f9dd131b055..6f103f3d03b 100644--- a/Libraries/LibJS/Rust/src/runtime/array_buffer.rs+++ b/Libraries/LibJS/Rust/src/runtime/array_buffer.rs@@ -888,9 +888,21 @@ fn prototype_for_shared_state(vm: &Vm, realm: Gc<Realm>, is_shared: Shared) -> G}impl ArrayBuffer {- fn new_with_buffer(vm: &Vm, buffer: OwnedBackingStore, is_shared: Shared, prototype: Gc<Object>) -> Self {+ fn new_with_buffer(+ vm: &Vm,+ realm: Gc<Realm>,+ buffer: OwnedBackingStore,+ is_shared: Shared,+ prototype: Gc<Object>,+ ) -> Self {Self {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),data_block: GcRefCell::new(DataBlock::new(buffer, is_shared)),max_byte_length: Cell::new(None),detach_key: Cell::new(Value::UNDEFINED),@@ -898,9 +910,15 @@ impl ArrayBuffer {}}- pub fn new(vm: &Vm, is_shared: Shared, prototype: Gc<Object>) -> Self {+ pub fn new(vm: &Vm, realm: Gc<Realm>, is_shared: Shared, prototype: Gc<Object>) -> Self {Self {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),data_block: GcRefCell::new(DataBlock::empty(is_shared)),max_byte_length: Cell::new(None),detach_key: Cell::new(Value::UNDEFINED),@@ -926,7 +944,9 @@ impl ArrayBuffer {};let prototype = prototype_for_shared_state(vm, realm, is_shared);- Ok(realm.create_object(vm, |_| ArrayBuffer::new_with_buffer(vm, buffer, is_shared, prototype)))+ Ok(realm.create_object(vm, |_| {+ ArrayBuffer::new_with_buffer(vm, realm, buffer, is_shared, prototype)+ }))}/// ArrayBuffer::create(Realm&, ByteBuffer, DataBlock::Shared)@@ -935,7 +955,7 @@ impl ArrayBuffer {OwnedBackingStore::create_uninitialized(bytes.len()).expect("allocating the data block succeeds");let prototype = prototype_for_shared_state(vm, realm, is_shared);let array_buffer = realm.create_object(vm, |_| {- ArrayBuffer::new_with_buffer(vm, owned_buffer, is_shared, prototype)+ ArrayBuffer::new_with_buffer(vm, realm, owned_buffer, is_shared, prototype)});array_buffer.overwrite(0, bytes);vm.heap()@@ -966,7 +986,9 @@ impl ArrayBuffer {);};let prototype = prototype_for_shared_state(vm, realm, is_shared);- let array_buffer = realm.create_object(vm, |_| ArrayBuffer::new_with_buffer(vm, buffer, is_shared, prototype));+ let array_buffer = realm.create_object(vm, |_| {+ ArrayBuffer::new_with_buffer(vm, realm, buffer, is_shared, prototype)+ });array_buffer.with_data_block(|data_block| {let written = if byte_length == 0 {write(&mut [])@@ -990,7 +1012,7 @@ impl ArrayBuffer {pub fn create_from_data_block(vm: &Vm, realm: Gc<Realm>, block: DataBlock) -> Gc<ArrayBuffer> {let is_shared = block.is_shared;let prototype = prototype_for_shared_state(vm, realm, is_shared);- let array_buffer = realm.create_object(vm, |_| ArrayBuffer::new(vm, is_shared, prototype));+ let array_buffer = realm.create_object(vm, |_| ArrayBuffer::new(vm, realm, is_shared, prototype));array_buffer.set_data_block(vm, block);array_buffer}@@ -1701,7 +1723,7 @@ pub fn allocate_array_buffer(realm,constructor,Intrinsics::array_buffer_prototype,- |_, prototype| ArrayBuffer::new(vm, Shared::No, prototype),+ |_, prototype| ArrayBuffer::new(vm, realm, Shared::No, prototype),)?;// 5. Let block be ? CreateByteDataBlock(byteLength).@@ -1906,7 +1928,7 @@ pub fn allocate_shared_array_buffer(realm,constructor,Intrinsics::shared_array_buffer_prototype,- |_, prototype| ArrayBuffer::new(vm, Shared::Yes, prototype),+ |_, prototype| ArrayBuffer::new(vm, realm, Shared::Yes, prototype),)?;// 6. If allocatingGrowableBuffer is true, let allocLength be maxByteLength; otherwise let allocLength be byteLength.diff --git a/Libraries/LibJS/Rust/src/runtime/array_buffer_constructor.rs b/Libraries/LibJS/Rust/src/runtime/array_buffer_constructor.rsindex 16268facbfb..5e32717c00e 100644--- a/Libraries/LibJS/Rust/src/runtime/array_buffer_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/array_buffer_constructor.rs@@ -38,11 +38,12 @@ define_native_function_class!(impl ArrayBufferConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ArrayBufferConstructor> {realm.create_object(vm, |_| ArrayBufferConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.ArrayBuffer.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.ArrayBuffer.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/array_buffer_prototype.rs b/Libraries/LibJS/Rust/src/runtime/array_buffer_prototype.rsindex 2fcfca019ab..5cf178b6c07 100644--- a/Libraries/LibJS/Rust/src/runtime/array_buffer_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/array_buffer_prototype.rs@@ -48,7 +48,8 @@ impl ArrayBufferPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/array_constructor.rs b/Libraries/LibJS/Rust/src/runtime/array_constructor.rsindex 13ad7b45bbe..21df6017d89 100644--- a/Libraries/LibJS/Rust/src/runtime/array_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/array_constructor.rs@@ -105,11 +105,12 @@ define_native_function_class!(impl ArrayConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ArrayConstructor> {realm.create_object(vm, |_| ArrayConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Array.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Array.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/array_iterator.rs b/Libraries/LibJS/Rust/src/runtime/array_iterator.rsindex 46c2adfb892..9d9370d274d 100644--- a/Libraries/LibJS/Rust/src/runtime/array_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/array_iterator.rs@@ -75,7 +75,8 @@ impl ArrayIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().array_iterator_prototype(),+ realm,+ Some(realm.intrinsics().array_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),array: Cell::new(array),diff --git a/Libraries/LibJS/Rust/src/runtime/array_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/array_iterator_prototype.rsindex 695f4b0bee5..17e0e0fe06f 100644--- a/Libraries/LibJS/Rust/src/runtime/array_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/array_iterator_prototype.rs@@ -42,7 +42,8 @@ impl ArrayIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rsindex f837e606ed5..d28589996cd 100644--- a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs@@ -17,6 +17,7 @@ use crate::layout::cell::Gc;use crate::layout::object::Object;use crate::runtime::abstract_operations::{DisposeCapability, new_dispose_capability};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;#[derive(Clone, Copy, Debug, PartialEq, Eq, Trace)]pub enum AsyncDisposableState {@@ -50,9 +51,15 @@ impl Finalize for AsyncDisposableStack {impl AsyncDisposableStack {/// A pending stack with a new dispose capability.- pub fn new(_: &DeferGc<'_>, vm: &Vm, prototype: Gc<Object>) -> AsyncDisposableStack {+ pub fn new(_: &DeferGc<'_>, vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> AsyncDisposableStack {AsyncDisposableStack {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),async_disposable_state: Cell::new(AsyncDisposableState::Pending),dispose_capability: GcRefCell::new(new_dispose_capability()),}diff --git a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_constructor.rs b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_constructor.rsindex 10218292df7..26876325dc1 100644--- a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_constructor.rs@@ -38,11 +38,12 @@ define_native_function_class!(impl AsyncDisposableStackConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<AsyncDisposableStackConstructor> {realm.create_object(vm, |_| AsyncDisposableStackConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.AsyncDisposableStack.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.AsyncDisposableStack.as_string().clone()),),})}@@ -87,7 +88,7 @@ impl AsyncDisposableStackConstructor {realm,new_target,Intrinsics::async_disposable_stack_prototype,- |defer_gc, prototype| AsyncDisposableStack::new(defer_gc, vm, prototype),+ |defer_gc, prototype| AsyncDisposableStack::new(defer_gc, vm, realm, prototype),)?;Ok(async_disposable_stack.upcast())}diff --git a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_prototype.rs b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_prototype.rsindex f1d718f98bd..23ba133423a 100644--- a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_prototype.rs@@ -57,7 +57,8 @@ impl AsyncDisposableStackPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})@@ -288,7 +289,7 @@ impl AsyncDisposableStackPrototype {realm,realm.intrinsics().async_disposable_stack_constructor(vm).upcast(),Intrinsics::async_disposable_stack_prototype,- |defer_gc, prototype| AsyncDisposableStack::new(defer_gc, vm, prototype),+ |defer_gc, prototype| AsyncDisposableStack::new(defer_gc, vm, realm, prototype),)?;// 6. Set newAsyncDisposableStack.[[DisposeCapability]] to asyncDisposableStack.[[DisposeCapability]].diff --git a/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator.rs b/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator.rsindex a9d27c85826..cc6d0cb7ac8 100644--- a/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator.rs@@ -41,7 +41,8 @@ impl AsyncFromSyncIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().async_from_sync_iterator_prototype(),+ realm,+ Some(realm.intrinsics().async_from_sync_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),sync_iterator_record: Cell::new(sync_iterator_record),diff --git a/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator_prototype.rsindex f93b5583a1b..3fb93fbaa0a 100644--- a/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_from_sync_iterator_prototype.rs@@ -162,7 +162,8 @@ impl AsyncFromSyncIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().async_iterator_prototype(),+ realm,+ Some(realm.intrinsics().async_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/async_function_constructor.rs b/Libraries/LibJS/Rust/src/runtime/async_function_constructor.rsindex 3dc43cb2298..6f67cd13c83 100644--- a/Libraries/LibJS/Rust/src/runtime/async_function_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_function_constructor.rs@@ -36,11 +36,12 @@ define_native_function_class!(impl AsyncFunctionConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<AsyncFunctionConstructor> {realm.create_object(vm, |_| AsyncFunctionConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.AsyncFunction.as_string().clone(),+ realm,realm.intrinsics().function_constructor(vm).upcast(),+ Some(vm.names.AsyncFunction.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/async_function_driver_wrapper.rs b/Libraries/LibJS/Rust/src/runtime/async_function_driver_wrapper.rsindex 91d2ae28074..59e793df40c 100644--- a/Libraries/LibJS/Rust/src/runtime/async_function_driver_wrapper.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_function_driver_wrapper.rs@@ -102,7 +102,13 @@ impl AsyncFunctionDriverWrapper {generator_object.set_generator_state(GeneratorState::SuspendedYield);// Note: The top_level_promise is also kept alive by this Wrapperlet wrapper = realm.create_object(vm, |defer_gc| AsyncFunctionDriverWrapper {- base: Promise::new(defer_gc, vm, Self::CLASS, realm.intrinsics().promise_prototype(vm)),+ base: Promise::new(+ defer_gc,+ vm,+ realm,+ Self::CLASS,+ realm.intrinsics().promise_prototype(vm),+ ),generator_object: Cell::new(generator_object),top_level_promise: Cell::new(top_level_promise),current_promise: Cell::new(None),diff --git a/Libraries/LibJS/Rust/src/runtime/async_function_prototype.rs b/Libraries/LibJS/Rust/src/runtime/async_function_prototype.rsindex efe9b8f0165..96193fafebb 100644--- a/Libraries/LibJS/Rust/src/runtime/async_function_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_function_prototype.rs@@ -36,7 +36,8 @@ impl AsyncFunctionPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.function_prototype(),+ realm,+ Some(realm.function_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/async_generator.rs b/Libraries/LibJS/Rust/src/runtime/async_generator.rsindex 558ce4518f9..cdf82a875ab 100644--- a/Libraries/LibJS/Rust/src/runtime/async_generator.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_generator.rs@@ -94,7 +94,7 @@ impl AsyncGenerator {let yield_continuation = execution_context.yield_continuation.get();realm.create_object(vm, |_| AsyncGenerator {- base: Object::new_with_realm_and_prototype(+ base: Object::new_with_prototype(vm,Self::CLASS,realm,diff --git a/Libraries/LibJS/Rust/src/runtime/async_generator_function_constructor.rs b/Libraries/LibJS/Rust/src/runtime/async_generator_function_constructor.rsindex 5b4a8bb5270..e3d81acde7b 100644--- a/Libraries/LibJS/Rust/src/runtime/async_generator_function_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_generator_function_constructor.rs@@ -38,11 +38,12 @@ impl AsyncGeneratorFunctionConstructor {// NB: The spec has %Function% as the [[Prototype]] of %AsyncGeneratorFunction%, but this uses// %Function.prototype%.realm.create_object(vm, |_| AsyncGeneratorFunctionConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.AsyncGeneratorFunction.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.AsyncGeneratorFunction.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/async_generator_function_prototype.rs b/Libraries/LibJS/Rust/src/runtime/async_generator_function_prototype.rsindex 971dcf74563..3f05de4b9b3 100644--- a/Libraries/LibJS/Rust/src/runtime/async_generator_function_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_generator_function_prototype.rs@@ -36,7 +36,8 @@ impl AsyncGeneratorFunctionPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.function_prototype(),+ realm,+ Some(realm.function_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/async_generator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/async_generator_prototype.rsindex 983490fa549..68e73933c43 100644--- a/Libraries/LibJS/Rust/src/runtime/async_generator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_generator_prototype.rs@@ -78,7 +78,8 @@ impl AsyncGeneratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().async_iterator_prototype(),+ realm,+ Some(realm.intrinsics().async_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/async_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/async_iterator_prototype.rsindex 8bc560d4a38..6a1cff1d3fe 100644--- a/Libraries/LibJS/Rust/src/runtime/async_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/async_iterator_prototype.rs@@ -39,7 +39,8 @@ impl AsyncIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/atomics_object.rs b/Libraries/LibJS/Rust/src/runtime/atomics_object.rsindex 8e87c336dce..8fd174f2e9f 100644--- a/Libraries/LibJS/Rust/src/runtime/atomics_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/atomics_object.rs@@ -311,7 +311,8 @@ impl AtomicsObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/big_int_constructor.rs b/Libraries/LibJS/Rust/src/runtime/big_int_constructor.rsindex 312385208f2..465ba75b9b6 100644--- a/Libraries/LibJS/Rust/src/runtime/big_int_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/big_int_constructor.rs@@ -38,11 +38,12 @@ define_native_function_class!(impl BigIntConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<BigIntConstructor> {realm.create_object(vm, |_| BigIntConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.BigInt.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.BigInt.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/big_int_object.rs b/Libraries/LibJS/Rust/src/runtime/big_int_object.rsindex deb40f41f7c..5cef3be80e1 100644--- a/Libraries/LibJS/Rust/src/runtime/big_int_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/big_int_object.rs@@ -40,7 +40,8 @@ impl BigIntObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().bigint_prototype(vm),+ realm,+ Some(realm.intrinsics().bigint_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),bigint,diff --git a/Libraries/LibJS/Rust/src/runtime/big_int_prototype.rs b/Libraries/LibJS/Rust/src/runtime/big_int_prototype.rsindex 44c660f6825..dc2234e999b 100644--- a/Libraries/LibJS/Rust/src/runtime/big_int_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/big_int_prototype.rs@@ -65,7 +65,8 @@ impl BigIntPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/boolean_constructor.rs b/Libraries/LibJS/Rust/src/runtime/boolean_constructor.rsindex 9743f574856..d8bc1dd59e2 100644--- a/Libraries/LibJS/Rust/src/runtime/boolean_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/boolean_constructor.rs@@ -36,11 +36,12 @@ define_native_function_class!(impl BooleanConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<BooleanConstructor> {realm.create_object(vm, |_| BooleanConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Boolean.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Boolean.as_string().clone()),),})}@@ -87,7 +88,9 @@ impl BooleanConstructor {// 5. Return O.let prototype = get_prototype_from_constructor(vm, new_target, Intrinsics::boolean_prototype)?;Ok(realm- .create_object(vm, |_| BooleanObject::new(vm, BooleanObject::CLASS, b, prototype))+ .create_object(vm, |_| {+ BooleanObject::new(vm, realm, BooleanObject::CLASS, b, prototype)+ }).upcast())}}diff --git a/Libraries/LibJS/Rust/src/runtime/boolean_object.rs b/Libraries/LibJS/Rust/src/runtime/boolean_object.rsindex a9a85b35164..360de15a357 100644--- a/Libraries/LibJS/Rust/src/runtime/boolean_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/boolean_object.rs@@ -36,16 +36,22 @@ impl Deref for BooleanObject {impl BooleanObject {/// A BooleanObject with `prototype`, for `class`, which is BooleanObject or a class that extends it.- pub fn new(vm: &Vm, class: &'static Class, value: bool, prototype: Gc<Object>) -> BooleanObject {+ pub fn new(vm: &Vm, realm: Gc<Realm>, class: &'static Class, value: bool, prototype: Gc<Object>) -> BooleanObject {BooleanObject {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),value: Cell::new(value),}}pub fn create(vm: &Vm, realm: Gc<Realm>, value: bool) -> Gc<BooleanObject> {realm.create_object(vm, |_| {- BooleanObject::new(vm, Self::CLASS, value, realm.intrinsics().boolean_prototype(vm))+ BooleanObject::new(vm, realm, Self::CLASS, value, realm.intrinsics().boolean_prototype(vm))})}diff --git a/Libraries/LibJS/Rust/src/runtime/boolean_prototype.rs b/Libraries/LibJS/Rust/src/runtime/boolean_prototype.rsindex 5d1472f4dd7..5db384679e8 100644--- a/Libraries/LibJS/Rust/src/runtime/boolean_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/boolean_prototype.rs@@ -57,7 +57,7 @@ fn this_boolean_value(vm: &Vm, value: Value) -> ThrowCompletionOr<bool> {impl BooleanPrototype {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<BooleanPrototype> {realm.create_object(vm, |_| BooleanPrototype {- base: BooleanObject::new(vm, Self::CLASS, false, realm.object_prototype()),+ base: BooleanObject::new(vm, realm, Self::CLASS, false, realm.object_prototype()),})}diff --git a/Libraries/LibJS/Rust/src/runtime/bound_function.rs b/Libraries/LibJS/Rust/src/runtime/bound_function.rsindex 628b02a077a..2cb59934006 100644--- a/Libraries/LibJS/Rust/src/runtime/bound_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/bound_function.rs@@ -106,7 +106,7 @@ impl BoundFunction {realm.intrinsics().bound_function_shape(vm),MayInterfereWithIndexedPropertyAccess::No,),- LengthAndNameSlots::Absent => FunctionObject::new_with_realm_and_prototype(+ LengthAndNameSlots::Absent => FunctionObject::new_with_prototype(vm,Self::CLASS,realm,diff --git a/Libraries/LibJS/Rust/src/runtime/console_object.rs b/Libraries/LibJS/Rust/src/runtime/console_object.rsindex 62bb61617e5..6ace9ff88e6 100644--- a/Libraries/LibJS/Rust/src/runtime/console_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/console_object.rs@@ -53,7 +53,8 @@ impl ConsoleObject {base: Object::new_with_prototype(vm,Self::CLASS,- prototype.upcast(),+ realm,+ Some(prototype.upcast()),MayInterfereWithIndexedPropertyAccess::No,),console: Cell::new(None),diff --git a/Libraries/LibJS/Rust/src/runtime/console_object_prototype.rs b/Libraries/LibJS/Rust/src/runtime/console_object_prototype.rsindex 140c5c418bf..4ae9a6330dd 100644--- a/Libraries/LibJS/Rust/src/runtime/console_object_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/console_object_prototype.rs@@ -29,7 +29,8 @@ impl ConsoleObjectPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/data_view.rs b/Libraries/LibJS/Rust/src/runtime/data_view.rsindex cf29b4ec9ae..61c826f1668 100644--- a/Libraries/LibJS/Rust/src/runtime/data_view.rs+++ b/Libraries/LibJS/Rust/src/runtime/data_view.rs@@ -41,13 +41,20 @@ impl Deref for DataView {impl DataView {pub fn new(vm: &Vm,+ realm: Gc<Realm>,viewed_buffer: Gc<ArrayBuffer>,byte_length: ByteLength,byte_offset: usize,prototype: Gc<Object>,) -> DataView {DataView {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),viewed_array_buffer: Cell::new(viewed_buffer),byte_length: Cell::new(byte_length),byte_offset: Cell::new(byte_offset),@@ -63,7 +70,7 @@ impl DataView {) -> Gc<DataView> {let prototype = realm.intrinsics().data_view_prototype(vm);realm.create_object(vm, |_| {- DataView::new(vm, viewed_buffer, byte_length, byte_offset, prototype)+ DataView::new(vm, realm, viewed_buffer, byte_length, byte_offset, prototype)})}diff --git a/Libraries/LibJS/Rust/src/runtime/data_view_constructor.rs b/Libraries/LibJS/Rust/src/runtime/data_view_constructor.rsindex 40b53ad147c..0603f3de24e 100644--- a/Libraries/LibJS/Rust/src/runtime/data_view_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/data_view_constructor.rs@@ -40,11 +40,12 @@ define_native_function_class!(impl DataViewConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DataViewConstructor> {realm.create_object(vm, |_| DataViewConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.DataView.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.DataView.as_string().clone()),),})}@@ -155,7 +156,7 @@ impl DataViewConstructor {realm,new_target,Intrinsics::data_view_prototype,- |_, prototype| DataView::new(vm, buffer, view_byte_length, offset, prototype),+ |_, prototype| DataView::new(vm, realm, buffer, view_byte_length, offset, prototype),)?;// 11. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.diff --git a/Libraries/LibJS/Rust/src/runtime/data_view_prototype.rs b/Libraries/LibJS/Rust/src/runtime/data_view_prototype.rsindex f67c0b0ffa1..b8fac679f66 100644--- a/Libraries/LibJS/Rust/src/runtime/data_view_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/data_view_prototype.rs@@ -188,7 +188,8 @@ impl DataViewPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/date.rs b/Libraries/LibJS/Rust/src/runtime/date.rsindex 85f0c866dc0..71f392a027a 100644--- a/Libraries/LibJS/Rust/src/runtime/date.rs+++ b/Libraries/LibJS/Rust/src/runtime/date.rs@@ -58,15 +58,23 @@ impl Deref for Date {}impl Date {- pub fn new(vm: &Vm, date_value: f64, prototype: Gc<Object>) -> Date {+ pub fn new(vm: &Vm, realm: Gc<Realm>, date_value: f64, prototype: Gc<Object>) -> Date {Date {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),date_value: Cell::new(date_value),}}pub fn create(vm: &Vm, realm: Gc<Realm>, date_value: f64) -> Gc<Date> {- realm.create_object(vm, |_| Date::new(vm, date_value, realm.intrinsics().date_prototype(vm)))+ realm.create_object(vm, |_| {+ Date::new(vm, realm, date_value, realm.intrinsics().date_prototype(vm))+ })}pub fn date_value(&self) -> f64 {diff --git a/Libraries/LibJS/Rust/src/runtime/date_constructor.rs b/Libraries/LibJS/Rust/src/runtime/date_constructor.rsindex a02109b4e6e..b590b4ca7f9 100644--- a/Libraries/LibJS/Rust/src/runtime/date_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/date_constructor.rs@@ -63,11 +63,12 @@ fn argument_or(vm: &Vm, index: usize, fallback: f64) -> ThrowCompletionOr<f64> {impl DateConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DateConstructor> {realm.create_object(vm, |_| DateConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Date.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Date.as_string().clone()),),})}@@ -199,7 +200,7 @@ impl DateConstructor {// 8. Return O.Ok(ordinary_create_from_constructor_of(vm, realm, new_target, Intrinsics::date_prototype, |_, prototype| {- Date::new(vm, date_value, prototype)+ Date::new(vm, realm, date_value, prototype)})?.upcast(),)diff --git a/Libraries/LibJS/Rust/src/runtime/date_prototype.rs b/Libraries/LibJS/Rust/src/runtime/date_prototype.rsindex 43b58ab362d..d64470b7551 100644--- a/Libraries/LibJS/Rust/src/runtime/date_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/date_prototype.rs@@ -109,7 +109,8 @@ impl DatePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs b/Libraries/LibJS/Rust/src/runtime/disposable_stack.rsindex 73ad5af6c91..2934f0cd3d9 100644--- a/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs+++ b/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs@@ -17,6 +17,7 @@ use crate::layout::cell::Gc;use crate::layout::object::Object;use crate::runtime::abstract_operations::{DisposeCapability, new_dispose_capability};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;#[derive(Clone, Copy, Debug, PartialEq, Eq, Trace)]pub enum DisposableState {@@ -50,9 +51,15 @@ impl Finalize for DisposableStack {impl DisposableStack {/// A pending stack with a new dispose capability.- pub fn new(_: &DeferGc<'_>, vm: &Vm, prototype: Gc<Object>) -> DisposableStack {+ pub fn new(_: &DeferGc<'_>, vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> DisposableStack {DisposableStack {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),disposable_state: Cell::new(DisposableState::Pending),dispose_capability: GcRefCell::new(new_dispose_capability()),}diff --git a/Libraries/LibJS/Rust/src/runtime/disposable_stack_constructor.rs b/Libraries/LibJS/Rust/src/runtime/disposable_stack_constructor.rsindex 18dae68b897..7bf0be208af 100644--- a/Libraries/LibJS/Rust/src/runtime/disposable_stack_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/disposable_stack_constructor.rs@@ -38,11 +38,12 @@ define_native_function_class!(impl DisposableStackConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DisposableStackConstructor> {realm.create_object(vm, |_| DisposableStackConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.DisposableStack.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.DisposableStack.as_string().clone()),),})}@@ -87,7 +88,7 @@ impl DisposableStackConstructor {realm,new_target,Intrinsics::disposable_stack_prototype,- |defer_gc, prototype| DisposableStack::new(defer_gc, vm, prototype),+ |defer_gc, prototype| DisposableStack::new(defer_gc, vm, realm, prototype),)?;Ok(disposable_stack.upcast())}diff --git a/Libraries/LibJS/Rust/src/runtime/disposable_stack_prototype.rs b/Libraries/LibJS/Rust/src/runtime/disposable_stack_prototype.rsindex b26cb0dc35d..6980ff91b2f 100644--- a/Libraries/LibJS/Rust/src/runtime/disposable_stack_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/disposable_stack_prototype.rs@@ -54,7 +54,8 @@ impl DisposableStackPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})@@ -249,7 +250,7 @@ impl DisposableStackPrototype {realm,realm.intrinsics().disposable_stack_constructor(vm).upcast(),Intrinsics::disposable_stack_prototype,- |defer_gc, prototype| DisposableStack::new(defer_gc, vm, prototype),+ |defer_gc, prototype| DisposableStack::new(defer_gc, vm, realm, prototype),)?;// 6. Set newDisposableStack.[[DisposeCapability]] to disposableStack.[[DisposeCapability]].diff --git a/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rs b/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rsindex b3d2601181b..cd79c0c8812 100644--- a/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rs@@ -553,7 +553,12 @@ impl EcmascriptFunctionObject {// a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%Object.prototype%").// NB: With room for the properties the constructor is known to add.let prototype = get_prototype_from_constructor(vm, new_target, Intrinsics::object_prototype)?;- this_argument = Some(Object::create_for_construct(vm, prototype, function.shared_data()));+ this_argument = Some(Object::create_for_construct(+ vm,+ vm.current_realm().expect("a construction runs in a realm"),+ prototype,+ function.shared_data(),+ ));}// 4. Let calleeContext be PrepareForOrdinaryCall(F, newTarget).diff --git a/Libraries/LibJS/Rust/src/runtime/error.rs b/Libraries/LibJS/Rust/src/runtime/error.rsindex c4606872d29..28feff7fb54 100644--- a/Libraries/LibJS/Rust/src/runtime/error.rs+++ b/Libraries/LibJS/Rust/src/runtime/error.rs@@ -147,17 +147,29 @@ pub fn error_data_of_error(object: &Object) -> Option<&ErrorData> {impl Error {/// An error with `prototype`, for `class`, which is Error or a class that extends it.- pub fn new(vm: &Vm, class: &'static Class, prototype: Gc<Object>) -> Error {+ pub fn new(vm: &Vm, realm: Gc<Realm>, class: &'static Class, prototype: Gc<Object>) -> Error {Error {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),error_data: ErrorData::new(vm),}}/// An error an Error constructor is creating: its stack leaves out the constructor's own frame.- pub fn new_in_constructor(vm: &Vm, class: &'static Class, prototype: Gc<Object>) -> Error {+ pub fn new_in_constructor(vm: &Vm, realm: Gc<Realm>, class: &'static Class, prototype: Gc<Object>) -> Error {Error {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),error_data: ErrorData::new_in_constructor(vm),}}@@ -170,14 +182,14 @@ impl Error {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<Error> {realm.create_object(vm, |_| {- Error::new(vm, Error::CLASS, realm.intrinsics().error_prototype(vm))+ Error::new(vm, realm, Error::CLASS, realm.intrinsics().error_prototype(vm))})}/// An error with `prototype`, as OrdinaryCreateFromConstructor creates one for an error type of the embedder,/// whose prototype the realm's intrinsics do not have.pub fn create_with_prototype(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> Gc<Error> {- realm.create_object(vm, |_| Error::new(vm, Error::CLASS, prototype))+ realm.create_object(vm, |_| Error::new(vm, realm, Error::CLASS, prototype))}pub fn create_with_message(vm: &Vm, realm: Gc<Realm>, message: Utf16String) -> Gc<Error> {@@ -239,20 +251,20 @@ macro_rules! define_native_errors {}impl $class {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> $class {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> $class {$class {- base: Error::new(vm, Self::CLASS, prototype),+ base: Error::new(vm, realm, Self::CLASS, prototype),}}- pub fn new_in_constructor(vm: &Vm, prototype: Gc<Object>) -> $class {+ pub fn new_in_constructor(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> $class {$class {- base: Error::new_in_constructor(vm, Self::CLASS, prototype),+ base: Error::new_in_constructor(vm, realm, Self::CLASS, prototype),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<$class> {- realm.create_object(vm, |_| $class::new(vm, realm.intrinsics().$prototype(vm)))+ realm.create_object(vm, |_| $class::new(vm, realm, realm.intrinsics().$prototype(vm)))}pub fn create_with_message(vm: &Vm, realm: Gc<Realm>, message: Utf16String) -> Gc<$class> {diff --git a/Libraries/LibJS/Rust/src/runtime/error_constructor.rs b/Libraries/LibJS/Rust/src/runtime/error_constructor.rsindex 6dcc1913177..d8cdd80f035 100644--- a/Libraries/LibJS/Rust/src/runtime/error_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/error_constructor.rs@@ -39,11 +39,12 @@ define_native_function_class!(impl ErrorConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ErrorConstructor> {realm.create_object(vm, |_| ErrorConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Error.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Error.as_string().clone()),),})}@@ -95,7 +96,7 @@ impl ErrorConstructor {// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%Error.prototype%", « [[ErrorData]] »).let prototype = get_prototype_from_constructor(vm, new_target, Intrinsics::error_prototype)?;- let error = realm.create_object(vm, |_| Error::new_in_constructor(vm, Error::CLASS, prototype));+ let error = realm.create_object(vm, |_| Error::new_in_constructor(vm, realm, Error::CLASS, prototype));// 3. If message is not undefined, thenif !message.is_undefined() {@@ -158,12 +159,7 @@ macro_rules! define_native_error_constructors {realm.create_object(vm,|_| $constructor {- base: NativeFunction::new_with_name(- vm,- Self::CLASS,- vm.names.$name.as_string().clone(),- realm.intrinsics().error_constructor(vm).upcast(),- ),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, realm.intrinsics().error_constructor(vm).upcast(), Some(vm.names.$name.as_string().clone())),},)}@@ -208,7 +204,7 @@ macro_rules! define_native_error_constructors {// 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »).let prototype = get_prototype_from_constructor(vm, new_target, Intrinsics::$prototype)?;- let error = realm.create_object(vm, |_| $class::new_in_constructor(vm, prototype));+ let error = realm.create_object(vm, |_| $class::new_in_constructor(vm, realm, prototype));// 3. If message is not undefined, thenif !message.is_undefined() {diff --git a/Libraries/LibJS/Rust/src/runtime/error_prototype.rs b/Libraries/LibJS/Rust/src/runtime/error_prototype.rsindex 97ab44733f9..6d3e7539c16 100644--- a/Libraries/LibJS/Rust/src/runtime/error_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/error_prototype.rs@@ -41,7 +41,8 @@ impl ErrorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})@@ -244,12 +245,7 @@ macro_rules! define_native_error_prototypes {realm.create_object(vm,|_| $prototype {- base: Object::new_with_prototype(- vm,- Self::CLASS,- realm.intrinsics().error_prototype(vm),- MayInterfereWithIndexedPropertyAccess::No,- ),+ base: Object::new_with_prototype(vm, Self::CLASS, realm, Some(realm.intrinsics().error_prototype(vm)), MayInterfereWithIndexedPropertyAccess::No),},)}diff --git a/Libraries/LibJS/Rust/src/runtime/finalization_registry.rs b/Libraries/LibJS/Rust/src/runtime/finalization_registry.rsindex 7234e59b06b..71f99f14dab 100644--- a/Libraries/LibJS/Rust/src/runtime/finalization_registry.rs+++ b/Libraries/LibJS/Rust/src/runtime/finalization_registry.rs@@ -89,7 +89,13 @@ impl FinalizationRegistry {prototype: Gc<Object>,) -> FinalizationRegistry {FinalizationRegistry {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),realm,cleanup_callback,records: GcRefCell::new(FinalizationRecords::default()),diff --git a/Libraries/LibJS/Rust/src/runtime/finalization_registry_constructor.rs b/Libraries/LibJS/Rust/src/runtime/finalization_registry_constructor.rsindex 5dfca032805..f69d90c17cf 100644--- a/Libraries/LibJS/Rust/src/runtime/finalization_registry_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/finalization_registry_constructor.rs@@ -38,11 +38,12 @@ define_native_function_class!(impl FinalizationRegistryConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<FinalizationRegistryConstructor> {realm.create_object(vm, |_| FinalizationRegistryConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.FinalizationRegistry.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.FinalizationRegistry.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/finalization_registry_prototype.rs b/Libraries/LibJS/Rust/src/runtime/finalization_registry_prototype.rsindex efa6da1a2da..0a098c96495 100644--- a/Libraries/LibJS/Rust/src/runtime/finalization_registry_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/finalization_registry_prototype.rs@@ -47,7 +47,8 @@ impl FinalizationRegistryPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/function_constructor.rs b/Libraries/LibJS/Rust/src/runtime/function_constructor.rsindex 9b839b0b075..94a5a8b74c7 100644--- a/Libraries/LibJS/Rust/src/runtime/function_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/function_constructor.rs@@ -43,11 +43,12 @@ define_native_function_class!(impl FunctionConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<FunctionConstructor> {realm.create_object(vm, |_| FunctionConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Function.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Function.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/function_object.rs b/Libraries/LibJS/Rust/src/runtime/function_object.rsindex efcd2d4f88c..77238829de3 100644--- a/Libraries/LibJS/Rust/src/runtime/function_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/function_object.rs@@ -50,31 +50,15 @@ impl Deref for FunctionObject {}impl FunctionObject {- pub fn new_with_realm_and_prototype(+ pub fn new_with_prototype(vm: &Vm,class: &'static Class,realm: Gc<Realm>,prototype: Option<Gc<Object>>,may_interfere_with_indexed_property_access: MayInterfereWithIndexedPropertyAccess,) -> FunctionObject {- let object = Object::new_with_realm_and_prototype(- vm,- class,- realm,- prototype,- may_interfere_with_indexed_property_access,- );- object.set_is_function();- Self::from_object(object)- }-- pub fn new_with_prototype(- vm: &Vm,- class: &'static Class,- prototype: Gc<Object>,- may_interfere_with_indexed_property_access: MayInterfereWithIndexedPropertyAccess,- ) -> FunctionObject {- let object = Object::new_with_prototype(vm, class, prototype, may_interfere_with_indexed_property_access);+ let object =+ Object::new_with_prototype(vm, class, realm, prototype, may_interfere_with_indexed_property_access);object.set_is_function();Self::from_object(object)}diff --git a/Libraries/LibJS/Rust/src/runtime/function_prototype.rs b/Libraries/LibJS/Rust/src/runtime/function_prototype.rsindex f774fb73e6e..7421972b91d 100644--- a/Libraries/LibJS/Rust/src/runtime/function_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/function_prototype.rs@@ -117,7 +117,8 @@ impl FunctionPrototype {base: FunctionObject::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),}diff --git a/Libraries/LibJS/Rust/src/runtime/generator_function_constructor.rs b/Libraries/LibJS/Rust/src/runtime/generator_function_constructor.rsindex 67470ec4750..fb8c077c5c5 100644--- a/Libraries/LibJS/Rust/src/runtime/generator_function_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/generator_function_constructor.rs@@ -39,7 +39,9 @@ impl GeneratorFunctionConstructor {base: NativeFunction::new_with_prototype(vm,Self::CLASS,+ realm,realm.intrinsics().function_constructor(vm).upcast(),+ None,),})}diff --git a/Libraries/LibJS/Rust/src/runtime/generator_function_prototype.rs b/Libraries/LibJS/Rust/src/runtime/generator_function_prototype.rsindex 1564927fdf2..d16de10b338 100644--- a/Libraries/LibJS/Rust/src/runtime/generator_function_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/generator_function_prototype.rs@@ -36,7 +36,8 @@ impl GeneratorFunctionPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.function_prototype(),+ realm,+ Some(realm.function_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/generator_object.rs b/Libraries/LibJS/Rust/src/runtime/generator_object.rsindex d25ee18627d..08fec8b595f 100644--- a/Libraries/LibJS/Rust/src/runtime/generator_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/generator_object.rs@@ -189,13 +189,7 @@ impl GeneratorObject {execute: GeneratorExecuteFunction,) -> GeneratorObject {GeneratorObject {- base: Object::new_with_realm_and_prototype(- vm,- class,- realm,- prototype,- MayInterfereWithIndexedPropertyAccess::No,- ),+ base: Object::new_with_prototype(vm, class, realm, prototype, MayInterfereWithIndexedPropertyAccess::No),execution_context: GcRefCell::new(Some(execution_context)),generating_executable: Cell::new(None),yield_continuation: Cell::new(ExecutionContext::NO_YIELD_CONTINUATION),diff --git a/Libraries/LibJS/Rust/src/runtime/generator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/generator_prototype.rsindex 5e81c06f21e..9638cdffe40 100644--- a/Libraries/LibJS/Rust/src/runtime/generator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/generator_prototype.rs@@ -43,7 +43,8 @@ impl GeneratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/collator.rs b/Libraries/LibJS/Rust/src/runtime/intl/collator.rsindex 00a5d29460f..db421c78128 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/collator.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/collator.rs@@ -18,6 +18,7 @@ use crate::runtime::abstract_operations::OptionType;use crate::runtime::intl::collator_compare_function::CollatorCompareFunction;use crate::runtime::intl::intl_object::{IntlObject, ResolutionOptionDescriptor};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::unicode::intl::{self as unicode, CaseFirst, Sensitivity, Usage};use crate::utf16::Utf16View;@@ -64,9 +65,15 @@ impl Finalize for Collator {}impl Collator {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> Collator {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> Collator {Collator {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),usage: Cell::new(Usage::Sort),sensitivity: Cell::new(Sensitivity::Variant),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/collator_compare_function.rs b/Libraries/LibJS/Rust/src/runtime/intl/collator_compare_function.rsindex c610937568b..0830503d36e 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/collator_compare_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/collator_compare_function.rs@@ -62,7 +62,7 @@ impl Deref for CollatorCompareFunction {impl CollatorCompareFunction {pub fn create(vm: &Vm, realm: Gc<Realm>, collator: Gc<Collator>) -> Gc<CollatorCompareFunction> {realm.create_object(vm, |_| CollatorCompareFunction {- base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm.function_prototype()),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, realm.function_prototype(), None),collator: Cell::new(collator),})}diff --git a/Libraries/LibJS/Rust/src/runtime/intl/collator_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/collator_constructor.rsindex cc2fb6b1faf..6df269347d2 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/collator_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/collator_constructor.rs@@ -44,11 +44,12 @@ impl CollatorConstructor {// 10.1 The Intl.Collator Constructor, https://tc39.es/ecma402/#sec-the-intl-collator-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<CollatorConstructor> {realm.create_object(vm, |_| CollatorConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Collator.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Collator.as_string().clone()),),})}@@ -101,7 +102,7 @@ impl CollatorConstructor {realm,new_target,Intrinsics::intl_collator_prototype,- |_, prototype| Collator::new(vm, prototype),+ |_, prototype| Collator::new(vm, realm, prototype),)?;// 4. NOTE: The source of locale data for ResolveOptions depends upon the "usage" property of options, but the followingdiff --git a/Libraries/LibJS/Rust/src/runtime/intl/collator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/collator_prototype.rsindex 1dc99b73227..0a182a30214 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/collator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/collator_prototype.rs@@ -44,7 +44,8 @@ impl CollatorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format.rs b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format.rsindex e00d92390d4..2738fea2820 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format.rs@@ -29,6 +29,7 @@ use crate::runtime::intl::intl_object::{IntlObject, ResolutionOptionDescriptor};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;use crate::runtime::property_key::PropertyKey;+use crate::runtime::realm::Realm;use crate::runtime::temporal::instant::{Instant, NANOSECONDS_PER_MILLISECOND};use crate::runtime::temporal::plain_date::{PlainDate, create_iso_date_record};use crate::runtime::temporal::plain_date_time::{PlainDateTime, combine_iso_date_and_time_record};@@ -135,9 +136,15 @@ impl Finalize for DateTimeFormat {}impl DateTimeFormat {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> DateTimeFormat {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> DateTimeFormat {DateTimeFormat {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),calendar: RefCell::default(),numbering_system: RefCell::default(),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_constructor.rsindex d1cbaf4a736..69e40345c4b 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_constructor.rs@@ -60,11 +60,12 @@ impl DateTimeFormatConstructor {// 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DateTimeFormatConstructor> {realm.create_object(vm, |_| DateTimeFormatConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.DateTimeFormat.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.DateTimeFormat.as_string().clone()),),})}@@ -239,7 +240,7 @@ pub fn create_date_time_format(realm,new_target,Intrinsics::intl_date_time_format_prototype,- |_, prototype| DateTimeFormat::new(vm, prototype),+ |_, prototype| DateTimeFormat::new(vm, realm, prototype),)?;// 2. Let hour12 be undefined.diff --git a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_function.rs b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_function.rsindex f18cd82a9db..f3fc58e8c4f 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_function.rs@@ -66,7 +66,7 @@ impl DateTimeFormatFunction {// 15.6.3 DateTime Format Functions, https://tc39.es/proposal-temporal/#sec-datetime-format-functionspub fn create(vm: &Vm, realm: Gc<Realm>, date_time_format: Gc<DateTimeFormat>) -> Gc<DateTimeFormatFunction> {realm.create_object(vm, |_| DateTimeFormatFunction {- base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm.function_prototype()),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, realm.function_prototype(), None),date_time_format: Cell::new(date_time_format),})}diff --git a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_prototype.rsindex 1745fcd20d1..109a42485ad 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/date_time_format_prototype.rs@@ -89,7 +89,8 @@ impl DateTimeFormatPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/display_names.rs b/Libraries/LibJS/Rust/src/runtime/intl/display_names.rsindex 2f32d940b17..3354cb158b8 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/display_names.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/display_names.rs@@ -25,6 +25,7 @@ use crate::runtime::intl::abstract_operations::{use crate::runtime::intl::intl_object::{IntlObject, ResolutionOptionDescriptor};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;+use crate::runtime::realm::Realm;use crate::unicode::intl::{self as unicode, LanguageDisplay, Style};use crate::utf16::Utf16View;@@ -80,9 +81,15 @@ impl Deref for DisplayNames {}impl DisplayNames {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> DisplayNames {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> DisplayNames {DisplayNames {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),style: Cell::new(Style::Long),type_: Cell::new(Type::Invalid),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/display_names_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/display_names_constructor.rsindex 93ea6d8047c..ae4c316b38d 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/display_names_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/display_names_constructor.rs@@ -42,11 +42,12 @@ impl DisplayNamesConstructor {// 12.1 The Intl.DisplayNames Constructor, https://tc39.es/ecma402/#sec-intl-displaynames-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DisplayNamesConstructor> {realm.create_object(vm, |_| DisplayNamesConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.DisplayNames.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.DisplayNames.as_string().clone()),),})}@@ -102,7 +103,7 @@ impl DisplayNamesConstructor {realm,new_target,Intrinsics::intl_display_names_prototype,- |_, prototype| DisplayNames::new(vm, prototype),+ |_, prototype| DisplayNames::new(vm, realm, prototype),)?;// 3. Let optionsResolution be ? ResolveOptions(%Intl.DisplayNames%, %Intl.DisplayNames%.[[LocaleData]], locales, options, « REQUIRE-OPTIONS »).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/display_names_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/display_names_prototype.rsindex f5bca5ddeab..145c399ab51 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/display_names_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/display_names_prototype.rs@@ -45,7 +45,8 @@ impl DisplayNamesPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/duration_format.rs b/Libraries/LibJS/Rust/src/runtime/intl/duration_format.rsindex ac78fcc1490..10d29b679a7 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/duration_format.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/duration_format.rs@@ -30,6 +30,7 @@ use crate::runtime::intl::number_format::{NumberFormat, partition_number_patternuse crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;use crate::runtime::property_key::PropertyKey;+use crate::runtime::realm::Realm;use crate::runtime::temporal::duration::{Duration, duration_sign};use crate::unicode::intl::{self as unicode, Style as UnicodeStyle};use crate::utf16::{Utf16StringBuilder, Utf16View};@@ -158,9 +159,15 @@ macro_rules! duration_unit_options_accessors {}impl DurationFormat {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> DurationFormat {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> DurationFormat {DurationFormat {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),numbering_system: RefCell::default(),hour_minute_separator: RefCell::default(),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/duration_format_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/duration_format_constructor.rsindex a194ac707e9..c19adcab559 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/duration_format_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/duration_format_constructor.rs@@ -47,11 +47,12 @@ impl DurationFormatConstructor {// 13.1 The Intl.DurationFormat Constructor, https://tc39.es/ecma402/#sec-intl-durationformat-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DurationFormatConstructor> {realm.create_object(vm, |_| DurationFormatConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.DurationFormat.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.DurationFormat.as_string().clone()),),})}@@ -106,7 +107,7 @@ impl DurationFormatConstructor {realm,new_target,Intrinsics::intl_duration_format_prototype,- |_, prototype| DurationFormat::new(vm, prototype),+ |_, prototype| DurationFormat::new(vm, realm, prototype),)?;// 3. Let optionsResolution be ? ResolveOptions(%Intl.DurationFormat%, %Intl.DurationFormat%.[[LocaleData]], locales, options).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/duration_format_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/duration_format_prototype.rsindex 98e8384524b..d3c8afe53c1 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/duration_format_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/duration_format_prototype.rs@@ -48,7 +48,8 @@ impl DurationFormatPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/intl.rs b/Libraries/LibJS/Rust/src/runtime/intl/intl.rsindex f7666624221..ac52466897b 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/intl.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/intl.rs@@ -50,7 +50,8 @@ impl Intl {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),// The Intl object has a [[FallbackSymbol]] internal slot, which is a new %Symbol% in the current realmdiff --git a/Libraries/LibJS/Rust/src/runtime/intl/list_format.rs b/Libraries/LibJS/Rust/src/runtime/intl/list_format.rsindex d9c855b7652..ea73af27530 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/list_format.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/list_format.rs@@ -24,6 +24,7 @@ use crate::runtime::iterator::{IteratorHint, get_iterator, iterator_close, iterause crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;use crate::runtime::property_key::PropertyKey;+use crate::runtime::realm::Realm;use crate::unicode::intl::{self as unicode, ListFormatPartition, ListFormatType, Style};use crate::utf16::Utf16View;@@ -61,9 +62,15 @@ impl Finalize for ListFormat {}impl ListFormat {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> ListFormat {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> ListFormat {ListFormat {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),type_: Cell::new(ListFormatType::Conjunction),style: Cell::new(Style::Long),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/list_format_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/list_format_constructor.rsindex 52695c5a3f5..9c9dcf6bf02 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/list_format_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/list_format_constructor.rs@@ -44,11 +44,12 @@ impl ListFormatConstructor {// 14.1 The Intl.ListFormat Constructor, https://tc39.es/ecma402/#sec-intl-listformat-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ListFormatConstructor> {realm.create_object(vm, |_| ListFormatConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.ListFormat.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.ListFormat.as_string().clone()),),})}@@ -104,7 +105,7 @@ impl ListFormatConstructor {realm,new_target,Intrinsics::intl_list_format_prototype,- |_, prototype| ListFormat::new(vm, prototype),+ |_, prototype| ListFormat::new(vm, realm, prototype),)?;// 3. Let optionsResolution be ? ResolveOptions(%Intl.ListFormat%, %Intl.ListFormat%.[[LocaleData]], locales, options).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/list_format_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/list_format_prototype.rsindex 854c2597a1d..9a8477f5f9d 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/list_format_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/list_format_prototype.rs@@ -43,7 +43,8 @@ impl ListFormatPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/locale.rs b/Libraries/LibJS/Rust/src/runtime/intl/locale.rsindex 35dbadc1251..e2cf96fee69 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/locale.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/locale.rs@@ -59,9 +59,15 @@ impl Deref for Locale {}impl Locale {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> Locale {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> Locale {Locale {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),calendar: RefCell::default(),case_first: RefCell::default(),@@ -75,7 +81,9 @@ impl Locale {}pub fn create(vm: &Vm, realm: Gc<Realm>, source_locale: Gc<Locale>, locale_tag: Utf16String) -> Gc<Locale> {- let locale = realm.create_object(vm, |_| Locale::new(vm, realm.intrinsics().intl_locale_prototype(vm)));+ let locale = realm.create_object(vm, |_| {+ Locale::new(vm, realm, realm.intrinsics().intl_locale_prototype(vm))+ });locale.set_locale(locale_tag);locale.calendar.replace(source_locale.calendar());diff --git a/Libraries/LibJS/Rust/src/runtime/intl/locale_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/locale_constructor.rsindex bba9696fab1..9a1700dd171 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/locale_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/locale_constructor.rs@@ -367,11 +367,12 @@ impl LocaleConstructor {// 15.1 The Intl.Locale Constructor, https://tc39.es/ecma402/#sec-intl-locale-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<LocaleConstructor> {realm.create_object(vm, |_| LocaleConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Locale.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Locale.as_string().clone()),),})}@@ -424,7 +425,7 @@ impl LocaleConstructor {realm,new_target,Intrinsics::intl_locale_prototype,- |_, prototype| Locale::new(vm, prototype),+ |_, prototype| Locale::new(vm, realm, prototype),)?;// 7. If tag is not a String and tag is not an Object, throw a TypeError exception.diff --git a/Libraries/LibJS/Rust/src/runtime/intl/locale_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/locale_prototype.rsindex 50c70eec8b2..4bb2bc35655 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/locale_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/locale_prototype.rs@@ -59,7 +59,8 @@ impl LocalePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/number_format.rs b/Libraries/LibJS/Rust/src/runtime/intl/number_format.rsindex aa20d01529c..c2b95e62cb1 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/number_format.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/number_format.rs@@ -26,6 +26,7 @@ use crate::runtime::intl::number_format_function::NumberFormatFunction;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;use crate::runtime::property_key::PropertyKey;+use crate::runtime::realm::Realm;use crate::runtime::value::PreferredType;use crate::runtime::value_conversions::{parse_string_numeric_literal, string_to_number, unsigned_big_integer_from_base,@@ -100,9 +101,15 @@ impl Finalize for NumberFormatBase {}impl NumberFormatBase {- pub fn new(vm: &Vm, class: &'static Class, prototype: Gc<Object>) -> NumberFormatBase {+ pub fn new(vm: &Vm, realm: Gc<Realm>, class: &'static Class, prototype: Gc<Object>) -> NumberFormatBase {NumberFormatBase {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),min_integer_digits: Cell::new(0),min_fraction_digits: Cell::new(None),@@ -358,9 +365,9 @@ impl Deref for NumberFormat {}impl NumberFormat {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> NumberFormat {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> NumberFormat {NumberFormat {- base: NumberFormatBase::new(vm, Self::CLASS, prototype),+ base: NumberFormatBase::new(vm, realm, Self::CLASS, prototype),numbering_system: RefCell::default(),style: Cell::new(NumberFormatStyle::Decimal),currency: RefCell::new(None),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/number_format_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/number_format_constructor.rsindex 381386bef4b..1a588b6ff29 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/number_format_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/number_format_constructor.rs@@ -63,11 +63,12 @@ impl NumberFormatConstructor {// 16.1 The Intl.NumberFormat Constructor, https://tc39.es/ecma402/#sec-intl-numberformat-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<NumberFormatConstructor> {realm.create_object(vm, |_| NumberFormatConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.NumberFormat.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.NumberFormat.as_string().clone()),),})}@@ -133,7 +134,7 @@ impl NumberFormatConstructor {realm,new_target,Intrinsics::intl_number_format_prototype,- |_, prototype| NumberFormat::new(vm, prototype),+ |_, prototype| NumberFormat::new(vm, realm, prototype),)?;// 3. Let optionsResolution be ? ResolveOptions(%Intl.NumberFormat%, %Intl.NumberFormat%.[[LocaleData]], locales, options, « COERCE-OPTIONS »).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/number_format_function.rs b/Libraries/LibJS/Rust/src/runtime/intl/number_format_function.rsindex caa1df1645c..e50caddafb2 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/number_format_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/number_format_function.rs@@ -62,7 +62,7 @@ impl NumberFormatFunction {// 16.5.2 Number Format Functions, https://tc39.es/ecma402/#sec-number-format-functionspub fn create(vm: &Vm, realm: Gc<Realm>, number_format: Gc<NumberFormat>) -> Gc<NumberFormatFunction> {realm.create_object(vm, |_| NumberFormatFunction {- base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm.function_prototype()),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, realm.function_prototype(), None),number_format: Cell::new(number_format),})}diff --git a/Libraries/LibJS/Rust/src/runtime/intl/number_format_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/number_format_prototype.rsindex e2e3a88e0ed..b016d9a781e 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/number_format_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/number_format_prototype.rs@@ -87,7 +87,8 @@ impl NumberFormatPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/plural_rules.rs b/Libraries/LibJS/Rust/src/runtime/intl/plural_rules.rsindex 11c60535f66..b869d575942 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/plural_rules.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/plural_rules.rs@@ -19,6 +19,7 @@ use crate::runtime::error_types::ErrorType;use crate::runtime::intl::intl_object::{IntlObject, ResolutionOptionDescriptor};use crate::runtime::intl::mathematical_value::MathematicalValue;use crate::runtime::intl::number_format::NumberFormatBase;+use crate::runtime::realm::Realm;use crate::unicode::number_format::{self as unicode, PluralCategory, PluralForm};use crate::utf16::Utf16View;@@ -42,9 +43,9 @@ impl Deref for PluralRules {}impl PluralRules {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> PluralRules {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> PluralRules {PluralRules {- base: NumberFormatBase::new(vm, Self::CLASS, prototype),+ base: NumberFormatBase::new(vm, realm, Self::CLASS, prototype),type_: Cell::new(PluralForm::Cardinal),}}diff --git a/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_constructor.rsindex 7618dfffdb7..521db29b44b 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_constructor.rs@@ -45,11 +45,12 @@ impl PluralRulesConstructor {// 17.1 The Intl.PluralRules Constructor, https://tc39.es/ecma402/#sec-intl-pluralrules-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PluralRulesConstructor> {realm.create_object(vm, |_| PluralRulesConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.PluralRules.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.PluralRules.as_string().clone()),),})}@@ -104,7 +105,7 @@ impl PluralRulesConstructor {realm,new_target,Intrinsics::intl_plural_rules_prototype,- |_, prototype| PluralRules::new(vm, prototype),+ |_, prototype| PluralRules::new(vm, realm, prototype),)?;// 3. Let optionsResolution be ? ResolveOptions(%Intl.PluralRules%, %Intl.PluralRules%.[[LocaleData]], locales, options, « COERCE-OPTIONS »).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_prototype.rsindex dae6514775e..1301724cda4 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/plural_rules_prototype.rs@@ -49,7 +49,8 @@ impl PluralRulesPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format.rs b/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format.rsindex 00dab67bfc1..ef528d8fd4b 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format.rs@@ -23,6 +23,7 @@ use crate::runtime::intl::intl_object::{IntlObject, ResolutionOptionDescriptor};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;use crate::runtime::property_key::PropertyKey;+use crate::runtime::realm::Realm;use crate::unicode::intl::{self as unicode, Style};use crate::unicode::relative_time_format::{self as unicode_relative_time_format, NumericDisplay, RelativeTimeFormatPartition, TimeUnit,@@ -65,9 +66,15 @@ impl Finalize for RelativeTimeFormat {}impl RelativeTimeFormat {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> RelativeTimeFormat {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> RelativeTimeFormat {RelativeTimeFormat {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),numbering_system: RefCell::default(),style: Cell::new(Style::Long),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_constructor.rsindex 28c5f1a87e9..b026112a7a8 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_constructor.rs@@ -44,11 +44,12 @@ impl RelativeTimeFormatConstructor {// 18.1 The Intl.RelativeTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<RelativeTimeFormatConstructor> {realm.create_object(vm, |_| RelativeTimeFormatConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.RelativeTimeFormat.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.RelativeTimeFormat.as_string().clone()),),})}@@ -103,7 +104,7 @@ impl RelativeTimeFormatConstructor {realm,new_target,Intrinsics::intl_relative_time_format_prototype,- |_, prototype| RelativeTimeFormat::new(vm, prototype),+ |_, prototype| RelativeTimeFormat::new(vm, realm, prototype),)?;// 3. Let optionsResolution be ? ResolveOptions(%Intl.RelativeTimeFormat%, %Intl.RelativeTimeFormat%.[[LocaleData]], locales, options, « COERCE-OPTIONS »).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_prototype.rsindex 0abb5c2e53c..a6b2c53e9fe 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/relative_time_format_prototype.rs@@ -46,7 +46,8 @@ impl RelativeTimeFormatPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator.rs b/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator.rsindex 799b20c49a2..dbb5b78ef34 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator.rs@@ -70,7 +70,8 @@ impl SegmentIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().intl_segment_iterator_prototype(),+ realm,+ Some(realm.intrinsics().intl_segment_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),iterating_segmenter: RefCell::new(Some(segmenter)),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator_prototype.rsindex 164f52dff8c..24ba9cf58bf 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segment_iterator_prototype.rs@@ -42,7 +42,8 @@ impl SegmentIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segmenter.rs b/Libraries/LibJS/Rust/src/runtime/intl/segmenter.rsindex a8f0f948950..3459f46f613 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segmenter.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segmenter.rs@@ -19,6 +19,7 @@ use crate::runtime::completion::{Must, ThrowCompletionOr};use crate::runtime::intl::intl_object::{IntlObject, ResolutionOptionDescriptor};use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::primitive_string::PrimitiveString;+use crate::runtime::realm::Realm;use crate::unicode::intl::{self as unicode, Inclusive, SegmenterGranularity};use crate::utf16::Utf16View;@@ -54,9 +55,15 @@ impl Finalize for Segmenter {}impl Segmenter {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> Segmenter {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> Segmenter {Segmenter {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),locale: RefCell::default(),segmenter_granularity: Cell::new(SegmenterGranularity::Grapheme),segmenter: RefCell::new(None),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segmenter_constructor.rs b/Libraries/LibJS/Rust/src/runtime/intl/segmenter_constructor.rsindex 1dfe19899f2..55ddb15ed90 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segmenter_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segmenter_constructor.rs@@ -44,11 +44,12 @@ impl SegmenterConstructor {// 19.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<SegmenterConstructor> {realm.create_object(vm, |_| SegmenterConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Segmenter.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Segmenter.as_string().clone()),),})}@@ -103,7 +104,7 @@ impl SegmenterConstructor {realm,new_target,Intrinsics::intl_segmenter_prototype,- |_, prototype| Segmenter::new(vm, prototype),+ |_, prototype| Segmenter::new(vm, realm, prototype),)?;// 4. Let optionsResolution be ? ResolveOptions(%Intl.Segmenter%, %Intl.Segmenter%.[[LocaleData]], locales, options).diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segmenter_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/segmenter_prototype.rsindex 40fa1c747b8..8c39634753e 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segmenter_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segmenter_prototype.rs@@ -44,7 +44,8 @@ impl SegmenterPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segments.rs b/Libraries/LibJS/Rust/src/runtime/intl/segments.rsindex df5ad3ecf0e..e7977630dfd 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segments.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segments.rs@@ -68,7 +68,8 @@ impl Segments {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().intl_segments_prototype(),+ realm,+ Some(realm.intrinsics().intl_segments_prototype()),MayInterfereWithIndexedPropertyAccess::No,),segments_segmenter: RefCell::new(Some(segmenter)),diff --git a/Libraries/LibJS/Rust/src/runtime/intl/segments_prototype.rs b/Libraries/LibJS/Rust/src/runtime/intl/segments_prototype.rsindex a4cb3337783..0e619801f09 100644--- a/Libraries/LibJS/Rust/src/runtime/intl/segments_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/intl/segments_prototype.rs@@ -45,7 +45,8 @@ impl SegmentsPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/iterator.rs b/Libraries/LibJS/Rust/src/runtime/iterator.rsindex b6b708a48c7..2ebb14cf2b2 100644--- a/Libraries/LibJS/Rust/src/runtime/iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/iterator.rs@@ -134,9 +134,15 @@ impl Deref for Iterator {}impl Iterator {- pub fn create(vm: &Vm, prototype: Gc<Object>, iterated: Gc<IteratorRecord>) -> Gc<Iterator> {+ pub fn create(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>, iterated: Gc<IteratorRecord>) -> Gc<Iterator> {allocate_object(vm, |_| Iterator {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),iterated: Cell::new(iterated),})}diff --git a/Libraries/LibJS/Rust/src/runtime/iterator_constructor.rs b/Libraries/LibJS/Rust/src/runtime/iterator_constructor.rsindex 871bb4e9eb4..e960634cde4 100644--- a/Libraries/LibJS/Rust/src/runtime/iterator_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/iterator_constructor.rs@@ -58,11 +58,12 @@ impl IteratorConstructor {// 27.1.3.1 The Iterator Constructor, https://tc39.es/ecma262/#sec-iterator-constructorpub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<IteratorConstructor> {realm.create_object(vm, |_| IteratorConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Iterator.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Iterator.as_string().clone()),),})}@@ -183,6 +184,7 @@ impl IteratorConstructor {// 5. Set wrapper.[[Iterated]] to iteratorRecord.let wrapper = Iterator::create(vm,+ realm,realm.intrinsics().wrap_for_valid_iterator_prototype(),iterator_record,);diff --git a/Libraries/LibJS/Rust/src/runtime/iterator_helper_prototype.rs b/Libraries/LibJS/Rust/src/runtime/iterator_helper_prototype.rsindex 9c18a9f7e3b..9949b79d1ce 100644--- a/Libraries/LibJS/Rust/src/runtime/iterator_helper_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/iterator_helper_prototype.rs@@ -45,7 +45,8 @@ impl IteratorHelperPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/iterator_prototype.rsindex 84e15d4a217..b0b94767ee4 100644--- a/Libraries/LibJS/Rust/src/runtime/iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/iterator_prototype.rs@@ -81,7 +81,8 @@ impl IteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/json_object.rs b/Libraries/LibJS/Rust/src/runtime/json_object.rsindex c8dbea2ae8f..c30f34b609a 100644--- a/Libraries/LibJS/Rust/src/runtime/json_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/json_object.rs@@ -1019,7 +1019,8 @@ impl JSONObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/map.rs b/Libraries/LibJS/Rust/src/runtime/map.rsindex 8b44a2646bc..777dd989fa1 100644--- a/Libraries/LibJS/Rust/src/runtime/map.rs+++ b/Libraries/LibJS/Rust/src/runtime/map.rs@@ -138,16 +138,22 @@ impl Finalize for Map {}impl Map {- pub fn new(_: &DeferGc<'_>, vm: &Vm, prototype: Gc<Object>) -> Map {+ pub fn new(_: &DeferGc<'_>, vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> Map {Map {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),storage: GcRefCell::new(MapStorage::default()),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<Map> {realm.create_object(vm, |defer_gc| {- Map::new(defer_gc, vm, realm.intrinsics().map_prototype(vm))+ Map::new(defer_gc, vm, realm, realm.intrinsics().map_prototype(vm))})}diff --git a/Libraries/LibJS/Rust/src/runtime/map_constructor.rs b/Libraries/LibJS/Rust/src/runtime/map_constructor.rsindex 4bfa62c8ce7..d865ae66ba3 100644--- a/Libraries/LibJS/Rust/src/runtime/map_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/map_constructor.rs@@ -123,11 +123,12 @@ impl<'vm> KeyedGroups<'vm> for ValueKeyedGroups<'vm> {impl MapConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<MapConstructor> {realm.create_object(vm, |_| MapConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Map.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Map.as_string().clone()),),})}@@ -185,7 +186,7 @@ impl MapConstructor {realm,new_target,Intrinsics::map_prototype,- |defer_gc, prototype| Map::new(defer_gc, vm, prototype),+ |defer_gc, prototype| Map::new(defer_gc, vm, realm, prototype),)?;if vm.argument(0).is_nullish() {diff --git a/Libraries/LibJS/Rust/src/runtime/map_iterator.rs b/Libraries/LibJS/Rust/src/runtime/map_iterator.rsindex d61fb070e86..03160f1c757 100644--- a/Libraries/LibJS/Rust/src/runtime/map_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/map_iterator.rs@@ -76,7 +76,8 @@ impl MapIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().map_iterator_prototype(),+ realm,+ Some(realm.intrinsics().map_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),map,diff --git a/Libraries/LibJS/Rust/src/runtime/map_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/map_iterator_prototype.rsindex 6f4f3b20d4f..07f8b1204a9 100644--- a/Libraries/LibJS/Rust/src/runtime/map_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/map_iterator_prototype.rs@@ -42,7 +42,8 @@ impl MapIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/map_prototype.rs b/Libraries/LibJS/Rust/src/runtime/map_prototype.rsindex 7f1e64d5f1d..6cdf40058fb 100644--- a/Libraries/LibJS/Rust/src/runtime/map_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/map_prototype.rs@@ -65,7 +65,8 @@ impl MapPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),entries_function: Cell::new(None),diff --git a/Libraries/LibJS/Rust/src/runtime/math_object.rs b/Libraries/LibJS/Rust/src/runtime/math_object.rsindex f52d6a36f8d..2233d256360 100644--- a/Libraries/LibJS/Rust/src/runtime/math_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/math_object.rs@@ -112,7 +112,8 @@ impl MathObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/module_namespace_object.rs b/Libraries/LibJS/Rust/src/runtime/module_namespace_object.rsindex e45a6c99c32..8b360f280cf 100644--- a/Libraries/LibJS/Rust/src/runtime/module_namespace_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/module_namespace_object.rs@@ -100,7 +100,8 @@ impl ModuleNamespaceObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::Yes,),module,diff --git a/Libraries/LibJS/Rust/src/runtime/native_function.rs b/Libraries/LibJS/Rust/src/runtime/native_function.rsindex 108a6f74a7d..ac60fd71c31 100644--- a/Libraries/LibJS/Rust/src/runtime/native_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/native_function.rs@@ -102,34 +102,27 @@ impl NativeFunction {realm: Gc<Realm>,builtin: Option<Builtin>,) -> NativeFunction {- let base = FunctionObject::new_with_realm_and_prototype(- vm,- class,- realm,- prototype,- MayInterfereWithIndexedPropertyAccess::No,- );+ let base =+ FunctionObject::new_with_prototype(vm, class, realm, prototype, MayInterfereWithIndexedPropertyAccess::No);base.set_builtin(builtin);Self::from_function_object(base, None, realm)}- // FIXME: m_realm is supposed to be the realm argument of CreateBuiltinFunction, or the current- // Realm Record. The former is not something that's commonly used or we support, the- // latter is impossible as no ExecutionContext exists when most NativeFunctions are created...-- pub fn new_with_prototype(vm: &Vm, class: &'static Class, prototype: Gc<Object>) -> NativeFunction {- let base = FunctionObject::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No);- Self::from_function_object(base, None, prototype.shape().realm())- }-- pub fn new_with_name(+ pub fn new_with_prototype(vm: &Vm,class: &'static Class,- name: Utf16FlyString,+ realm: Gc<Realm>,prototype: Gc<Object>,+ name: Option<Utf16FlyString>,) -> NativeFunction {- let base = FunctionObject::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No);- Self::from_function_object(base, Some(name), prototype.shape().realm())+ let base = FunctionObject::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ );+ Self::from_function_object(base, name, realm)}fn from_function_object(base: FunctionObject, name: Option<Utf16FlyString>, realm: Gc<Realm>) -> NativeFunction {@@ -232,11 +225,12 @@ impl NativeFunction {{CapturingNativeFunction::create(vm,- NativeFunction::new_with_name(+ NativeFunction::new_with_prototype(vm,CapturingNativeFunction::CLASS,- name.clone(),+ realm,realm.function_prototype(),+ Some(name.clone()),),captures,behaviour,@@ -728,14 +722,15 @@ impl RawNativeFunction {RawNativeFunction { base }}- pub fn new_with_name(+ pub fn new_with_prototype(vm: &Vm,class: &'static Class,+ realm: Gc<Realm>,+ prototype: Gc<Object>,name: Utf16FlyString,native_function: RawNativeFunctionPointer,- prototype: Gc<Object>,) -> RawNativeFunction {- let base = NativeFunction::new_with_name(vm, class, name, prototype);+ let base = NativeFunction::new_with_prototype(vm, class, realm, prototype, Some(name));base.set_is_raw_native_function();base.raw_native_function_index.set(vm.register_native_function(NativeFunctionTableEntry {@@ -775,7 +770,14 @@ impl RawNativeFunction {function: RawNativeFunctionPointer,) -> Gc<RawNativeFunction> {allocate_object(vm, |_| {- Self::new_with_name(vm, Self::CLASS, name.clone(), function, realm.function_prototype())+ Self::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ realm.function_prototype(),+ name.clone(),+ function,+ )})}diff --git a/Libraries/LibJS/Rust/src/runtime/native_javascript_backed_function.rs b/Libraries/LibJS/Rust/src/runtime/native_javascript_backed_function.rsindex ccbb4b8a74b..4f8ac2ea48c 100644--- a/Libraries/LibJS/Rust/src/runtime/native_javascript_backed_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/native_javascript_backed_function.rs@@ -99,7 +99,7 @@ impl NativeJavaScriptBackedFunction {// 8. Set func.[[Realm]] to realm.// 9. Set func.[[InitialName]] to null.let function = realm.create_object(vm, |_| NativeJavaScriptBackedFunction {- base: NativeFunction::new_with_name(vm, Self::CLASS, shared_data.name(), prototype),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, prototype, Some(shared_data.name())),shared_function_instance_data: Cell::new(shared_data),});diff --git a/Libraries/LibJS/Rust/src/runtime/number_constructor.rs b/Libraries/LibJS/Rust/src/runtime/number_constructor.rsindex 2f1c68abb05..926f0932fa2 100644--- a/Libraries/LibJS/Rust/src/runtime/number_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/number_constructor.rs@@ -65,11 +65,12 @@ fn get_value_from_constructor_argument(vm: &Vm) -> ThrowCompletionOr<Value> {impl NumberConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<NumberConstructor> {realm.create_object(vm, |_| NumberConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Number.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Number.as_string().clone()),),})}@@ -175,7 +176,7 @@ impl NumberConstructor {let prototype = get_prototype_from_constructor(vm, new_target, Intrinsics::number_prototype)?;Ok(realm.create_object(vm, |_| {- NumberObject::new(vm, NumberObject::CLASS, number.as_f64(), prototype)+ NumberObject::new(vm, realm, NumberObject::CLASS, number.as_f64(), prototype)}).upcast())}diff --git a/Libraries/LibJS/Rust/src/runtime/number_object.rs b/Libraries/LibJS/Rust/src/runtime/number_object.rsindex 08a690b1c05..4afdcc32fcc 100644--- a/Libraries/LibJS/Rust/src/runtime/number_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/number_object.rs@@ -36,16 +36,22 @@ impl Deref for NumberObject {impl NumberObject {/// A NumberObject with `prototype`, for `class`, which is NumberObject or a class that extends it.- pub fn new(vm: &Vm, class: &'static Class, value: f64, prototype: Gc<Object>) -> NumberObject {+ pub fn new(vm: &Vm, realm: Gc<Realm>, class: &'static Class, value: f64, prototype: Gc<Object>) -> NumberObject {NumberObject {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),value: Cell::new(value),}}pub fn create(vm: &Vm, realm: Gc<Realm>, value: f64) -> Gc<NumberObject> {realm.create_object(vm, |_| {- NumberObject::new(vm, Self::CLASS, value, realm.intrinsics().number_prototype(vm))+ NumberObject::new(vm, realm, Self::CLASS, value, realm.intrinsics().number_prototype(vm))})}diff --git a/Libraries/LibJS/Rust/src/runtime/number_prototype.rs b/Libraries/LibJS/Rust/src/runtime/number_prototype.rsindex 0f17b6be466..b2df6e78d2f 100644--- a/Libraries/LibJS/Rust/src/runtime/number_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/number_prototype.rs@@ -66,7 +66,7 @@ fn number_to_string_value(vm: &Vm, number_value: Value) -> Value {impl NumberPrototype {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<NumberPrototype> {realm.create_object(vm, |_| NumberPrototype {- base: NumberObject::new(vm, Self::CLASS, 0.0, realm.object_prototype()),+ base: NumberObject::new(vm, realm, Self::CLASS, 0.0, realm.object_prototype()),})}diff --git a/Libraries/LibJS/Rust/src/runtime/object.rs b/Libraries/LibJS/Rust/src/runtime/object.rsindex 7916141c0ba..35b400ebe1c 100644--- a/Libraries/LibJS/Rust/src/runtime/object.rs+++ b/Libraries/LibJS/Rust/src/runtime/object.rs@@ -615,7 +615,7 @@ impl Object {)}- pub fn new_with_realm_and_prototype(+ pub fn new_with_prototype(vm: &Vm,class: &'static Class,realm: Gc<Realm>,@@ -629,20 +629,6 @@ impl Object {Self::new_with_shape(class, shape, may_interfere_with_indexed_property_access)}- #[inline]- pub fn new_with_prototype(- vm: &Vm,- class: &'static Class,- prototype: Gc<Object>,- may_interfere_with_indexed_property_access: MayInterfereWithIndexedPropertyAccess,- ) -> Object {- let mut shape = prototype.shape().realm().empty_object_shape();- if shape.prototype() != Some(prototype) {- shape = shape.create_prototype_transition(vm, Some(prototype));- }- Self::new_with_shape(class, shape, may_interfere_with_indexed_property_access)- }-// 10.1.12 OrdinaryObjectCreate ( proto [ , additionalInternalSlotsList ] ), https://tc39.es/ecma262/#sec-ordinaryobjectcreatepub fn create(vm: &Vm, realm: Gc<Realm>, prototype: Option<Gc<Object>>) -> Gc<Object> {let Some(prototype) = prototype else {@@ -661,7 +647,13 @@ impl Object {);return Self::allocate_plain_object(vm, object, 0);}- let object = Self::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No);+ let object = Self::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ );Self::allocate_plain_object(vm, object, 0)}@@ -688,10 +680,11 @@ impl Object {/// SharedFunctionInstanceData::construct_reserve()).pub fn create_for_construct(vm: &Vm,+ realm: Gc<Realm>,prototype: Gc<Object>,shared_data: Gc<SharedFunctionInstanceData>,) -> Gc<Object> {- let mut shape = prototype.shape().realm().empty_object_shape();+ let mut shape = realm.empty_object_shape();if shape.prototype() != Some(prototype) {shape = shape.create_prototype_transition(vm, Some(prototype));}diff --git a/Libraries/LibJS/Rust/src/runtime/object_constructor.rs b/Libraries/LibJS/Rust/src/runtime/object_constructor.rsindex 3c567d4e0a7..ea5e26d5914 100644--- a/Libraries/LibJS/Rust/src/runtime/object_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/object_constructor.rs@@ -49,11 +49,12 @@ define_native_function_class!(impl ObjectConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ObjectConstructor> {realm.create_object(vm, |_| ObjectConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Object.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Object.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/promise.rs b/Libraries/LibJS/Rust/src/runtime/promise.rsindex 6aedef2d2ca..947a74a58b2 100644--- a/Libraries/LibJS/Rust/src/runtime/promise.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise.rs@@ -126,14 +126,26 @@ impl Deref for Promise {impl Promise {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<Promise> {realm.create_object(vm, |defer_gc| {- Promise::new(defer_gc, vm, Self::CLASS, realm.intrinsics().promise_prototype(vm))+ Promise::new(+ defer_gc,+ vm,+ realm,+ Self::CLASS,+ realm.intrinsics().promise_prototype(vm),+ )})}/// A promise with `prototype`, for `class`, which is Promise or a class that extends it.- pub fn new(_: &DeferGc<'_>, vm: &Vm, class: &'static Class, prototype: Gc<Object>) -> Promise {+ pub fn new(_: &DeferGc<'_>, vm: &Vm, realm: Gc<Realm>, class: &'static Class, prototype: Gc<Object>) -> Promise {Promise {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),state: Cell::new(PromiseState::Pending),is_handled: Cell::new(false),has_resolver: Cell::new(false),diff --git a/Libraries/LibJS/Rust/src/runtime/promise_capability.rs b/Libraries/LibJS/Rust/src/runtime/promise_capability.rsindex e8bbfdce75e..d19c8b15519 100644--- a/Libraries/LibJS/Rust/src/runtime/promise_capability.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise_capability.rs@@ -177,7 +177,7 @@ pub fn new_promise_capability(vm: &Vm, constructor: Value) -> ThrowCompletionOr<realm,constructor.as_function(),|intrinsics, vm| intrinsics.promise_prototype(vm),- |defer_gc, prototype| Promise::new(defer_gc, vm, Promise::CLASS, prototype),+ |defer_gc, prototype| Promise::new(defer_gc, vm, realm, Promise::CLASS, prototype),)?;let resolving_functions = promise.create_resolving_functions(vm);return Ok(PromiseCapability::create(diff --git a/Libraries/LibJS/Rust/src/runtime/promise_constructor.rs b/Libraries/LibJS/Rust/src/runtime/promise_constructor.rsindex 0b82503f077..d28e0367139 100644--- a/Libraries/LibJS/Rust/src/runtime/promise_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise_constructor.rs@@ -604,11 +604,12 @@ define_native_function_class!(impl PromiseConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PromiseConstructor> {realm.create_object(vm, |_| PromiseConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Promise.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Promise.as_string().clone()),),})}@@ -742,7 +743,7 @@ impl PromiseConstructor {realm,new_target,|intrinsics, vm| intrinsics.promise_prototype(vm),- |defer_gc, prototype| Promise::new(defer_gc, vm, Promise::CLASS, prototype),+ |defer_gc, prototype| Promise::new(defer_gc, vm, realm, Promise::CLASS, prototype),)?;// 8. Let resolvingFunctions be CreateResolvingFunctions(promise).diff --git a/Libraries/LibJS/Rust/src/runtime/promise_prototype.rs b/Libraries/LibJS/Rust/src/runtime/promise_prototype.rsindex db7ee050406..8707064aa62 100644--- a/Libraries/LibJS/Rust/src/runtime/promise_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise_prototype.rs@@ -50,7 +50,8 @@ impl PromisePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().object_prototype(vm),+ realm,+ Some(realm.intrinsics().object_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/promise_resolving_element_functions.rs b/Libraries/LibJS/Rust/src/runtime/promise_resolving_element_functions.rsindex 468d614d949..17fb8d20502 100644--- a/Libraries/LibJS/Rust/src/runtime/promise_resolving_element_functions.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise_resolving_element_functions.rs@@ -156,6 +156,7 @@ impl PromiseResolvingElementFunction {#[allow(clippy::too_many_arguments)]fn new(vm: &Vm,+ realm: Gc<Realm>,class: &'static Class,index: usize,values: Gc<PromiseValueList>,@@ -165,7 +166,7 @@ impl PromiseResolvingElementFunction {resolve_element: ResolveElement,) -> PromiseResolvingElementFunction {PromiseResolvingElementFunction {- base: NativeFunction::new_with_prototype(vm, class, prototype),+ base: NativeFunction::new_with_prototype(vm, class, realm, prototype, None),index: Cell::new(index),values: Cell::new(values),capability: Cell::new(capability),@@ -251,7 +252,7 @@ macro_rules! define_promise_resolving_element_function {vm,|_| $type {base: PromiseResolvingElementFunction::new(- vm,+ vm, realm,Self::CLASS,index,values,diff --git a/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rs b/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rsindex 12e81cb8132..b14e60252c4 100644--- a/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rs@@ -74,6 +74,7 @@ impl PromiseResolvingFunction {realm.create_object(vm, |_| {Self::new(vm,+ realm,promise,PromiseResolvingFunctionKind::Resolve,None,@@ -91,6 +92,7 @@ impl PromiseResolvingFunction {realm.create_object(vm, |_| {Self::new(vm,+ realm,promise,PromiseResolvingFunctionKind::Reject,Some(resolve_function),@@ -101,13 +103,14 @@ impl PromiseResolvingFunction {fn new(vm: &Vm,+ realm: Gc<Realm>,promise: Gc<Promise>,kind: PromiseResolvingFunctionKind,resolve_function: Option<Gc<PromiseResolvingFunction>>,prototype: Gc<Object>,) -> PromiseResolvingFunction {PromiseResolvingFunction {- base: NativeFunction::new_with_prototype(vm, Self::CLASS, prototype),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, prototype, None),promise: Member::new(promise),resolve_function: NullableMember::new(resolve_function),already_resolved: Cell::new(false),diff --git a/Libraries/LibJS/Rust/src/runtime/proxy_constructor.rs b/Libraries/LibJS/Rust/src/runtime/proxy_constructor.rsindex dc37290b7e7..dac7da65e7a 100644--- a/Libraries/LibJS/Rust/src/runtime/proxy_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/proxy_constructor.rs@@ -72,11 +72,12 @@ define_native_function_class!(impl ProxyConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ProxyConstructor> {realm.create_object(vm, |_| ProxyConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Proxy.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Proxy.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/proxy_object.rs b/Libraries/LibJS/Rust/src/runtime/proxy_object.rsindex 80b414de422..6b6dcb290d5 100644--- a/Libraries/LibJS/Rust/src/runtime/proxy_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/proxy_object.rs@@ -189,15 +189,16 @@ impl<'list, 'vm> UncheckedResultKeys<'list, 'vm> {impl ProxyObject {pub fn create(vm: &Vm, realm: Gc<Realm>, target: Gc<Object>, handler: Gc<Object>) -> Gc<ProxyObject> {- realm.create_object(vm, |_| Self::new(vm, target, handler, realm.object_prototype()))+ realm.create_object(vm, |_| Self::new(vm, realm, target, handler, realm.object_prototype()))}- fn new(vm: &Vm, target: Gc<Object>, handler: Gc<Object>, prototype: Gc<Object>) -> ProxyObject {+ fn new(vm: &Vm, realm: Gc<Realm>, target: Gc<Object>, handler: Gc<Object>, prototype: Gc<Object>) -> ProxyObject {let proxy_object = ProxyObject {base: FunctionObject::new_with_prototype(vm,Self::CLASS,- prototype,+ realm,+ Some(prototype),MayInterfereWithIndexedPropertyAccess::Yes,),target: Member::new(target),diff --git a/Libraries/LibJS/Rust/src/runtime/raw_json_object.rs b/Libraries/LibJS/Rust/src/runtime/raw_json_object.rsindex 70b1674d09d..a9e37f56493 100644--- a/Libraries/LibJS/Rust/src/runtime/raw_json_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/raw_json_object.rs@@ -39,7 +39,13 @@ impl RawJSONObject {};realm.create_object(vm, |_| RawJSONObject {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),})}}diff --git a/Libraries/LibJS/Rust/src/runtime/reflect_object.rs b/Libraries/LibJS/Rust/src/runtime/reflect_object.rsindex 5f0a1b71ba6..1eedc02612d 100644--- a/Libraries/LibJS/Rust/src/runtime/reflect_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/reflect_object.rs@@ -53,7 +53,8 @@ impl ReflectObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/regexp_constructor.rs b/Libraries/LibJS/Rust/src/runtime/regexp_constructor.rsindex fd3e6a664df..b698d0b61d2 100644--- a/Libraries/LibJS/Rust/src/runtime/regexp_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/regexp_constructor.rs@@ -94,11 +94,12 @@ define_native_function_class!(impl RegExpConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<RegExpConstructor> {realm.create_object(vm, |_| RegExpConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.RegExp.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.RegExp.as_string().clone()),),legacy_static_properties: RegExpLegacyStaticProperties::default(),})@@ -215,6 +216,7 @@ impl RegExpConstructor {// 22.2.4.1 RegExp ( pattern, flags ), https://tc39.es/ecma262/#sec-regexp-pattern-flagsfn call(function: &NativeFunction, vm: &Vm) -> ThrowCompletionOr<Value> {+ let realm = vm.current_realm().expect("a native function runs in a realm");let pattern = vm.argument(0);let flags = vm.argument(1);@@ -239,6 +241,7 @@ impl RegExpConstructor {// Reuse the already-computed patternIsRegExp to avoid re-reading @@match.Ok(Value::from_object(Self::construct_impl(vm,+ realm,new_target,pattern_is_regexp,)?))@@ -246,15 +249,17 @@ impl RegExpConstructor {// 22.2.4.1 RegExp ( pattern, flags ), https://tc39.es/ecma262/#sec-regexp-pattern-flagsfn construct(_: &NativeFunction, vm: &Vm, new_target: Gc<FunctionObject>) -> ThrowCompletionOr<Gc<Object>> {+ let realm = vm.current_realm().expect("a native function runs in a realm");// 1. Let patternIsRegExp be ? IsRegExp(pattern).let pattern_is_regexp = vm.argument(0).is_regexp(vm)?;// 3. Else, let newTarget be NewTarget.- Self::construct_impl(vm, new_target, pattern_is_regexp)+ Self::construct_impl(vm, realm, new_target, pattern_is_regexp)}pub fn construct_impl(vm: &Vm,+ realm: Gc<Realm>,new_target: Gc<FunctionObject>,pattern_is_regexp: bool,) -> ThrowCompletionOr<Gc<Object>> {@@ -307,7 +312,7 @@ impl RegExpConstructor {}// 7. Let O be ? RegExpAlloc(newTarget).- let regexp_object = regexp_alloc(vm, new_target)?;+ let regexp_object = regexp_alloc(vm, realm, new_target)?;// 8. Return ? RegExpInitialize(O, P, F).Ok(regexp_objectdiff --git a/Libraries/LibJS/Rust/src/runtime/regexp_object.rs b/Libraries/LibJS/Rust/src/runtime/regexp_object.rsindex 0c957cece36..eae521ca0c9 100644--- a/Libraries/LibJS/Rust/src/runtime/regexp_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/regexp_object.rs@@ -183,6 +183,7 @@ impl RegExpObject {realm.create_object(vm, |_| {Self::new(vm,+ realm,Utf16String::default(),Utf16String::default(),realm.intrinsics().regexp_prototype(vm),@@ -223,13 +224,14 @@ impl RegExpObject {base}- fn new(vm: &Vm, pattern: Utf16String, flags: Utf16String, prototype: Gc<Object>) -> RegExpObject {+ fn new(vm: &Vm, realm: Gc<Realm>, pattern: Utf16String, flags: Utf16String, prototype: Gc<Object>) -> RegExpObject {let flag_bits = to_flag_bits(Utf16View::of_string(&flags));RegExpObject {base: Self::with_inline_named_storage(Object::new_with_prototype(vm,Self::CLASS,- prototype,+ realm,+ Some(prototype),MayInterfereWithIndexedPropertyAccess::No,)),inline_named_storage: [const { Cell::new(Value::UNDEFINED) }; 1],@@ -467,7 +469,7 @@ pub fn regexp_create(vm: &Vm, pattern: Value, flags: Value) -> ThrowCompletionOrlet realm = vm.current_realm().expect("RegExpCreate runs in a realm");// 1. Let obj be ! RegExpAlloc(%RegExp%).- let regexp_object = regexp_alloc(vm, realm.intrinsics().regexp_constructor(vm).upcast()).must();+ let regexp_object = regexp_alloc(vm, realm, realm.intrinsics().regexp_constructor(vm).upcast()).must();// 2. Return ? RegExpInitialize(obj, P, F).regexp_object.regexp_initialize(vm, pattern, flags)@@ -475,7 +477,7 @@ pub fn regexp_create(vm: &Vm, pattern: Value, flags: Value) -> ThrowCompletionOr// 22.2.3.2 RegExpAlloc ( newTarget ), https://tc39.es/ecma262/#sec-regexpalloc// 22.2.3.2 RegExpAlloc ( newTarget ), https://github.com/tc39/proposal-regexp-legacy-features#regexpalloc--newtarget--pub fn regexp_alloc(vm: &Vm, new_target: Gc<FunctionObject>) -> ThrowCompletionOr<Gc<RegExpObject>> {+pub fn regexp_alloc(vm: &Vm, realm: Gc<Realm>, new_target: Gc<FunctionObject>) -> ThrowCompletionOr<Gc<RegExpObject>> {let current_realm = vm.current_realm().expect("RegExpAlloc runs in a realm");// 1. Let obj be ? OrdinaryCreateFromConstructor(newTarget, "%RegExp.prototype%", « [[OriginalSource]], [[OriginalFlags]], [[RegExpRecord]], [[RegExpMatcher]] »).@@ -484,7 +486,7 @@ pub fn regexp_alloc(vm: &Vm, new_target: Gc<FunctionObject>) -> ThrowCompletionOcurrent_realm,new_target,Intrinsics::regexp_prototype,- |_, prototype| RegExpObject::new(vm, Utf16String::default(), Utf16String::default(), prototype),+ |_, prototype| RegExpObject::new(vm, realm, Utf16String::default(), Utf16String::default(), prototype),)?;// 2. Let thisRealm be the current Realm Record.diff --git a/Libraries/LibJS/Rust/src/runtime/regexp_prototype.rs b/Libraries/LibJS/Rust/src/runtime/regexp_prototype.rsindex fa1af67e143..170e9d4adea 100644--- a/Libraries/LibJS/Rust/src/runtime/regexp_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/regexp_prototype.rs@@ -762,7 +762,8 @@ impl RegExpPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator.rs b/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator.rsindex c7881632a95..d9d4dc9271c 100644--- a/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator.rs@@ -55,7 +55,8 @@ impl RegExpStringIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().regexp_string_iterator_prototype(),+ realm,+ Some(realm.intrinsics().regexp_string_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),regexp_object,diff --git a/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator_prototype.rsindex 8db53524802..5b24399e403 100644--- a/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/regexp_string_iterator_prototype.rs@@ -45,7 +45,8 @@ impl RegExpStringIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/set.rs b/Libraries/LibJS/Rust/src/runtime/set.rsindex 49cabc6ded2..c6761a0b418 100644--- a/Libraries/LibJS/Rust/src/runtime/set.rs+++ b/Libraries/LibJS/Rust/src/runtime/set.rs@@ -35,15 +35,21 @@ define_object_class!(Set, extends: [Object], methods: {});impl Set {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> Set {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> Set {Set {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),values: Cell::new(None),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<Set> {- realm.create_object(vm, |_| Set::new(vm, realm.intrinsics().set_prototype(vm)))+ realm.create_object(vm, |_| Set::new(vm, realm, realm.intrinsics().set_prototype(vm)))}fn initialize(object: &Object, vm: &Vm, realm: Gc<Realm>) {diff --git a/Libraries/LibJS/Rust/src/runtime/set_constructor.rs b/Libraries/LibJS/Rust/src/runtime/set_constructor.rsindex 50e7445eed9..a45eb109cac 100644--- a/Libraries/LibJS/Rust/src/runtime/set_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/set_constructor.rs@@ -43,11 +43,12 @@ define_native_function_class!(impl SetConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<SetConstructor> {realm.create_object(vm, |_| SetConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Set.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Set.as_string().clone()),),})}@@ -94,7 +95,7 @@ impl SetConstructor {// 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%Set.prototype%", « [[SetData]] »).let set =ordinary_create_from_constructor_of(vm, realm, new_target, Intrinsics::set_prototype, |_, prototype| {- Set::new(vm, prototype)+ Set::new(vm, realm, prototype)})?;// 3. Set set.[[SetData]] to a new empty List.diff --git a/Libraries/LibJS/Rust/src/runtime/set_iterator.rs b/Libraries/LibJS/Rust/src/runtime/set_iterator.rsindex 12f2d28e310..fe6c96ad3bf 100644--- a/Libraries/LibJS/Rust/src/runtime/set_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/set_iterator.rs@@ -74,7 +74,8 @@ impl SetIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().set_iterator_prototype(),+ realm,+ Some(realm.intrinsics().set_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),set,diff --git a/Libraries/LibJS/Rust/src/runtime/set_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/set_iterator_prototype.rsindex f758523e4f8..d89bc4b17b8 100644--- a/Libraries/LibJS/Rust/src/runtime/set_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/set_iterator_prototype.rs@@ -42,7 +42,8 @@ impl SetIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/set_prototype.rs b/Libraries/LibJS/Rust/src/runtime/set_prototype.rsindex 29d3a4f8895..ba000f72051 100644--- a/Libraries/LibJS/Rust/src/runtime/set_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/set_prototype.rs@@ -66,7 +66,8 @@ impl SetPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),values_function: Cell::new(None),diff --git a/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_constructor.rs b/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_constructor.rsindex 66dae113f85..4bdfff9d873 100644--- a/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_constructor.rs@@ -37,11 +37,12 @@ define_native_function_class!(impl SharedArrayBufferConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<SharedArrayBufferConstructor> {realm.create_object(vm, |_| SharedArrayBufferConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.SharedArrayBuffer.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.SharedArrayBuffer.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_prototype.rs b/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_prototype.rsindex dffa7b83252..bba647d49b3 100644--- a/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/shared_array_buffer_prototype.rs@@ -45,7 +45,8 @@ impl SharedArrayBufferPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/string_constructor.rs b/Libraries/LibJS/Rust/src/runtime/string_constructor.rsindex 14b3683f5cb..53be71da710 100644--- a/Libraries/LibJS/Rust/src/runtime/string_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/string_constructor.rs@@ -42,11 +42,12 @@ define_native_function_class!(impl StringConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<StringConstructor> {realm.create_object(vm, |_| StringConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.String.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.String.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/string_iterator.rs b/Libraries/LibJS/Rust/src/runtime/string_iterator.rsindex 63e65513b00..85f09db8259 100644--- a/Libraries/LibJS/Rust/src/runtime/string_iterator.rs+++ b/Libraries/LibJS/Rust/src/runtime/string_iterator.rs@@ -44,7 +44,8 @@ impl StringIterator {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().string_iterator_prototype(),+ realm,+ Some(realm.intrinsics().string_iterator_prototype()),MayInterfereWithIndexedPropertyAccess::No,),string,diff --git a/Libraries/LibJS/Rust/src/runtime/string_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/string_iterator_prototype.rsindex e74326c95f9..7624d3ca9cd 100644--- a/Libraries/LibJS/Rust/src/runtime/string_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/string_iterator_prototype.rs@@ -42,7 +42,8 @@ impl StringIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/string_object.rs b/Libraries/LibJS/Rust/src/runtime/string_object.rsindex ea4f5fa4dce..69e759e683a 100644--- a/Libraries/LibJS/Rust/src/runtime/string_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/string_object.rs@@ -61,9 +61,21 @@ fn as_string_object(object: &Object) -> &StringObject {impl StringObject {/// A StringObject with `prototype`, for `class`, which is StringObject or a class that extends it.- pub fn new(vm: &Vm, class: &'static Class, string: Gc<PrimitiveString>, prototype: Gc<Object>) -> StringObject {+ pub fn new(+ vm: &Vm,+ realm: Gc<Realm>,+ class: &'static Class,+ string: Gc<PrimitiveString>,+ prototype: Gc<Object>,+ ) -> StringObject {StringObject {- base: Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::Yes),+ base: Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::Yes,+ ),string,}}@@ -84,7 +96,9 @@ impl StringObject {// 7. Let length be the length of value.// 8. Perform ! DefinePropertyOrThrow(S, "length", PropertyDescriptor { [[Value]]: 𝔽(length), [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }).// 9. Return S.- realm.create_object(vm, |_| StringObject::new(vm, Self::CLASS, primitive_string, prototype))+ realm.create_object(vm, |_| {+ StringObject::new(vm, realm, Self::CLASS, primitive_string, prototype)+ })}pub fn primitive_string(&self) -> Gc<PrimitiveString> {diff --git a/Libraries/LibJS/Rust/src/runtime/string_prototype.rs b/Libraries/LibJS/Rust/src/runtime/string_prototype.rsindex 80155d8cc6c..444b1462a9c 100644--- a/Libraries/LibJS/Rust/src/runtime/string_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/string_prototype.rs@@ -280,7 +280,7 @@ impl StringPrototype {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<StringPrototype> {realm.create_object(vm, |_| StringPrototype {- base: StringObject::new(vm, Self::CLASS, vm.empty_string(), realm.object_prototype()),+ base: StringObject::new(vm, realm, Self::CLASS, vm.empty_string(), realm.object_prototype()),})}diff --git a/Libraries/LibJS/Rust/src/runtime/suppressed_error.rs b/Libraries/LibJS/Rust/src/runtime/suppressed_error.rsindex 08db8934bd7..86c77dcff37 100644--- a/Libraries/LibJS/Rust/src/runtime/suppressed_error.rs+++ b/Libraries/LibJS/Rust/src/runtime/suppressed_error.rs@@ -32,21 +32,21 @@ impl Deref for SuppressedError {}impl SuppressedError {- pub fn new(vm: &Vm, prototype: Gc<Object>) -> SuppressedError {+ pub fn new(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> SuppressedError {SuppressedError {- base: Error::new(vm, Self::CLASS, prototype),+ base: Error::new(vm, realm, Self::CLASS, prototype),}}- pub fn new_in_constructor(vm: &Vm, prototype: Gc<Object>) -> SuppressedError {+ pub fn new_in_constructor(vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> SuppressedError {SuppressedError {- base: Error::new_in_constructor(vm, Self::CLASS, prototype),+ base: Error::new_in_constructor(vm, realm, Self::CLASS, prototype),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<SuppressedError> {realm.create_object(vm, |_| {- SuppressedError::new(vm, realm.intrinsics().suppressed_error_prototype(vm))+ SuppressedError::new(vm, realm, realm.intrinsics().suppressed_error_prototype(vm))})}}diff --git a/Libraries/LibJS/Rust/src/runtime/suppressed_error_constructor.rs b/Libraries/LibJS/Rust/src/runtime/suppressed_error_constructor.rsindex b85306181a1..8b9e56f5b06 100644--- a/Libraries/LibJS/Rust/src/runtime/suppressed_error_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/suppressed_error_constructor.rs@@ -41,7 +41,9 @@ impl SuppressedErrorConstructor {base: NativeFunction::new_with_prototype(vm,Self::CLASS,+ realm,realm.intrinsics().error_constructor(vm).upcast(),+ None,),})}@@ -88,7 +90,7 @@ impl SuppressedErrorConstructor {realm,new_target,Intrinsics::suppressed_error_prototype,- |_, prototype| SuppressedError::new_in_constructor(vm, prototype),+ |_, prototype| SuppressedError::new_in_constructor(vm, realm, prototype),)?;// 3. If message is not undefined, thendiff --git a/Libraries/LibJS/Rust/src/runtime/suppressed_error_prototype.rs b/Libraries/LibJS/Rust/src/runtime/suppressed_error_prototype.rsindex c64dca9903a..0d9f905ddb8 100644--- a/Libraries/LibJS/Rust/src/runtime/suppressed_error_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/suppressed_error_prototype.rs@@ -34,7 +34,8 @@ impl SuppressedErrorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().error_prototype(vm),+ realm,+ Some(realm.intrinsics().error_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/symbol_constructor.rs b/Libraries/LibJS/Rust/src/runtime/symbol_constructor.rsindex 107d488f16a..185745ccd87 100644--- a/Libraries/LibJS/Rust/src/runtime/symbol_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/symbol_constructor.rs@@ -37,11 +37,12 @@ define_native_function_class!(impl SymbolConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<SymbolConstructor> {realm.create_object(vm, |_| SymbolConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Symbol.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Symbol.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/symbol_object.rs b/Libraries/LibJS/Rust/src/runtime/symbol_object.rsindex eb0be6a7d5f..bfe9783d939 100644--- a/Libraries/LibJS/Rust/src/runtime/symbol_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/symbol_object.rs@@ -40,7 +40,8 @@ impl SymbolObject {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().symbol_prototype(vm),+ realm,+ Some(realm.intrinsics().symbol_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),symbol: primitive_symbol,diff --git a/Libraries/LibJS/Rust/src/runtime/symbol_prototype.rs b/Libraries/LibJS/Rust/src/runtime/symbol_prototype.rsindex a5025728ce2..ec6685f1480 100644--- a/Libraries/LibJS/Rust/src/runtime/symbol_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/symbol_prototype.rs@@ -42,7 +42,8 @@ impl SymbolPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/duration.rs b/Libraries/LibJS/Rust/src/runtime/temporal/duration.rsindex 4c683debe47..811a2e0e9d4 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/duration.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/duration.rs@@ -28,6 +28,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::{AkDouble, ErrorType};use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, Disambiguation, Overflow, Precision, Sign, Unit, UnitCategory, apply_unsigned_rounding_mode,format_fractional_seconds, get_unsigned_rounding_mode, is_calendar_unit, larger_of_two_temporal_units,@@ -135,13 +136,19 @@ fn normalize_field(value: f64) -> f64 {}impl Duration {- fn new(vm: &Vm, fields: DurationFields, prototype: Gc<Object>) -> Duration {+ fn new(vm: &Vm, realm: Gc<Realm>, fields: DurationFields, prototype: Gc<Object>) -> Duration {// NOTE: The spec stores these fields as mathematical values. VERIFY() that we have finite, integral values in them,// and normalize any negative zeros caused by floating point math. This is usually done using ℝ(𝔽(value)) at// the call site.let fields = fields.map(normalize_field);Duration {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),years: fields.years,months: fields.months,weeks: fields.weeks,@@ -1042,7 +1049,7 @@ pub fn create_temporal_duration(realm,new_target,Intrinsics::temporal_duration_prototype,- |_, prototype| Duration::new(vm, fields, prototype),+ |_, prototype| Duration::new(vm, realm, fields, prototype),)?;// 14. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/duration_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/duration_constructor.rsindex 54ef442e986..8a97e289559 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/duration_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/duration_constructor.rs@@ -49,11 +49,12 @@ define_native_function_class!(impl DurationConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<DurationConstructor> {realm.create_object(vm, |_| DurationConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Duration.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Duration.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/duration_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/duration_prototype.rsindex f26b575294e..196f5b6989b 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/duration_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/duration_prototype.rs@@ -103,7 +103,8 @@ impl DurationPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/instant.rs b/Libraries/LibJS/Rust/src/runtime/temporal/instant.rsindex 8688f3de474..0012b21dc51 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/instant.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/instant.rs@@ -24,6 +24,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, DurationOperation, SecondsPrecision, ShowCalendar, Unit, UnitCategory, UnitGroup, ascii_view,check_iso_days_range, get_difference_settings, parse_iso_date_time, round_number_to_increment_as_if_positive,@@ -66,9 +67,15 @@ impl core::ops::Deref for Instant {}impl Instant {- fn new(vm: &Vm, epoch_nanoseconds: Gc<BigInt>, prototype: Gc<Object>) -> Instant {+ fn new(vm: &Vm, realm: Gc<Realm>, epoch_nanoseconds: Gc<BigInt>, prototype: Gc<Object>) -> Instant {Instant {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),epoch_nanoseconds,}}@@ -144,7 +151,7 @@ pub fn create_temporal_instant(realm,new_target,Intrinsics::temporal_instant_prototype,- |_, prototype| Instant::new(vm, epoch_nanoseconds, prototype),+ |_, prototype| Instant::new(vm, realm, epoch_nanoseconds, prototype),)?;// 5. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/instant_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/instant_constructor.rsindex 59d6c9b2bab..7ee02a2cf09 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/instant_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/instant_constructor.rs@@ -43,11 +43,12 @@ define_native_function_class!(impl InstantConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<InstantConstructor> {realm.create_object(vm, |_| InstantConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.Instant.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.Instant.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/instant_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/instant_prototype.rsindex 1c982fc271d..b7b64accbdd 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/instant_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/instant_prototype.rs@@ -72,7 +72,8 @@ impl InstantPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/now.rs b/Libraries/LibJS/Rust/src/runtime/temporal/now.rsindex 8cf1d362ff7..b3913f5a291 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/now.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/now.rs@@ -51,7 +51,8 @@ impl Now {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date.rsindex f955ebed91d..f06641140d9 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date.rs@@ -22,6 +22,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, DurationOperation, Overflow, ShowCalendar, Unit, UnitGroup, ascii_view,epoch_days_to_epoch_ms, get_difference_settings, get_temporal_overflow_option, iso_date_to_epoch_days,@@ -73,9 +74,15 @@ impl core::ops::Deref for PlainDate {}impl PlainDate {- fn new(vm: &Vm, iso_date: ISODate, calendar: Utf16String, prototype: Gc<Object>) -> PlainDate {+ fn new(vm: &Vm, realm: Gc<Realm>, iso_date: ISODate, calendar: Utf16String, prototype: Gc<Object>) -> PlainDate {PlainDate {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),iso_date,calendar,}@@ -128,7 +135,7 @@ pub fn create_temporal_date(realm,new_target,Intrinsics::temporal_plain_date_prototype,- |_, prototype| PlainDate::new(vm, iso_date, calendar, prototype),+ |_, prototype| PlainDate::new(vm, realm, iso_date, calendar, prototype),)?;// 6. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_constructor.rsindex 456d6f2c034..eef774017a1 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_constructor.rs@@ -44,11 +44,12 @@ define_native_function_class!(impl PlainDateConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PlainDateConstructor> {realm.create_object(vm, |_| PlainDateConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.PlainDate.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.PlainDate.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_prototype.rsindex a2f04e79d08..d1c0989a8ff 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_prototype.rs@@ -86,7 +86,8 @@ impl PlainDatePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time.rsindex 5860ff44979..1b1092d2178 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time.rs@@ -29,6 +29,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, DurationOperation, Overflow, SecondsPrecision, ShowCalendar, Unit, UnitGroup, ascii_view,format_time_string, get_difference_settings, get_temporal_overflow_option, iso_date_to_epoch_days,@@ -78,9 +79,21 @@ impl core::ops::Deref for PlainDateTime {}impl PlainDateTime {- fn new(vm: &Vm, iso_date_time: ISODateTime, calendar: Utf16String, prototype: Gc<Object>) -> PlainDateTime {+ fn new(+ vm: &Vm,+ realm: Gc<Realm>,+ iso_date_time: ISODateTime,+ calendar: Utf16String,+ prototype: Gc<Object>,+ ) -> PlainDateTime {PlainDateTime {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),iso_date_time,calendar,}@@ -387,7 +400,7 @@ pub fn create_temporal_date_time(realm,new_target,Intrinsics::temporal_plain_date_time_prototype,- |_, prototype| PlainDateTime::new(vm, iso_date_time, calendar, prototype),+ |_, prototype| PlainDateTime::new(vm, realm, iso_date_time, calendar, prototype),)?;// 6. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_constructor.rsindex 2f6b03839c1..d8912c14a69 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_constructor.rs@@ -46,11 +46,12 @@ define_native_function_class!(impl PlainDateTimeConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PlainDateTimeConstructor> {realm.create_object(vm, |_| PlainDateTimeConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.PlainDateTime.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.PlainDateTime.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_prototype.rsindex f32ec8d464e..f0375c11b06 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_date_time_prototype.rs@@ -88,7 +88,8 @@ impl PlainDateTimePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day.rsindex c8215390a00..f744c8da008 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day.rs@@ -21,6 +21,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{DateType, Overflow, ShowCalendar, ascii_view, get_temporal_overflow_option, iso_date_to_fields, parse_iso_date_time,};@@ -54,9 +55,21 @@ impl core::ops::Deref for PlainMonthDay {}impl PlainMonthDay {- fn new(vm: &Vm, iso_date: ISODate, calendar: Utf16String, prototype: Gc<Object>) -> PlainMonthDay {+ fn new(+ vm: &Vm,+ realm: Gc<Realm>,+ iso_date: ISODate,+ calendar: Utf16String,+ prototype: Gc<Object>,+ ) -> PlainMonthDay {PlainMonthDay {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),iso_date,calendar,}@@ -220,7 +233,7 @@ pub fn create_temporal_month_day(realm,new_target,Intrinsics::temporal_plain_month_day_prototype,- |_, prototype| PlainMonthDay::new(vm, iso_date, calendar, prototype),+ |_, prototype| PlainMonthDay::new(vm, realm, iso_date, calendar, prototype),)?;// 6. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_constructor.rsindex a04c68dd4ab..bdf9c0af9f3 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_constructor.rs@@ -44,11 +44,12 @@ define_native_function_class!(impl PlainMonthDayConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PlainMonthDayConstructor> {realm.create_object(vm, |_| PlainMonthDayConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.PlainMonthDay.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.PlainMonthDay.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_prototype.rsindex 20231f1fb9b..6004c1a48c2 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_month_day_prototype.rs@@ -67,7 +67,8 @@ impl PlainMonthDayPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_time.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_time.rsindex 924287faadc..0580562310d 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_time.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_time.rs@@ -25,6 +25,7 @@ use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;use crate::runtime::property_key::PropertyKey;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, DurationOperation, Overflow, SecondsPrecision, Unit, UnitGroup, format_time_string,get_difference_settings, get_temporal_overflow_option, parse_iso_date_time, round_number_to_increment,@@ -66,9 +67,15 @@ impl core::ops::Deref for PlainTime {}impl PlainTime {- fn new(vm: &Vm, time: Time, prototype: Gc<Object>) -> PlainTime {+ fn new(vm: &Vm, realm: Gc<Realm>, time: Time, prototype: Gc<Object>) -> PlainTime {PlainTime {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),time,}}@@ -532,7 +539,7 @@ pub fn create_temporal_time(realm,new_target,Intrinsics::temporal_plain_time_prototype,- |_, prototype| PlainTime::new(vm, time, prototype),+ |_, prototype| PlainTime::new(vm, realm, time, prototype),)?;// 4. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_constructor.rsindex 2efe901e203..afdff214f48 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_constructor.rs@@ -42,11 +42,12 @@ define_native_function_class!(impl PlainTimeConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PlainTimeConstructor> {realm.create_object(vm, |_| PlainTimeConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.PlainTime.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.PlainTime.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_prototype.rsindex 17bb16613a9..d7f9379c7d9 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_time_prototype.rs@@ -67,7 +67,8 @@ impl PlainTimePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month.rsindex dd139b4fe99..97f18b08bbd 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month.rs@@ -23,6 +23,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, DateType, DurationOperation, Overflow, ShowCalendar, Unit, UnitGroup, ascii_view,get_difference_settings, get_temporal_overflow_option, iso_date_to_fields, parse_iso_date_time,@@ -65,9 +66,21 @@ impl core::ops::Deref for PlainYearMonth {}impl PlainYearMonth {- fn new(vm: &Vm, iso_date: ISODate, calendar: Utf16String, prototype: Gc<Object>) -> PlainYearMonth {+ fn new(+ vm: &Vm,+ realm: Gc<Realm>,+ iso_date: ISODate,+ calendar: Utf16String,+ prototype: Gc<Object>,+ ) -> PlainYearMonth {PlainYearMonth {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),iso_date,calendar,}@@ -242,7 +255,7 @@ pub fn create_temporal_year_month(realm,new_target,Intrinsics::temporal_plain_year_month_prototype,- |_, prototype| PlainYearMonth::new(vm, iso_date, calendar, prototype),+ |_, prototype| PlainYearMonth::new(vm, realm, iso_date, calendar, prototype),)?;// 6. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_constructor.rsindex 3b34e40a4a3..e384d5b847a 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_constructor.rs@@ -44,11 +44,12 @@ define_native_function_class!(impl PlainYearMonthConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<PlainYearMonthConstructor> {realm.create_object(vm, |_| PlainYearMonthConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.PlainYearMonth.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.PlainYearMonth.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_prototype.rsindex b798bcc0f00..f74a67309db 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/plain_year_month_prototype.rs@@ -80,7 +80,8 @@ impl PlainYearMonthPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/temporal.rs b/Libraries/LibJS/Rust/src/runtime/temporal/temporal.rsindex e6d4a82466a..e274c942523 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/temporal.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/temporal.rs@@ -38,7 +38,8 @@ impl Temporal {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time.rs b/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time.rsindex e74c2b756f9..8438f5017a4 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time.rs@@ -25,6 +25,7 @@ use crate::runtime::error::ErrorKind;use crate::runtime::error_types::ErrorType;use crate::runtime::intrinsics::Intrinsics;use crate::runtime::object::MayInterfereWithIndexedPropertyAccess;+use crate::runtime::realm::Realm;use crate::runtime::temporal::abstract_operations::{ArithmeticOperation, Disambiguation, DurationOperation, OffsetOption, Overflow, SecondsPrecision, ShowCalendar,ShowOffset, ShowTimeZoneName, Unit, UnitCategory, UnitGroup, ascii_view, check_iso_days_range,@@ -84,13 +85,20 @@ impl core::ops::Deref for ZonedDateTime {impl ZonedDateTime {fn new(vm: &Vm,+ realm: Gc<Realm>,epoch_nanoseconds: Gc<BigInt>,time_zone: Utf16String,calendar: Utf16String,prototype: Gc<Object>,) -> ZonedDateTime {ZonedDateTime {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),epoch_nanoseconds,time_zone,calendar,@@ -514,7 +522,7 @@ pub fn create_temporal_zoned_date_time(realm,new_target,Intrinsics::temporal_zoned_date_time_prototype,- |_, prototype| ZonedDateTime::new(vm, epoch_nanoseconds, time_zone, calendar, prototype),+ |_, prototype| ZonedDateTime::new(vm, realm, epoch_nanoseconds, time_zone, calendar, prototype),)?;// 7. Return object.diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_constructor.rs b/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_constructor.rsindex de7331314c3..7d6243efbaa 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_constructor.rs@@ -47,11 +47,12 @@ define_native_function_class!(impl ZonedDateTimeConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<ZonedDateTimeConstructor> {realm.create_object(vm, |_| ZonedDateTimeConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.ZonedDateTime.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.ZonedDateTime.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_prototype.rs b/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_prototype.rsindex ba5b341112f..a11b12b7170 100644--- a/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/temporal/zoned_date_time_prototype.rs@@ -111,7 +111,8 @@ impl ZonedDateTimePrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/typed_array.rs b/Libraries/LibJS/Rust/src/runtime/typed_array.rsindex 67b740cb0bc..6c6137854bb 100644--- a/Libraries/LibJS/Rust/src/runtime/typed_array.rs+++ b/Libraries/LibJS/Rust/src/runtime/typed_array.rs@@ -177,6 +177,7 @@ impl TypedArrayBase {/// the class of the typed array of `kind`.fn new(vm: &Vm,+ realm: Gc<Realm>,class: &'static Class,prototype: Gc<Object>,array_length: usize,@@ -184,7 +185,13 @@ impl TypedArrayBase {kind: Kind,) -> TypedArrayBase {let element_size = kind.element_type().size() as u8;- let object = Object::new_with_prototype(vm, class, prototype, MayInterfereWithIndexedPropertyAccess::Yes);+ let object = Object::new_with_prototype(+ vm,+ class,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::Yes,+ );object.set_is_typed_array();let typed_array = TypedArrayBase {base: object,@@ -1666,7 +1673,7 @@ macro_rules! define_typed_arrays {let typed_array = realm.create_object(vm,|_| $class {- base: TypedArrayBase::new(vm, Self::CLASS, prototype, length, array_buffer, Kind::$class),+ base: TypedArrayBase::new(vm, realm, Self::CLASS, prototype, length, array_buffer, Kind::$class),},);typed_array.update_cached_data_offset(vm);@@ -1692,7 +1699,7 @@ macro_rules! define_typed_arrays {let typed_array = realm.create_object(vm,|_| $class {- base: TypedArrayBase::new(vm, Self::CLASS, prototype, length, array_buffer, Kind::$class),+ base: TypedArrayBase::new(vm, realm, Self::CLASS, prototype, length, array_buffer, Kind::$class),},);typed_array.update_cached_data_offset(vm);@@ -1716,12 +1723,7 @@ macro_rules! define_typed_arrays {realm.create_object(vm,|_| $prototype {- base: Object::new_with_prototype(- vm,- Self::CLASS,- typed_array_prototype,- MayInterfereWithIndexedPropertyAccess::Yes,- ),+ base: Object::new_with_prototype(vm, Self::CLASS, realm, Some(typed_array_prototype), MayInterfereWithIndexedPropertyAccess::Yes),},)}@@ -1758,12 +1760,7 @@ macro_rules! define_typed_arrays {realm.create_object(vm,|_| $constructor {- base: NativeFunction::new_with_name(- vm,- Self::CLASS,- vm.names.$class.as_string().clone(),- typed_array_constructor,- ),+ base: NativeFunction::new_with_prototype(vm, Self::CLASS, realm, typed_array_constructor, Some(vm.names.$class.as_string().clone())),},)}diff --git a/Libraries/LibJS/Rust/src/runtime/typed_array_constructor.rs b/Libraries/LibJS/Rust/src/runtime/typed_array_constructor.rsindex abe61d0b066..dfbcc7e2d6f 100644--- a/Libraries/LibJS/Rust/src/runtime/typed_array_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/typed_array_constructor.rs@@ -43,11 +43,12 @@ define_native_function_class!(impl TypedArrayConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<TypedArrayConstructor> {realm.create_object(vm, |_| TypedArrayConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.TypedArray.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.TypedArray.as_string().clone()),),})}diff --git a/Libraries/LibJS/Rust/src/runtime/typed_array_prototype.rs b/Libraries/LibJS/Rust/src/runtime/typed_array_prototype.rsindex e6c64eae440..7d75b7ab71a 100644--- a/Libraries/LibJS/Rust/src/runtime/typed_array_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/typed_array_prototype.rs@@ -555,7 +555,8 @@ impl TypedArrayPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/weak_map.rs b/Libraries/LibJS/Rust/src/runtime/weak_map.rsindex f0f3fcdc685..6dd92577342 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_map.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_map.rs@@ -81,16 +81,22 @@ impl Finalize for WeakMap {}impl WeakMap {- pub fn new(_: &DeferGc<'_>, vm: &Vm, prototype: Gc<Object>) -> WeakMap {+ pub fn new(_: &DeferGc<'_>, vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> WeakMap {WeakMap {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),values: GcRefCell::new(WeakMapValues::default()),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<WeakMap> {realm.create_object(vm, |defer_gc| {- WeakMap::new(defer_gc, vm, realm.intrinsics().weak_map_prototype(vm))+ WeakMap::new(defer_gc, vm, realm, realm.intrinsics().weak_map_prototype(vm))})}diff --git a/Libraries/LibJS/Rust/src/runtime/weak_map_constructor.rs b/Libraries/LibJS/Rust/src/runtime/weak_map_constructor.rsindex df7486de097..909af297b80 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_map_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_map_constructor.rs@@ -41,11 +41,12 @@ define_native_function_class!(impl WeakMapConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<WeakMapConstructor> {realm.create_object(vm, |_| WeakMapConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.WeakMap.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.WeakMap.as_string().clone()),),})}@@ -85,7 +86,7 @@ impl WeakMapConstructor {realm,new_target,Intrinsics::weak_map_prototype,- |defer_gc, prototype| WeakMap::new(defer_gc, vm, prototype),+ |defer_gc, prototype| WeakMap::new(defer_gc, vm, realm, prototype),)?;// 4. If iterable is either undefined or null, return map.diff --git a/Libraries/LibJS/Rust/src/runtime/weak_map_prototype.rs b/Libraries/LibJS/Rust/src/runtime/weak_map_prototype.rsindex 103ce161fb0..595e51c7980 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_map_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_map_prototype.rs@@ -46,7 +46,8 @@ impl WeakMapPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/weak_ref.rs b/Libraries/LibJS/Rust/src/runtime/weak_ref.rsindex 005195f4c0a..b6178500ea6 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_ref.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_ref.rs@@ -50,10 +50,16 @@ define_object_class!(WeakRef, extends: [Object], methods: {impl WeakRef {/// A WeakRef to `value`, an object or a symbol.- pub fn new(vm: &Vm, value: Value, prototype: Gc<Object>) -> WeakRef {+ pub fn new(vm: &Vm, realm: Gc<Realm>, value: Value, prototype: Gc<Object>) -> WeakRef {assert!(value.is_object() || value.is_symbol());WeakRef {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),value: Cell::new(value),last_execution_generation: Cell::new(vm.head.execution_generation.get()),vm_execution_generation: NonNull::from(&vm.head.execution_generation),@@ -62,7 +68,7 @@ impl WeakRef {pub fn create(vm: &Vm, realm: Gc<Realm>, value: Value) -> Gc<WeakRef> {realm.create_object(vm, |_| {- WeakRef::new(vm, value, realm.intrinsics().weak_ref_prototype(vm))+ WeakRef::new(vm, realm, value, realm.intrinsics().weak_ref_prototype(vm))})}diff --git a/Libraries/LibJS/Rust/src/runtime/weak_ref_constructor.rs b/Libraries/LibJS/Rust/src/runtime/weak_ref_constructor.rsindex 39ab316f202..73b78a0fa90 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_ref_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_ref_constructor.rs@@ -38,11 +38,12 @@ define_native_function_class!(impl WeakRefConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<WeakRefConstructor> {realm.create_object(vm, |_| WeakRefConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.WeakRef.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.WeakRef.as_string().clone()),),})}@@ -89,7 +90,7 @@ impl WeakRefConstructor {realm,new_target,Intrinsics::weak_ref_prototype,- |_, prototype| WeakRef::new(vm, target, prototype),+ |_, prototype| WeakRef::new(vm, realm, target, prototype),)?;Ok(weak_ref.upcast())}diff --git a/Libraries/LibJS/Rust/src/runtime/weak_ref_prototype.rs b/Libraries/LibJS/Rust/src/runtime/weak_ref_prototype.rsindex e262afba0b4..f46d8a5c8ed 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_ref_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_ref_prototype.rs@@ -39,7 +39,8 @@ impl WeakRefPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/weak_set.rs b/Libraries/LibJS/Rust/src/runtime/weak_set.rsindex 2ad0af72643..6aad72a3662 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_set.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_set.rs@@ -75,16 +75,22 @@ impl Finalize for WeakSet {}impl WeakSet {- pub fn new(_: &DeferGc<'_>, vm: &Vm, prototype: Gc<Object>) -> WeakSet {+ pub fn new(_: &DeferGc<'_>, vm: &Vm, realm: Gc<Realm>, prototype: Gc<Object>) -> WeakSet {WeakSet {- base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),+ base: Object::new_with_prototype(+ vm,+ Self::CLASS,+ realm,+ Some(prototype),+ MayInterfereWithIndexedPropertyAccess::No,+ ),values: GcRefCell::new(WeakSetValues::default()),}}pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<WeakSet> {realm.create_object(vm, |defer_gc| {- WeakSet::new(defer_gc, vm, realm.intrinsics().weak_set_prototype(vm))+ WeakSet::new(defer_gc, vm, realm, realm.intrinsics().weak_set_prototype(vm))})}diff --git a/Libraries/LibJS/Rust/src/runtime/weak_set_constructor.rs b/Libraries/LibJS/Rust/src/runtime/weak_set_constructor.rsindex baeba68e97e..a7390719d3f 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_set_constructor.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_set_constructor.rs@@ -39,11 +39,12 @@ define_native_function_class!(impl WeakSetConstructor {pub fn create(vm: &Vm, realm: Gc<Realm>) -> Gc<WeakSetConstructor> {realm.create_object(vm, |_| WeakSetConstructor {- base: NativeFunction::new_with_name(+ base: NativeFunction::new_with_prototype(vm,Self::CLASS,- vm.names.WeakSet.as_string().clone(),+ realm,realm.function_prototype(),+ Some(vm.names.WeakSet.as_string().clone()),),})}@@ -83,7 +84,7 @@ impl WeakSetConstructor {realm,new_target,Intrinsics::weak_set_prototype,- |defer_gc, prototype| WeakSet::new(defer_gc, vm, prototype),+ |defer_gc, prototype| WeakSet::new(defer_gc, vm, realm, prototype),)?;// 4. If iterable is either undefined or null, return set.diff --git a/Libraries/LibJS/Rust/src/runtime/weak_set_prototype.rs b/Libraries/LibJS/Rust/src/runtime/weak_set_prototype.rsindex 6a5c610ba63..5ab9a66d379 100644--- a/Libraries/LibJS/Rust/src/runtime/weak_set_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/weak_set_prototype.rs@@ -46,7 +46,8 @@ impl WeakSetPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.object_prototype(),+ realm,+ Some(realm.object_prototype()),MayInterfereWithIndexedPropertyAccess::No,),})diff --git a/Libraries/LibJS/Rust/src/runtime/wrap_for_valid_iterator_prototype.rs b/Libraries/LibJS/Rust/src/runtime/wrap_for_valid_iterator_prototype.rsindex 9872bd613ea..f9193bc1fc8 100644--- a/Libraries/LibJS/Rust/src/runtime/wrap_for_valid_iterator_prototype.rs+++ b/Libraries/LibJS/Rust/src/runtime/wrap_for_valid_iterator_prototype.rs@@ -41,7 +41,8 @@ impl WrapForValidIteratorPrototype {base: Object::new_with_prototype(vm,Self::CLASS,- realm.intrinsics().iterator_prototype(vm),+ realm,+ Some(realm.intrinsics().iterator_prototype(vm)),MayInterfereWithIndexedPropertyAccess::No,),})