Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 let toolbox;
6 function test() {
7 addTab("about:blank", function() {
8 let target = TargetFactory.forTab(gBrowser.selectedTab);
9 gDevTools.showToolbox(target, "webconsole").then(testSelect);
10 });
11 }
13 let called = {
14 inspector: false,
15 webconsole: false,
16 styleeditor: false,
17 //jsdebugger: false,
18 }
20 function testSelect(aToolbox) {
21 toolbox = aToolbox;
23 info("Toolbox fired a `ready` event");
25 toolbox.on("select", selectCB);
27 toolbox.selectTool("inspector");
28 toolbox.selectTool("webconsole");
29 toolbox.selectTool("styleeditor");
30 //toolbox.selectTool("jsdebugger");
31 }
33 function selectCB(event, id) {
34 called[id] = true;
35 info("toolbox-select event from " + id);
37 for (let tool in called) {
38 if (!called[tool]) {
39 return;
40 }
41 }
43 ok(true, "All the tools fired a 'select event'");
44 toolbox.off("select", selectCB);
46 reselect();
47 }
49 function reselect() {
50 for (let tool in called) {
51 called[tool] = false;
52 }
54 toolbox.once("inspector-selected", function() {
55 tidyUpIfAllCalled("inspector");
56 });
58 toolbox.once("webconsole-selected", function() {
59 tidyUpIfAllCalled("webconsole");
60 });
62 /*
63 toolbox.once("jsdebugger-selected", function() {
64 tidyUpIfAllCalled("jsdebugger");
65 });
66 */
68 toolbox.once("styleeditor-selected", function() {
69 tidyUpIfAllCalled("styleeditor");
70 });
72 toolbox.selectTool("inspector");
73 toolbox.selectTool("webconsole");
74 toolbox.selectTool("styleeditor");
75 //toolbox.selectTool("jsdebugger");
76 }
78 function tidyUpIfAllCalled(id) {
79 called[id] = true;
80 info("select event from " + id);
82 for (let tool in called) {
83 if (!called[tool]) {
84 return;
85 }
86 }
88 ok(true, "All the tools fired a {id}-selected event");
89 tidyUp();
90 }
92 function tidyUp() {
93 toolbox.destroy();
94 gBrowser.removeCurrentTab();
96 toolbox = null;
97 finish();
98 }