Skip to content

Truly independent web browser

LibJS: Create disposable stacks with a new dispose capability

Shannon Booth82635a8108a7
diff --git a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs
index 91a04430260..55c37a6b068 100644
--- a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs
+++ b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack.rs
@@ -48,11 +48,12 @@ impl Finalize for AsyncDisposableStack {
}
impl AsyncDisposableStack {
- pub fn new(vm: &Vm, dispose_capability: DisposeCapability, prototype: Gc<Object>) -> AsyncDisposableStack {
+ /// A pending stack with a new dispose capability.
+ pub fn new(vm: &Vm, prototype: Gc<Object>) -> AsyncDisposableStack {
AsyncDisposableStack {
base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),
async_disposable_state: Cell::new(AsyncDisposableState::Pending),
- dispose_capability: GcRefCell::new(dispose_capability),
+ 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.rs
index 2dcf9b89a03..ef7dbd64b82 100644
--- a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_constructor.rs
+++ b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_constructor.rs
@@ -11,7 +11,7 @@ use crate::interpreter::vm::Vm;
use crate::layout::cell::Gc;
use crate::layout::object::Object;
use crate::layout::value::Value;
-use crate::runtime::abstract_operations::{new_dispose_capability, ordinary_create_from_constructor_of};
+use crate::runtime::abstract_operations::ordinary_create_from_constructor_of;
use crate::runtime::async_disposable_stack::AsyncDisposableStack;
use crate::runtime::completion::ThrowCompletionOr;
use crate::runtime::error::ErrorKind;
@@ -90,7 +90,7 @@ impl AsyncDisposableStackConstructor {
realm,
new_target,
Intrinsics::async_disposable_stack_prototype,
- |prototype| AsyncDisposableStack::new(vm, new_dispose_capability(), prototype),
+ |prototype| AsyncDisposableStack::new(vm, 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.rs
index 885493a0180..ad8406333dd 100644
--- a/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_prototype.rs
+++ b/Libraries/LibJS/Rust/src/runtime/async_disposable_stack_prototype.rs
@@ -294,7 +294,7 @@ impl AsyncDisposableStackPrototype {
realm,
realm.intrinsics().async_disposable_stack_constructor(vm).upcast(),
Intrinsics::async_disposable_stack_prototype,
- |prototype| AsyncDisposableStack::new(vm, new_dispose_capability(), prototype),
+ |prototype| AsyncDisposableStack::new(vm, prototype),
)?;
// 6. Set newAsyncDisposableStack.[[DisposeCapability]] to asyncDisposableStack.[[DisposeCapability]].
diff --git a/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs b/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs
index 48e67f61fda..af6cdda20d8 100644
--- a/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs
+++ b/Libraries/LibJS/Rust/src/runtime/disposable_stack.rs
@@ -48,11 +48,12 @@ impl Finalize for DisposableStack {
}
impl DisposableStack {
- pub fn new(vm: &Vm, dispose_capability: DisposeCapability, prototype: Gc<Object>) -> DisposableStack {
+ /// A pending stack with a new dispose capability.
+ pub fn new(vm: &Vm, prototype: Gc<Object>) -> DisposableStack {
DisposableStack {
base: Object::new_with_prototype(vm, Self::CLASS, prototype, MayInterfereWithIndexedPropertyAccess::No),
disposable_state: Cell::new(DisposableState::Pending),
- dispose_capability: GcRefCell::new(dispose_capability),
+ 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.rs
index f1b1afd5f85..eff25c6a861 100644
--- a/Libraries/LibJS/Rust/src/runtime/disposable_stack_constructor.rs
+++ b/Libraries/LibJS/Rust/src/runtime/disposable_stack_constructor.rs
@@ -11,7 +11,7 @@ use crate::interpreter::vm::Vm;
use crate::layout::cell::Gc;
use crate::layout::object::Object;
use crate::layout::value::Value;
-use crate::runtime::abstract_operations::{new_dispose_capability, ordinary_create_from_constructor_of};
+use crate::runtime::abstract_operations::ordinary_create_from_constructor_of;
use crate::runtime::completion::ThrowCompletionOr;
use crate::runtime::disposable_stack::DisposableStack;
use crate::runtime::error::ErrorKind;
@@ -90,7 +90,7 @@ impl DisposableStackConstructor {
realm,
new_target,
Intrinsics::disposable_stack_prototype,
- |prototype| DisposableStack::new(vm, new_dispose_capability(), prototype),
+ |prototype| DisposableStack::new(vm, 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.rs
index 3bc3c52980d..5adca7312a2 100644
--- a/Libraries/LibJS/Rust/src/runtime/disposable_stack_prototype.rs
+++ b/Libraries/LibJS/Rust/src/runtime/disposable_stack_prototype.rs
@@ -253,7 +253,7 @@ impl DisposableStackPrototype {
realm,
realm.intrinsics().disposable_stack_constructor(vm).upcast(),
Intrinsics::disposable_stack_prototype,
- |prototype| DisposableStack::new(vm, new_dispose_capability(), prototype),
+ |prototype| DisposableStack::new(vm, prototype),
)?;
// 6. Set newDisposableStack.[[DisposeCapability]] to disposableStack.[[DisposeCapability]].