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

@ -1939,7 +1939,7 @@ impl ScriptThread {
},
FromConstellation(ConstellationControlMsg::ExitFullScreen(id)) => self
.profile_event(ScriptThreadEventCategory::ExitFullscreen, Some(id), || {
self.handle_exit_fullscreen(id);
self.handle_exit_fullscreen(id, can_gc);
}),
_ => {
sequential.push(event);
@ -2914,11 +2914,11 @@ impl ScriptThread {
}
// exit_fullscreen creates a new JS promise object, so we need to have entered a realm
fn handle_exit_fullscreen(&self, id: PipelineId) {
fn handle_exit_fullscreen(&self, id: PipelineId, can_gc: CanGc) {
let document = self.documents.borrow().find_document(id);
if let Some(document) = document {
let _ac = enter_realm(&*document);
document.exit_fullscreen();
document.exit_fullscreen(can_gc);
}
}