Mark promise creation methods with CanGc (#33928)

* Add CanGc annotations to promise constructor.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc arguments for Promise::new_in_current_realm.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix out-of-order entries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc from Promise::new.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Suppress clippy warning.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-10-22 05:35:20 -04:00 committed by GitHub
parent edc304854f
commit 575e885529
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 422 additions and 221 deletions

View file

@ -3894,10 +3894,10 @@ impl Document {
}
// https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen
pub fn enter_fullscreen(&self, pending: &Element) -> Rc<Promise> {
pub fn enter_fullscreen(&self, pending: &Element, can_gc: CanGc) -> Rc<Promise> {
// Step 1
let in_realm_proof = AlreadyInRealm::assert();
let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof));
let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof), can_gc);
let mut error = false;
// Step 4
@ -3961,11 +3961,11 @@ impl Document {
}
// https://fullscreen.spec.whatwg.org/#exit-fullscreen
pub fn exit_fullscreen(&self) -> Rc<Promise> {
pub fn exit_fullscreen(&self, can_gc: CanGc) -> Rc<Promise> {
let global = self.global();
// Step 1
let in_realm_proof = AlreadyInRealm::assert();
let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof));
let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof), can_gc);
// Step 2
if self.fullscreen_element.get().is_none() {
promise.reject_error(Error::Type(String::from("fullscreen is null")));
@ -5557,8 +5557,8 @@ impl DocumentMethods for Document {
}
// https://fullscreen.spec.whatwg.org/#dom-document-exitfullscreen
fn ExitFullscreen(&self) -> Rc<Promise> {
self.exit_fullscreen()
fn ExitFullscreen(&self, can_gc: CanGc) -> Rc<Promise> {
self.exit_fullscreen(can_gc)
}
// check-tidy: no specs after this line