mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Create source actors from Debugger API notifications
Co-authored-by: atbrakhi <atbrakhi@igalia.com> Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
e2eabd41c9
commit
048d0b0538
13 changed files with 193 additions and 64 deletions
|
@ -15,7 +15,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventM
|
|||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||
use crate::dom::event::Event;
|
||||
use crate::dom::types::GlobalScope;
|
||||
use crate::dom::types::{GlobalScope, PipelineId};
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -23,20 +23,24 @@ use crate::script_runtime::CanGc;
|
|||
pub(crate) struct DebuggerEvent {
|
||||
event: Event,
|
||||
global: MutNullableDom<GlobalScope>,
|
||||
pipeline_id: MutNullableDom<PipelineId>,
|
||||
}
|
||||
|
||||
impl DebuggerEvent {
|
||||
pub(crate) fn new(
|
||||
debugger_global: &GlobalScope,
|
||||
global: &GlobalScope,
|
||||
pipeline_id: &PipelineId,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
let result = Box::new(Self {
|
||||
event: Event::new_inherited(),
|
||||
global: Default::default(),
|
||||
pipeline_id: Default::default(),
|
||||
});
|
||||
// TODO: make these fields not optional somehow?
|
||||
result.global.set(Some(global));
|
||||
result.pipeline_id.set(Some(pipeline_id));
|
||||
|
||||
result.event.init_event("addDebuggee".into(), false, false);
|
||||
|
||||
|
@ -58,6 +62,12 @@ impl DebuggerEventMethods<crate::DomTypeHolder> for DebuggerEvent {
|
|||
NonNull::new(result.to_object()).unwrap()
|
||||
}
|
||||
|
||||
fn PipelineId(
|
||||
&self,
|
||||
) -> DomRoot<<crate::DomTypeHolder as script_bindings::DomTypes>::PipelineId> {
|
||||
self.pipeline_id.get().expect("Guaranteed by new")
|
||||
}
|
||||
|
||||
fn IsTrusted(&self) -> bool {
|
||||
self.event.IsTrusted()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue