blob: 073bef5237f1648b93a14573bb56c2b64bbbb4d0 [file] [log] [blame]
window.worker = null;
TestPage.registerInitializer(() => {
if (!InspectorTest.Worker)
InspectorTest.Worker = {};
if (!InspectorTest.Worker.DOMDebugger)
InspectorTest.Worker.DOMDebugger = {};
InspectorTest.Worker.DOMDebugger.createWorkerTarget = function(callback) {
let listener = WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, (event) => {
let {target} = event.data;
if (target.type !== WI.Target.Type.Worker)
return;
WI.targetManager.removeEventListener(WI.TargetManager.Event.TargetAdded, listener);
callback(target);
});
InspectorTest.evaluateInPage(`window.worker = new Worker("resources/worker-dom-debugger.js");`)
.catch((error) => {
InspectorTest.fail(error);
InspectorTest.completeTest();
});
}
});