mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Co-authored-by: atbrakhi <atbrakhi@igalia.com> Signed-off-by: Delan Azabani <dazabani@igalia.com>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
if (!("dbg" in this)) {
|
|
dbg = new Debugger;
|
|
debuggeesToPipelineIds = new Map;
|
|
|
|
dbg.onNewGlobalObject = function(global) {
|
|
console.log("[debugger] onNewGlobalObject", this, global);
|
|
};
|
|
|
|
dbg.onNewScript = function(script, /* undefined; seems to be `script.global` now */ global) {
|
|
try {
|
|
console.log("[debugger] onNewScript url=", script.url, "source id=", script.source.id, "introductionType=", script.source.introductionType);
|
|
try {
|
|
console.log("[debugger] source binary=", typeof script.source.binary);
|
|
} catch (error) {
|
|
// Do nothing; the source is not wasm
|
|
}
|
|
notifyNewSource({
|
|
pipelineId: debuggeesToPipelineIds.get(script.global),
|
|
spidermonkeyId: script.source.id,
|
|
url: script.source.url,
|
|
text: script.source.text,
|
|
isInline: script.source.introductionType == "inlineScript",
|
|
});
|
|
} catch (error) {
|
|
logError(error);
|
|
}
|
|
};
|
|
}
|
|
|
|
addEventListener("addDebuggee", event => {
|
|
const {global, pipelineId: {namespaceId, index}} = event;
|
|
console.log("[debugger] Adding debuggee");
|
|
dbg.addDebuggee(global);
|
|
const debuggerObject = dbg.addDebuggee(global);
|
|
debuggeesToPipelineIds.set(debuggerObject, {
|
|
namespaceId,
|
|
index,
|
|
});
|
|
});
|