2015-04-23 12:24:49 +03:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2016-02-27 15:51:10 +03:00
|
|
|
const Services = require("Services");
|
2016-07-14 21:48:47 +03:00
|
|
|
const osString = Services.appinfo.OS;
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
// Panels
|
2015-09-21 20:04:18 +03:00
|
|
|
loader.lazyGetter(this, "OptionsPanel", () => require("devtools/client/framework/toolbox-options").OptionsPanel);
|
2016-09-29 20:02:28 +03:00
|
|
|
loader.lazyGetter(this, "InspectorPanel", () => require("devtools/client/inspector/panel").InspectorPanel);
|
2015-09-21 20:04:18 +03:00
|
|
|
loader.lazyGetter(this, "WebConsolePanel", () => require("devtools/client/webconsole/panel").WebConsolePanel);
|
|
|
|
loader.lazyGetter(this, "DebuggerPanel", () => require("devtools/client/debugger/panel").DebuggerPanel);
|
2016-12-19 20:00:12 +03:00
|
|
|
loader.lazyGetter(this, "NewDebuggerPanel", () => require("devtools/client/debugger/new/panel").DebuggerPanel);
|
2015-09-21 20:04:18 +03:00
|
|
|
loader.lazyGetter(this, "StyleEditorPanel", () => require("devtools/client/styleeditor/styleeditor-panel").StyleEditorPanel);
|
|
|
|
loader.lazyGetter(this, "ShaderEditorPanel", () => require("devtools/client/shadereditor/panel").ShaderEditorPanel);
|
|
|
|
loader.lazyGetter(this, "CanvasDebuggerPanel", () => require("devtools/client/canvasdebugger/panel").CanvasDebuggerPanel);
|
|
|
|
loader.lazyGetter(this, "WebAudioEditorPanel", () => require("devtools/client/webaudioeditor/panel").WebAudioEditorPanel);
|
|
|
|
loader.lazyGetter(this, "MemoryPanel", () => require("devtools/client/memory/panel").MemoryPanel);
|
|
|
|
loader.lazyGetter(this, "PerformancePanel", () => require("devtools/client/performance/panel").PerformancePanel);
|
|
|
|
loader.lazyGetter(this, "NetMonitorPanel", () => require("devtools/client/netmonitor/panel").NetMonitorPanel);
|
|
|
|
loader.lazyGetter(this, "StoragePanel", () => require("devtools/client/storage/panel").StoragePanel);
|
|
|
|
loader.lazyGetter(this, "ScratchpadPanel", () => require("devtools/client/scratchpad/scratchpad-panel").ScratchpadPanel);
|
2016-02-10 01:23:29 +03:00
|
|
|
loader.lazyGetter(this, "DomPanel", () => require("devtools/client/dom/dom-panel").DomPanel);
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-08-26 20:38:27 +03:00
|
|
|
const {LocalizationHelper} = require("devtools/shared/l10n");
|
2016-10-26 06:30:18 +03:00
|
|
|
const L10N = new LocalizationHelper("devtools/client/locales/startup.properties");
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2015-09-15 21:19:45 +03:00
|
|
|
var Tools = {};
|
2015-04-23 12:24:49 +03:00
|
|
|
exports.Tools = Tools;
|
|
|
|
|
|
|
|
// Definitions
|
|
|
|
Tools.options = {
|
|
|
|
id: "options",
|
|
|
|
ordinal: 0,
|
2016-02-27 01:40:14 +03:00
|
|
|
url: "chrome://devtools/content/framework/toolbox-options.xhtml",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-options.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-04-23 12:24:49 +03:00
|
|
|
bgTheme: "theme-body",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("options.label"),
|
2015-04-23 12:24:49 +03:00
|
|
|
iconOnly: true,
|
2016-09-02 18:45:22 +03:00
|
|
|
panelLabel: l10n("options.panelLabel"),
|
|
|
|
tooltip: l10n("optionsButton.tooltip"),
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: false,
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function () {
|
2015-04-23 12:24:49 +03:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new OptionsPanel(iframeWindow, toolbox);
|
|
|
|
}
|
2016-01-26 12:53:45 +03:00
|
|
|
};
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
Tools.inspector = {
|
|
|
|
id: "inspector",
|
2016-09-02 18:45:22 +03:00
|
|
|
accesskey: l10n("inspector.accesskey"),
|
|
|
|
key: l10n("inspector.commandkey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
ordinal: 1,
|
|
|
|
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-inspector.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2016-10-14 17:47:10 +03:00
|
|
|
url: "chrome://devtools/content/inspector/inspector.xhtml",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("inspector.label"),
|
|
|
|
panelLabel: l10n("inspector.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("inspector.tooltip2",
|
2016-01-26 12:53:45 +03:00
|
|
|
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
|
2015-06-09 21:07:01 +03:00
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
|
|
|
commands: [
|
2015-09-21 20:04:18 +03:00
|
|
|
"devtools/client/responsivedesign/resize-commands",
|
2016-07-20 17:06:42 +03:00
|
|
|
"devtools/client/inspector/inspector-commands"
|
2015-04-23 12:24:49 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
preventClosingOnKey: true,
|
2016-04-27 05:32:42 +03:00
|
|
|
onkey: function (panel, toolbox) {
|
2016-02-18 19:52:33 +03:00
|
|
|
toolbox.highlighterUtils.togglePicker();
|
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.hasActor("inspector");
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new InspectorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.webConsole = {
|
|
|
|
id: "webconsole",
|
2016-09-02 18:45:22 +03:00
|
|
|
key: l10n("cmd.commandkey"),
|
|
|
|
accesskey: l10n("webConsoleCmd.accesskey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
modifiers: Services.appinfo.OS == "Darwin" ? "accel,alt" : "accel,shift",
|
|
|
|
ordinal: 2,
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-webconsole.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/webconsole/webconsole.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("ToolboxTabWebconsole.label"),
|
|
|
|
menuLabel: l10n("MenuWebconsole.label"),
|
|
|
|
panelLabel: l10n("ToolboxWebConsole.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("ToolboxWebconsole.tooltip2",
|
2016-01-26 12:53:45 +03:00
|
|
|
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
|
2015-06-09 21:07:01 +03:00
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
2015-09-21 20:04:18 +03:00
|
|
|
commands: "devtools/client/webconsole/console-commands",
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
preventClosingOnKey: true,
|
2016-04-27 05:32:42 +03:00
|
|
|
onkey: function (panel, toolbox) {
|
2016-01-26 12:53:45 +03:00
|
|
|
if (toolbox.splitConsole) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return toolbox.focusConsoleInput();
|
2016-01-26 12:53:45 +03:00
|
|
|
}
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
panel.focusInput();
|
2016-04-05 21:31:19 +03:00
|
|
|
return undefined;
|
2015-04-23 12:24:49 +03:00
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function () {
|
2015-04-23 12:24:49 +03:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new WebConsolePanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.jsdebugger = {
|
|
|
|
id: "jsdebugger",
|
2016-09-02 18:45:22 +03:00
|
|
|
key: l10n("debuggerMenu.commandkey"),
|
|
|
|
accesskey: l10n("debuggerMenu.accesskey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
|
|
|
|
ordinal: 3,
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-debugger.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-10-30 21:59:30 +03:00
|
|
|
highlightedicon: "chrome://devtools/skin/images/tool-debugger-paused.svg",
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/debugger/debugger.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("ToolboxDebugger.label"),
|
|
|
|
panelLabel: l10n("ToolboxDebugger.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("ToolboxDebugger.tooltip2",
|
2016-01-26 12:53:45 +03:00
|
|
|
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
|
2015-06-09 21:07:01 +03:00
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
2015-09-21 20:04:18 +03:00
|
|
|
commands: "devtools/client/debugger/debugger-commands",
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function () {
|
2015-04-23 12:24:49 +03:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new DebuggerPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-09-01 00:21:24 +03:00
|
|
|
function switchDebugger() {
|
|
|
|
if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
|
|
|
|
Tools.jsdebugger.url = "chrome://devtools/content/debugger/new/index.html";
|
|
|
|
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
|
|
|
|
return new NewDebuggerPanel(iframeWindow, toolbox);
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
Tools.jsdebugger.url = "chrome://devtools/content/debugger/debugger.xul";
|
|
|
|
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
|
|
|
|
return new DebuggerPanel(iframeWindow, toolbox);
|
|
|
|
};
|
|
|
|
}
|
2016-08-05 16:27:41 +03:00
|
|
|
}
|
2016-09-01 00:21:24 +03:00
|
|
|
switchDebugger();
|
|
|
|
|
|
|
|
Services.prefs.addObserver(
|
|
|
|
"devtools.debugger.new-debugger-frontend",
|
|
|
|
{ observe: switchDebugger },
|
|
|
|
false
|
|
|
|
);
|
2016-08-05 16:27:41 +03:00
|
|
|
|
2015-04-23 12:24:49 +03:00
|
|
|
Tools.styleEditor = {
|
|
|
|
id: "styleeditor",
|
2016-09-02 18:45:22 +03:00
|
|
|
key: l10n("open.commandkey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
ordinal: 4,
|
2016-06-21 16:13:51 +03:00
|
|
|
visibilityswitch: "devtools.styleeditor.enabled",
|
2016-09-02 18:45:22 +03:00
|
|
|
accesskey: l10n("open.accesskey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
modifiers: "shift",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-styleeditor.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/styleeditor/styleeditor.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("ToolboxStyleEditor.label"),
|
|
|
|
panelLabel: l10n("ToolboxStyleEditor.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("ToolboxStyleEditor.tooltip3",
|
2015-06-09 21:07:01 +03:00
|
|
|
"Shift+" + functionkey(this.key));
|
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
2015-09-21 20:04:18 +03:00
|
|
|
commands: "devtools/client/styleeditor/styleeditor-commands",
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.hasActor("styleEditor") || target.hasActor("styleSheets");
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new StyleEditorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.shaderEditor = {
|
|
|
|
id: "shadereditor",
|
|
|
|
ordinal: 5,
|
|
|
|
visibilityswitch: "devtools.shadereditor.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-shadereditor.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/shadereditor/shadereditor.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("ToolboxShaderEditor.label"),
|
|
|
|
panelLabel: l10n("ToolboxShaderEditor.panelLabel"),
|
|
|
|
tooltip: l10n("ToolboxShaderEditor.tooltip"),
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.hasActor("webgl") && !target.chrome;
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new ShaderEditorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.canvasDebugger = {
|
|
|
|
id: "canvasdebugger",
|
|
|
|
ordinal: 6,
|
|
|
|
visibilityswitch: "devtools.canvasdebugger.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-canvas.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/canvasdebugger/canvasdebugger.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("ToolboxCanvasDebugger.label"),
|
|
|
|
panelLabel: l10n("ToolboxCanvasDebugger.panelLabel"),
|
|
|
|
tooltip: l10n("ToolboxCanvasDebugger.tooltip"),
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
// Hide the Canvas Debugger in the Add-on Debugger and Browser Toolbox
|
|
|
|
// (bug 1047520).
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.hasActor("canvas") && !target.chrome;
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new CanvasDebuggerPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.performance = {
|
|
|
|
id: "performance",
|
|
|
|
ordinal: 7,
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-profiler.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-10-30 21:59:30 +03:00
|
|
|
highlightedicon: "chrome://devtools/skin/images/tool-profiler-active.svg",
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/performance/performance.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
visibilityswitch: "devtools.performance.enabled",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("performance.label"),
|
|
|
|
panelLabel: l10n("performance.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("performance.tooltip", "Shift+" + functionkey(this.key));
|
2015-06-09 21:07:01 +03:00
|
|
|
},
|
2016-09-02 18:45:22 +03:00
|
|
|
accesskey: l10n("performance.accesskey"),
|
|
|
|
key: l10n("performance.commandkey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
modifiers: "shift",
|
|
|
|
inMenu: true,
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.hasActor("profiler");
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (frame, target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new PerformancePanel(frame, target);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-30 01:49:22 +03:00
|
|
|
Tools.memory = {
|
|
|
|
id: "memory",
|
|
|
|
ordinal: 8,
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-memory.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-10-30 21:59:30 +03:00
|
|
|
highlightedicon: "chrome://devtools/skin/images/tool-memory-active.svg",
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/memory/memory.xhtml",
|
2015-08-30 01:49:22 +03:00
|
|
|
visibilityswitch: "devtools.memory.enabled",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("memory.label"),
|
|
|
|
panelLabel: l10n("memory.panelLabel"),
|
|
|
|
tooltip: l10n("memory.tooltip"),
|
2015-08-30 01:49:22 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2016-07-21 20:10:12 +03:00
|
|
|
return target.getTrait("heapSnapshots") && !target.isAddon;
|
2015-08-30 01:49:22 +03:00
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (frame, target) {
|
2015-08-30 01:49:22 +03:00
|
|
|
return new MemoryPanel(frame, target);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-04-23 12:24:49 +03:00
|
|
|
Tools.netMonitor = {
|
|
|
|
id: "netmonitor",
|
2016-09-02 18:45:22 +03:00
|
|
|
accesskey: l10n("netmonitor.accesskey"),
|
|
|
|
key: l10n("netmonitor.commandkey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
ordinal: 9,
|
|
|
|
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
|
|
|
|
visibilityswitch: "devtools.netmonitor.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-network.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/netmonitor/netmonitor.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("netmonitor.label"),
|
|
|
|
panelLabel: l10n("netmonitor.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("netmonitor.tooltip2",
|
2016-01-26 12:53:45 +03:00
|
|
|
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
|
2015-06-09 21:07:01 +03:00
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.getTrait("networkMonitor");
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new NetMonitorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.storage = {
|
|
|
|
id: "storage",
|
2016-09-02 18:45:22 +03:00
|
|
|
key: l10n("storage.commandkey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
ordinal: 10,
|
2016-09-02 18:45:22 +03:00
|
|
|
accesskey: l10n("storage.accesskey"),
|
2015-04-23 12:24:49 +03:00
|
|
|
modifiers: "shift",
|
|
|
|
visibilityswitch: "devtools.storage.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-storage.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/storage/storage.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("storage.label"),
|
|
|
|
menuLabel: l10n("storage.menuLabel"),
|
|
|
|
panelLabel: l10n("storage.panelLabel"),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("storage.tooltip3", "Shift+" + functionkey(this.key));
|
2015-06-09 21:07:01 +03:00
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.isLocalTab ||
|
2016-01-26 12:53:45 +03:00
|
|
|
(target.hasActor("storage") && target.getTrait("storageInspector"));
|
2015-04-23 12:24:49 +03:00
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new StoragePanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.webAudioEditor = {
|
|
|
|
id: "webaudioeditor",
|
|
|
|
ordinal: 11,
|
|
|
|
visibilityswitch: "devtools.webaudioeditor.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-webaudio.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/webaudioeditor/webaudioeditor.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("ToolboxWebAudioEditor1.label"),
|
|
|
|
panelLabel: l10n("ToolboxWebAudioEditor1.panelLabel"),
|
|
|
|
tooltip: l10n("ToolboxWebAudioEditor1.tooltip"),
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return !target.chrome && target.hasActor("webaudio");
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new WebAudioEditorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.scratchpad = {
|
|
|
|
id: "scratchpad",
|
|
|
|
ordinal: 12,
|
|
|
|
visibilityswitch: "devtools.scratchpad.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-scratchpad.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/scratchpad/scratchpad.xul",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("scratchpad.label"),
|
|
|
|
panelLabel: l10n("scratchpad.panelLabel"),
|
|
|
|
tooltip: l10n("scratchpad.tooltip"),
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: false,
|
2015-09-21 20:04:18 +03:00
|
|
|
commands: "devtools/client/scratchpad/scratchpad-commands",
|
2015-04-23 12:24:49 +03:00
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2016-02-04 13:20:55 +03:00
|
|
|
return target.hasActor("console");
|
2015-04-23 12:24:49 +03:00
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return new ScratchpadPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-02-10 01:23:29 +03:00
|
|
|
Tools.dom = {
|
|
|
|
id: "dom",
|
2016-09-02 18:45:22 +03:00
|
|
|
accesskey: l10n("dom.accesskey"),
|
|
|
|
key: l10n("dom.commandkey"),
|
2016-02-10 01:23:29 +03:00
|
|
|
ordinal: 13,
|
|
|
|
modifiers: osString == "Darwin" ? "accel,alt" : "accel,shift",
|
|
|
|
visibilityswitch: "devtools.dom.enabled",
|
|
|
|
icon: "chrome://devtools/skin/images/tool-dom.svg",
|
2016-07-22 01:44:11 +03:00
|
|
|
invertIconForDarkTheme: true,
|
2016-02-10 01:23:29 +03:00
|
|
|
url: "chrome://devtools/content/dom/dom.html",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("dom.label"),
|
|
|
|
panelLabel: l10n("dom.panelLabel"),
|
2016-02-10 01:23:29 +03:00
|
|
|
get tooltip() {
|
2016-09-02 18:45:22 +03:00
|
|
|
return l10n("dom.tooltip",
|
|
|
|
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") + this.key);
|
2016-02-10 01:23:29 +03:00
|
|
|
},
|
|
|
|
inMenu: true,
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
isTargetSupported: function (target) {
|
2016-02-10 01:23:29 +03:00
|
|
|
return target.getTrait("webConsoleCommands");
|
|
|
|
},
|
|
|
|
|
2016-04-27 05:32:42 +03:00
|
|
|
build: function (iframeWindow, toolbox) {
|
2016-02-10 01:23:29 +03:00
|
|
|
return new DomPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-15 21:19:45 +03:00
|
|
|
var defaultTools = [
|
2015-04-23 12:24:49 +03:00
|
|
|
Tools.options,
|
|
|
|
Tools.webConsole,
|
|
|
|
Tools.inspector,
|
|
|
|
Tools.jsdebugger,
|
|
|
|
Tools.styleEditor,
|
|
|
|
Tools.shaderEditor,
|
|
|
|
Tools.canvasDebugger,
|
|
|
|
Tools.webAudioEditor,
|
|
|
|
Tools.performance,
|
|
|
|
Tools.netMonitor,
|
|
|
|
Tools.storage,
|
2015-08-30 01:49:22 +03:00
|
|
|
Tools.scratchpad,
|
|
|
|
Tools.memory,
|
2016-02-10 01:23:29 +03:00
|
|
|
Tools.dom,
|
2015-04-23 12:24:49 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
exports.defaultTools = defaultTools;
|
|
|
|
|
|
|
|
Tools.darkTheme = {
|
|
|
|
id: "dark",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("options.darkTheme.label2"),
|
2015-04-23 12:24:49 +03:00
|
|
|
ordinal: 1,
|
2015-10-30 21:59:30 +03:00
|
|
|
stylesheets: ["chrome://devtools/skin/dark-theme.css"],
|
2015-04-23 12:24:49 +03:00
|
|
|
classList: ["theme-dark"],
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.lightTheme = {
|
|
|
|
id: "light",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("options.lightTheme.label2"),
|
2015-04-23 12:24:49 +03:00
|
|
|
ordinal: 2,
|
2015-10-30 21:59:30 +03:00
|
|
|
stylesheets: ["chrome://devtools/skin/light-theme.css"],
|
2015-04-23 12:24:49 +03:00
|
|
|
classList: ["theme-light"],
|
|
|
|
};
|
|
|
|
|
2016-04-06 18:23:46 +03:00
|
|
|
Tools.firebugTheme = {
|
|
|
|
id: "firebug",
|
2016-09-02 18:45:22 +03:00
|
|
|
label: l10n("options.firebugTheme.label2"),
|
2016-04-06 18:23:46 +03:00
|
|
|
ordinal: 3,
|
|
|
|
stylesheets: ["chrome://devtools/skin/firebug-theme.css"],
|
|
|
|
classList: ["theme-light", "theme-firebug"],
|
|
|
|
};
|
|
|
|
|
2015-04-23 12:24:49 +03:00
|
|
|
exports.defaultThemes = [
|
|
|
|
Tools.darkTheme,
|
|
|
|
Tools.lightTheme,
|
2016-04-06 18:23:46 +03:00
|
|
|
Tools.firebugTheme,
|
2015-04-23 12:24:49 +03:00
|
|
|
];
|
|
|
|
|
2016-10-13 00:22:57 +03:00
|
|
|
// White-list buttons that can be toggled to prevent adding prefs for
|
|
|
|
// addons that have manually inserted toolbarbuttons into DOM.
|
|
|
|
// (By default, supported target is only local tab)
|
|
|
|
exports.ToolboxButtons = [
|
|
|
|
{ id: "command-button-frames",
|
|
|
|
isTargetSupported: target => {
|
|
|
|
return target.activeTab && target.activeTab.traits.frames;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ id: "command-button-splitconsole",
|
|
|
|
isTargetSupported: target => !target.isAddon },
|
|
|
|
{ id: "command-button-responsive" },
|
|
|
|
{ id: "command-button-paintflashing" },
|
|
|
|
{ id: "command-button-scratchpad" },
|
|
|
|
{ id: "command-button-screenshot" },
|
|
|
|
{ id: "command-button-rulers" },
|
|
|
|
{ id: "command-button-measure" },
|
|
|
|
{ id: "command-button-noautohide",
|
|
|
|
isTargetSupported: target => target.chrome },
|
|
|
|
];
|
|
|
|
|
2015-04-23 12:24:49 +03:00
|
|
|
/**
|
|
|
|
* Lookup l10n string from a string bundle.
|
|
|
|
*
|
|
|
|
* @param {string} name
|
|
|
|
* The key to lookup.
|
2016-09-02 18:45:22 +03:00
|
|
|
* @param {string} arg
|
|
|
|
* Optional format argument.
|
2015-04-23 12:24:49 +03:00
|
|
|
* @returns A localized version of the given key.
|
|
|
|
*/
|
2016-09-02 18:45:22 +03:00
|
|
|
function l10n(name, arg) {
|
2015-04-23 12:24:49 +03:00
|
|
|
try {
|
2016-09-02 18:45:22 +03:00
|
|
|
return arg ? L10N.getFormatStr(name, arg) : L10N.getStr(name);
|
2015-04-23 12:24:49 +03:00
|
|
|
} catch (ex) {
|
2016-04-19 23:05:35 +03:00
|
|
|
console.log("Error reading '" + name + "'");
|
2015-04-23 12:24:49 +03:00
|
|
|
throw new Error("l10n error with " + name);
|
|
|
|
}
|
|
|
|
}
|
2015-06-09 21:07:01 +03:00
|
|
|
|
2016-01-26 12:53:45 +03:00
|
|
|
function functionkey(shortkey) {
|
2015-06-09 21:07:01 +03:00
|
|
|
return shortkey.split("_")[1];
|
|
|
|
}
|