Add new Window globals as debuggees

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
Delan Azabani 2025-07-18 21:51:13 +08:00
parent c59ee57b5d
commit e2eabd41c9
7 changed files with 107 additions and 1 deletions

View file

@ -24,7 +24,9 @@ use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::trace::CustomTraceable;
use crate::dom::bindings::utils::define_all_exposed_interfaces;
use crate::dom::event::EventStatus;
use crate::dom::globalscope::GlobalScope;
use crate::dom::types::{DebuggerEvent, Event};
#[cfg(feature = "testbinding")]
#[cfg(feature = "webgpu")]
use crate::dom::webgpu::identityhub::IdentityHub;
@ -119,4 +121,14 @@ impl DebuggerGlobalScope {
report_pending_exception(Self::get_cx(), true, InRealm::Entered(&ar), can_gc);
}
}
#[allow(unsafe_code)]
pub(crate) fn fire_add_debuggee(&self, can_gc: CanGc, global: &GlobalScope) {
let event = DomRoot::upcast::<Event>(DebuggerEvent::new(self.upcast(), global, can_gc));
assert_eq!(
event.fire(self.upcast(), can_gc),
EventStatus::NotCanceled,
"Guaranteed by DebuggerEvent::new"
);
}
}