mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
GetPossibleBreakpointsEvent
Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
95d70c0b20
commit
0b5a8fa693
8 changed files with 73 additions and 14 deletions
|
@ -10,7 +10,7 @@ use script_bindings::conversions::SafeToJSValConvertible;
|
|||
use script_bindings::reflector::DomObject;
|
||||
use script_bindings::str::DOMString;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::DebuggerEventBinding::DebuggerEventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::AddDebuggeeEventBinding::AddDebuggeeEventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
|
@ -20,14 +20,14 @@ use crate::script_runtime::CanGc;
|
|||
|
||||
#[dom_struct]
|
||||
/// Event for Rust → JS calls in [`crate::dom::DebuggerGlobalScope`].
|
||||
pub(crate) struct DebuggerEvent {
|
||||
pub(crate) struct AddDebuggeeEvent {
|
||||
event: Event,
|
||||
global: Dom<GlobalScope>,
|
||||
pipeline_id: Dom<PipelineId>,
|
||||
worker_id: Option<DOMString>,
|
||||
}
|
||||
|
||||
impl DebuggerEvent {
|
||||
impl AddDebuggeeEvent {
|
||||
pub(crate) fn new(
|
||||
debugger_global: &GlobalScope,
|
||||
global: &GlobalScope,
|
||||
|
@ -48,7 +48,7 @@ impl DebuggerEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl DebuggerEventMethods<crate::DomTypeHolder> for DebuggerEvent {
|
||||
impl AddDebuggeeEventMethods<crate::DomTypeHolder> for AddDebuggeeEvent {
|
||||
// check-tidy: no specs after this line
|
||||
fn Global(&self, cx: script_bindings::script_runtime::JSContext) -> NonNull<JSObject> {
|
||||
// Convert the debuggee global’s reflector to a Value, wrapping it from its originating realm (debuggee realm)
|
|
@ -26,7 +26,7 @@ use crate::dom::bindings::inheritance::Castable;
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::utils::define_all_exposed_interfaces;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::types::{DebuggerEvent, Event};
|
||||
use crate::dom::types::{AddDebuggeeEvent, Event};
|
||||
#[cfg(feature = "testbinding")]
|
||||
#[cfg(feature = "webgpu")]
|
||||
use crate::dom::webgpu::identityhub::IdentityHub;
|
||||
|
@ -139,7 +139,7 @@ impl DebuggerGlobalScope {
|
|||
) {
|
||||
let debuggee_pipeline_id =
|
||||
crate::dom::pipelineid::PipelineId::new(self.upcast(), debuggee_pipeline_id, can_gc);
|
||||
let event = DomRoot::upcast::<Event>(DebuggerEvent::new(
|
||||
let event = DomRoot::upcast::<Event>(AddDebuggeeEvent::new(
|
||||
self.upcast(),
|
||||
debuggee_global,
|
||||
&debuggee_pipeline_id,
|
||||
|
@ -148,7 +148,7 @@ impl DebuggerGlobalScope {
|
|||
));
|
||||
assert!(
|
||||
DomRoot::upcast::<Event>(event).fire(self.upcast(), can_gc),
|
||||
"Guaranteed by DebuggerEvent::new"
|
||||
"Guaranteed by AddDebuggeeEvent::new"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
48
components/script/dom/getpossiblebreakpointsevent.rs
Normal file
48
components/script/dom/getpossiblebreakpointsevent.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::GetPossibleBreakpointsEventBinding::GetPossibleBreakpointsEventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::event::Event;
|
||||
use crate::dom::types::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
/// Event for Rust → JS calls in [`crate::dom::DebuggerGlobalScope`].
|
||||
pub(crate) struct GetPossibleBreakpointsEvent {
|
||||
event: Event,
|
||||
spidermonkey_id: u32,
|
||||
}
|
||||
|
||||
impl GetPossibleBreakpointsEvent {
|
||||
pub(crate) fn new(
|
||||
debugger_global: &GlobalScope,
|
||||
spidermonkey_id: u32,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
let result = Box::new(Self {
|
||||
event: Event::new_inherited(),
|
||||
spidermonkey_id,
|
||||
});
|
||||
let result = reflect_dom_object(result, debugger_global, can_gc);
|
||||
result.event.init_event("getPossibleBreakpoints".into(), false, false);
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
impl GetPossibleBreakpointsEventMethods<crate::DomTypeHolder> for GetPossibleBreakpointsEvent {
|
||||
// check-tidy: no specs after this line
|
||||
fn SpidermonkeyId(&self) -> u32 {
|
||||
self.spidermonkey_id
|
||||
}
|
||||
|
||||
fn IsTrusted(&self) -> bool {
|
||||
self.event.IsTrusted()
|
||||
}
|
||||
}
|
|
@ -217,6 +217,7 @@ pub(crate) mod abstractrange;
|
|||
pub(crate) mod abstractworker;
|
||||
pub(crate) mod abstractworkerglobalscope;
|
||||
pub(crate) mod activation;
|
||||
pub(crate) mod adddebuggeeevent;
|
||||
pub(crate) mod analysernode;
|
||||
pub(crate) mod animationevent;
|
||||
pub(crate) mod attr;
|
||||
|
@ -289,7 +290,6 @@ pub(crate) mod customevent;
|
|||
pub(crate) mod datatransfer;
|
||||
pub(crate) mod datatransferitem;
|
||||
pub(crate) mod datatransferitemlist;
|
||||
pub(crate) mod debuggerevent;
|
||||
pub(crate) mod debuggerglobalscope;
|
||||
pub(crate) mod dedicatedworkerglobalscope;
|
||||
pub(crate) mod defaultteereadrequest;
|
||||
|
@ -341,6 +341,7 @@ pub(crate) mod gamepadbuttonlist;
|
|||
pub(crate) mod gamepadevent;
|
||||
pub(crate) mod gamepadhapticactuator;
|
||||
pub(crate) mod gamepadpose;
|
||||
pub(crate) mod getpossiblebreakpointsevent;
|
||||
#[allow(dead_code)]
|
||||
pub(crate) mod globalscope;
|
||||
pub(crate) mod hashchangeevent;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::DebuggerEventBinding::PipelineIdMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::AddDebuggeeEventBinding::PipelineIdMethods;
|
||||
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// This interface is entirely internal to Servo, and should not be accessible to
|
||||
// web pages.
|
||||
[Exposed=DebuggerGlobalScope]
|
||||
interface DebuggerEvent : Event {
|
||||
interface AddDebuggeeEvent : Event {
|
||||
readonly attribute object global;
|
||||
readonly attribute PipelineId pipelineId;
|
||||
readonly attribute DOMString? workerId;
|
|
@ -0,0 +1,10 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This interface is entirely internal to Servo, and should not be accessible to
|
||||
// web pages.
|
||||
[Exposed=DebuggerGlobalScope]
|
||||
interface GetPossibleBreakpointsEvent : Event {
|
||||
readonly attribute unsigned long spidermonkeyId;
|
||||
};
|
|
@ -5,6 +5,7 @@ if ("dbg" in this) {
|
|||
const dbg = new Debugger;
|
||||
const debuggeesToPipelineIds = new Map;
|
||||
const debuggeesToWorkerIds = new Map;
|
||||
const sourceIdsToScripts = new Map;
|
||||
|
||||
dbg.uncaughtExceptionHook = function(error) {
|
||||
console.error(`[debugger] Uncaught exception at ${error.fileName}:${error.lineNumber}:${error.columnNumber}: ${error.name}: ${error.message}`);
|
||||
|
@ -12,11 +13,10 @@ dbg.uncaughtExceptionHook = function(error) {
|
|||
|
||||
dbg.onNewScript = function(script, /* undefined; seems to be `script.global` now */ global) {
|
||||
console.log("[debugger] onNewScript url=", script.url, "source id=", script.source.id, "introductionType=", script.source.introductionType, "displayURL=", script.source.displayURL);
|
||||
try {
|
||||
console.log("[debugger] source binary=", typeof script.source.binary);
|
||||
} catch (error) {
|
||||
// Do nothing; the source is not wasm
|
||||
if (script.source.introductionType == "wasm") {
|
||||
console.log("[debugger] source binary=", script.source.binary);
|
||||
}
|
||||
sourceIdsToScripts.set(script.source.id, script);
|
||||
notifyNewSource({
|
||||
pipelineId: debuggeesToPipelineIds.get(script.global),
|
||||
workerId: debuggeesToWorkerIds.get(script.global),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue