Bug 1211017 - Show URL as the title in worker toolboxes;r=ejpbruel

This commit is contained in:
Brian Grinstead 2015-10-06 08:04:36 -07:00
parent e370026454
commit 2e32a39a26
4 changed files with 51 additions and 4 deletions

View File

@ -567,6 +567,8 @@ skip-if = e10s && debug
skip-if = e10s && debug
[browser_dbg_watch-expressions-02.js]
skip-if = e10s && debug
[browser_dbg_worker-window.js]
skip-if = e10s && debug
[browser_dbg_WorkerActor.attach.js]
skip-if = e10s && debug
[browser_dbg_WorkerActor.attachThread.js]

View File

@ -0,0 +1,43 @@
// Check to make sure that a worker can be attached to a toolbox
// directly, and that the toolbox has expected properties.
var TAB_URL = EXAMPLE_URL + "doc_WorkerActor.attachThread-tab.html";
var WORKER_URL = "code_WorkerActor.attachThread-worker.js";
add_task(function* () {
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._host.type, "window", "correct host");
ok(toolbox._host._window.document.title.contains(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");
yield gDevTools.closeToolbox(TargetFactory.forWorker(workerClient));
terminateWorkerInTab(tab, WORKER_URL);
yield waitForWorkerClose(workerClient);
yield close(client);
});

View File

@ -856,6 +856,10 @@ WorkerTarget.prototype = {
return true;
},
get url() {
return this._workerClient.url;
},
get form() {
return {
from: this._workerClient.actor,

View File

@ -1493,10 +1493,8 @@ Toolbox.prototype = {
toolName = toolboxStrings("toolbox.defaultTitle");
}
let title = toolboxStrings("toolbox.titleTemplate",
toolName,
this.target.isAddon ?
this.target.name :
this.target.url || this.target.name);
toolName, this.target.name ||
this.target.url);
this._host.setTitle(title);
},