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, }); });