1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import { require } from "resource://devtools/shared/loader/Loader.sys.mjs";
const { gDevTools } = require("devtools/client/framework/devtools");
import { setTimeout } from "resource://gre/modules/Timer.sys.mjs";
async function showToolboxForSelectedTab(toolId, hostType) {
const browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
const tab = browserWindow.gBrowser.selectedTab;
return gDevTools.showToolboxForTab(tab, { toolId, hostType });
}
function selectToolbox(toolbox) {
return toolbox.win.document.querySelector("#toolbox-container");
}
export var DevTools = {
init(libDir) {
let panels = [
"options",
"webconsole",
"jsdebugger",
"styleeditor",
"performance",
"netmonitor",
];
panels.forEach(panel => {
this.configurations[panel] = {};
this.configurations[panel].applyConfig = async function () {
Services.prefs.setIntPref("devtools.toolbox.footer.height", 800);
let toolbox = await showToolboxForSelectedTab(panel, "bottom");
this.selectors = [selectToolbox.bind(null, toolbox)];
await new Promise(resolve => setTimeout(resolve, 500));
};
});
},
configurations: {
bottomToolbox: {
async applyConfig() {
Services.prefs.clearUserPref("devtools.toolbox.footer.height");
let toolbox = await showToolboxForSelectedTab("inspector", "bottom");
this.selectors = [selectToolbox.bind(null, toolbox)];
await new Promise(resolve => setTimeout(resolve, 1000));
},
},
sideToolbox: {
async applyConfig() {
let toolbox = await showToolboxForSelectedTab("inspector", "right");
this.selectors = [selectToolbox.bind(null, toolbox)];
await new Promise(resolve => setTimeout(resolve, 1000));
},
async verifyConfig() {
return "Panel sizes are regularly inconsistent";
},
},
undockedToolbox: {
windowType: "devtools:toolbox",
async applyConfig() {
let toolbox = await showToolboxForSelectedTab("inspector", "window");
this.selectors = [selectToolbox.bind(null, toolbox)];
await new Promise(resolve => setTimeout(resolve, 1000));
},
async verifyConfig() {
return "Panel sizes are regularly inconsistent";
},
},
},
};
|