diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js b/devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js new file mode 100644 index 000000000..46198d31c --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_worker-window.js @@ -0,0 +1,61 @@ +// Check to make sure that a worker can be attached to a toolbox +// directly, and that the toolbox has expected properties. + +"use strict"; + +// Whitelisting this test. +// As part of bug 1077403, the leaking uncaught rejections should be fixed. +thisTestLeaksUncaughtRejectionsAndShouldBeFixed("[object Object]"); + +var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html"; +var WORKER_URL = "code_WorkerActor.attachThread-worker.js"; + +add_task(function* () { + yield pushPrefs(["devtools.scratchpad.enabled", true]); + + DebuggerServer.init(); + DebuggerServer.addBrowserActors(); + + let client = new DebuggerClient(DebuggerServer.connectPipe()); + yield connect(client); + + let tab = yield addTab(TAB_URL); + let { tabs } = yield listTabs(client); + let [, tabClient] = yield attachTab(client, findTab(tabs, TAB_URL)); + + yield listWorkers(tabClient); + yield createWorkerInTab(tab, WORKER_URL); + + let { workers } = yield listWorkers(tabClient); + let [, workerClient] = yield attachWorker(tabClient, + findWorker(workers, WORKER_URL)); + + let toolbox = yield gDevTools.showToolbox(TargetFactory.forWorker(workerClient), + "jsdebugger", + Toolbox.HostType.WINDOW); + + is(toolbox.hostType, "window", "correct host"); + + yield new Promise(done => { + toolbox.win.parent.addEventListener("message", function onmessage(event) { + if (event.data.name == "set-host-title") { + toolbox.win.parent.removeEventListener("message", onmessage); + done(); + } + }); + }); + ok(toolbox.win.parent.document.title.includes(WORKER_URL), + "worker URL in host title"); + + let toolTabs = toolbox.doc.querySelectorAll(".devtools-tab"); + let activeTools = [...toolTabs].map(tab=>tab.getAttribute("toolid")); + + is(activeTools.join(","), "webconsole,jsdebugger,scratchpad,options", + "Correct set of tools supported by worker"); + + terminateWorkerInTab(tab, WORKER_URL); + yield waitForWorkerClose(workerClient); + yield close(client); + + yield toolbox.destroy(); +}); |