browser/devtools/framework/test/browser_toolbox_tool_ready.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 function test() {
michael@0 5 addTab().then(function(data) {
michael@0 6 data.target.makeRemote().then(performChecks.bind(null, data));
michael@0 7 }).then(null, console.error);
michael@0 8
michael@0 9 function performChecks(data) {
michael@0 10 let toolIds = gDevTools.getToolDefinitionArray()
michael@0 11 .filter(def => def.isTargetSupported(data.target))
michael@0 12 .map(def => def.id);
michael@0 13
michael@0 14 let open = function(index) {
michael@0 15 let toolId = toolIds[index];
michael@0 16
michael@0 17 info("About to open " + index + "/" + toolId);
michael@0 18 gDevTools.showToolbox(data.target, toolId).then(function(toolbox) {
michael@0 19 ok(toolbox, "toolbox exists for " + toolId);
michael@0 20 is(toolbox.currentToolId, toolId, "currentToolId should be " + toolId);
michael@0 21
michael@0 22 let panel = toolbox.getCurrentPanel();
michael@0 23 ok(panel.isReady, toolId + " panel should be ready");
michael@0 24
michael@0 25 let nextIndex = index + 1;
michael@0 26 if (nextIndex >= toolIds.length) {
michael@0 27 toolbox.destroy().then(function() {
michael@0 28 gBrowser.removeCurrentTab();
michael@0 29 finish();
michael@0 30 });
michael@0 31 }
michael@0 32 else {
michael@0 33 open(nextIndex);
michael@0 34 }
michael@0 35 }, console.error);
michael@0 36 };
michael@0 37
michael@0 38 open(0);
michael@0 39 }
michael@0 40 }

mercurial