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-01-26 12:53:45 +03:00
|
|
|
const {Cc, Ci} = require("chrome");
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
const { Services } = require("resource://gre/modules/Services.jsm");
|
|
|
|
|
|
|
|
loader.lazyGetter(this, "osString", () => Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS);
|
|
|
|
|
|
|
|
// Panels
|
2015-09-21 20:04:18 +03:00
|
|
|
loader.lazyGetter(this, "OptionsPanel", () => require("devtools/client/framework/toolbox-options").OptionsPanel);
|
|
|
|
loader.lazyGetter(this, "InspectorPanel", () => require("devtools/client/inspector/inspector-panel").InspectorPanel);
|
|
|
|
loader.lazyGetter(this, "WebConsolePanel", () => require("devtools/client/webconsole/panel").WebConsolePanel);
|
|
|
|
loader.lazyGetter(this, "DebuggerPanel", () => require("devtools/client/debugger/panel").DebuggerPanel);
|
|
|
|
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);
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
// Strings
|
2015-11-05 00:35:53 +03:00
|
|
|
const toolboxProps = "chrome://devtools/locale/toolbox.properties";
|
|
|
|
const inspectorProps = "chrome://devtools/locale/inspector.properties";
|
|
|
|
const webConsoleProps = "chrome://devtools/locale/webconsole.properties";
|
|
|
|
const debuggerProps = "chrome://devtools/locale/debugger.properties";
|
|
|
|
const styleEditorProps = "chrome://devtools/locale/styleeditor.properties";
|
|
|
|
const shaderEditorProps = "chrome://devtools/locale/shadereditor.properties";
|
|
|
|
const canvasDebuggerProps = "chrome://devtools/locale/canvasdebugger.properties";
|
|
|
|
const webAudioEditorProps = "chrome://devtools/locale/webaudioeditor.properties";
|
|
|
|
const performanceProps = "chrome://devtools/locale/performance.properties";
|
|
|
|
const netMonitorProps = "chrome://devtools/locale/netmonitor.properties";
|
|
|
|
const storageProps = "chrome://devtools/locale/storage.properties";
|
|
|
|
const scratchpadProps = "chrome://devtools/locale/scratchpad.properties";
|
|
|
|
const memoryProps = "chrome://devtools/locale/memory.properties";
|
2015-04-23 12:24:49 +03:00
|
|
|
|
|
|
|
loader.lazyGetter(this, "toolboxStrings", () => Services.strings.createBundle(toolboxProps));
|
2016-01-26 12:53:45 +03:00
|
|
|
loader.lazyGetter(this, "performanceStrings", () => Services.strings.createBundle(performanceProps));
|
2015-04-23 12:24:49 +03:00
|
|
|
loader.lazyGetter(this, "webConsoleStrings", () => Services.strings.createBundle(webConsoleProps));
|
|
|
|
loader.lazyGetter(this, "debuggerStrings", () => Services.strings.createBundle(debuggerProps));
|
|
|
|
loader.lazyGetter(this, "styleEditorStrings", () => Services.strings.createBundle(styleEditorProps));
|
|
|
|
loader.lazyGetter(this, "shaderEditorStrings", () => Services.strings.createBundle(shaderEditorProps));
|
|
|
|
loader.lazyGetter(this, "canvasDebuggerStrings", () => Services.strings.createBundle(canvasDebuggerProps));
|
|
|
|
loader.lazyGetter(this, "webAudioEditorStrings", () => Services.strings.createBundle(webAudioEditorProps));
|
|
|
|
loader.lazyGetter(this, "inspectorStrings", () => Services.strings.createBundle(inspectorProps));
|
|
|
|
loader.lazyGetter(this, "netMonitorStrings", () => Services.strings.createBundle(netMonitorProps));
|
|
|
|
loader.lazyGetter(this, "storageStrings", () => Services.strings.createBundle(storageProps));
|
|
|
|
loader.lazyGetter(this, "scratchpadStrings", () => Services.strings.createBundle(scratchpadProps));
|
2015-10-29 09:34:59 +03:00
|
|
|
loader.lazyGetter(this, "memoryStrings", () => Services.strings.createBundle(memoryProps));
|
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,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/framework/toolbox-options.xul",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-options.svg",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
|
|
|
bgTheme: "theme-body",
|
|
|
|
label: l10n("options.label", toolboxStrings),
|
|
|
|
iconOnly: true,
|
|
|
|
panelLabel: l10n("options.panelLabel", toolboxStrings),
|
|
|
|
tooltip: l10n("optionsButton.tooltip", toolboxStrings),
|
|
|
|
inMenu: false,
|
|
|
|
|
2016-01-26 12:53:45 +03:00
|
|
|
isTargetSupported: function() {
|
2015-04-23 12:24:49 +03:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
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",
|
|
|
|
accesskey: l10n("inspector.accesskey", inspectorStrings),
|
|
|
|
key: l10n("inspector.commandkey", inspectorStrings),
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/inspector/inspector.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("inspector.label", inspectorStrings),
|
|
|
|
panelLabel: l10n("inspector.panelLabel", inspectorStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
|
|
|
return l10n("inspector.tooltip2", inspectorStrings,
|
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",
|
|
|
|
"devtools/client/inspector/inspector-commands",
|
|
|
|
"devtools/client/eyedropper/commands.js"
|
2015-04-23 12:24:49 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
preventClosingOnKey: true,
|
|
|
|
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
return target.hasActor("inspector");
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
return new InspectorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.webConsole = {
|
|
|
|
id: "webconsole",
|
|
|
|
key: l10n("cmd.commandkey", webConsoleStrings),
|
|
|
|
accesskey: l10n("webConsoleCmd.accesskey", webConsoleStrings),
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/webconsole/webconsole.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("ToolboxTabWebconsole.label", webConsoleStrings),
|
|
|
|
menuLabel: l10n("MenuWebconsole.label", webConsoleStrings),
|
|
|
|
panelLabel: l10n("ToolboxWebConsole.panelLabel", webConsoleStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
|
|
|
return l10n("ToolboxWebconsole.tooltip2", webConsoleStrings,
|
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,
|
|
|
|
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-01-26 12:53:45 +03:00
|
|
|
isTargetSupported: function() {
|
2015-04-23 12:24:49 +03:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
return new WebConsolePanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.jsdebugger = {
|
|
|
|
id: "jsdebugger",
|
|
|
|
key: l10n("debuggerMenu.commandkey", debuggerStrings),
|
|
|
|
accesskey: l10n("debuggerMenu.accesskey", debuggerStrings),
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: 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",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("ToolboxDebugger.label", debuggerStrings),
|
|
|
|
panelLabel: l10n("ToolboxDebugger.panelLabel", debuggerStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
|
|
|
return l10n("ToolboxDebugger.tooltip2", debuggerStrings,
|
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-01-26 12:53:45 +03:00
|
|
|
isTargetSupported: function() {
|
2015-04-23 12:24:49 +03:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
return new DebuggerPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.styleEditor = {
|
|
|
|
id: "styleeditor",
|
|
|
|
key: l10n("open.commandkey", styleEditorStrings),
|
|
|
|
ordinal: 4,
|
|
|
|
accesskey: l10n("open.accesskey", styleEditorStrings),
|
|
|
|
modifiers: "shift",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-styleeditor.svg",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/styleeditor/styleeditor.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("ToolboxStyleEditor.label", styleEditorStrings),
|
|
|
|
panelLabel: l10n("ToolboxStyleEditor.panelLabel", styleEditorStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
|
|
|
return l10n("ToolboxStyleEditor.tooltip3", styleEditorStrings,
|
|
|
|
"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
|
|
|
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
return target.hasActor("styleEditor") || target.hasActor("styleSheets");
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/shadereditor/shadereditor.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("ToolboxShaderEditor.label", shaderEditorStrings),
|
|
|
|
panelLabel: l10n("ToolboxShaderEditor.panelLabel", shaderEditorStrings),
|
|
|
|
tooltip: l10n("ToolboxShaderEditor.tooltip", shaderEditorStrings),
|
|
|
|
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
return target.hasActor("webgl") && !target.chrome;
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/canvasdebugger/canvasdebugger.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("ToolboxCanvasDebugger.label", canvasDebuggerStrings),
|
|
|
|
panelLabel: l10n("ToolboxCanvasDebugger.panelLabel", canvasDebuggerStrings),
|
|
|
|
tooltip: l10n("ToolboxCanvasDebugger.tooltip", canvasDebuggerStrings),
|
|
|
|
|
|
|
|
// Hide the Canvas Debugger in the Add-on Debugger and Browser Toolbox
|
|
|
|
// (bug 1047520).
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
return target.hasActor("canvas") && !target.chrome;
|
|
|
|
},
|
|
|
|
|
2016-01-26 12:53:45 +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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: 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",
|
2015-07-16 23:28:30 +03:00
|
|
|
label: l10n("performance.label", performanceStrings),
|
|
|
|
panelLabel: l10n("performance.panelLabel", performanceStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
2015-07-16 23:28:30 +03:00
|
|
|
return l10n("performance.tooltip", performanceStrings,
|
2015-06-09 21:07:01 +03:00
|
|
|
"Shift+" + functionkey(this.key));
|
|
|
|
},
|
2015-07-16 23:28:30 +03:00
|
|
|
accesskey: l10n("performance.accesskey", performanceStrings),
|
|
|
|
key: l10n("performance.commandkey", performanceStrings),
|
2015-04-23 12:24:49 +03:00
|
|
|
modifiers: "shift",
|
|
|
|
inMenu: true,
|
|
|
|
|
2016-01-26 12:53:45 +03:00
|
|
|
isTargetSupported: function(target) {
|
2015-04-23 12:24:49 +03:00
|
|
|
return target.hasActor("profiler");
|
|
|
|
},
|
|
|
|
|
2016-01-26 12:53:45 +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",
|
2015-08-30 01:49:22 +03:00
|
|
|
invertIconForLightTheme: 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",
|
2015-10-29 09:34:59 +03:00
|
|
|
label: l10n("memory.label", memoryStrings),
|
|
|
|
panelLabel: l10n("memory.panelLabel", memoryStrings),
|
|
|
|
tooltip: l10n("memory.tooltip", memoryStrings),
|
2015-08-30 01:49:22 +03:00
|
|
|
|
2016-01-26 12:53:45 +03:00
|
|
|
isTargetSupported: function(target) {
|
2015-10-29 02:21:10 +03:00
|
|
|
return target.getTrait("heapSnapshots");
|
2015-08-30 01:49:22 +03:00
|
|
|
},
|
|
|
|
|
2016-01-26 12:53:45 +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",
|
|
|
|
accesskey: l10n("netmonitor.accesskey", netMonitorStrings),
|
|
|
|
key: l10n("netmonitor.commandkey", netMonitorStrings),
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/netmonitor/netmonitor.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("netmonitor.label", netMonitorStrings),
|
|
|
|
panelLabel: l10n("netmonitor.panelLabel", netMonitorStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
|
|
|
return l10n("netmonitor.tooltip2", netMonitorStrings,
|
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,
|
|
|
|
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
return target.getTrait("networkMonitor");
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
return new NetMonitorPanel(iframeWindow, toolbox);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Tools.storage = {
|
|
|
|
id: "storage",
|
|
|
|
key: l10n("storage.commandkey", storageStrings),
|
|
|
|
ordinal: 10,
|
|
|
|
accesskey: l10n("storage.accesskey", storageStrings),
|
|
|
|
modifiers: "shift",
|
|
|
|
visibilityswitch: "devtools.storage.enabled",
|
2015-10-30 21:59:30 +03:00
|
|
|
icon: "chrome://devtools/skin/images/tool-storage.svg",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/storage/storage.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("storage.label", storageStrings),
|
|
|
|
menuLabel: l10n("storage.menuLabel", storageStrings),
|
|
|
|
panelLabel: l10n("storage.panelLabel", storageStrings),
|
2015-06-09 21:07:01 +03:00
|
|
|
get tooltip() {
|
|
|
|
return l10n("storage.tooltip3", storageStrings,
|
|
|
|
"Shift+" + functionkey(this.key));
|
|
|
|
},
|
2015-04-23 12:24:49 +03:00
|
|
|
inMenu: true,
|
|
|
|
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
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
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/webaudioeditor/webaudioeditor.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("ToolboxWebAudioEditor1.label", webAudioEditorStrings),
|
|
|
|
panelLabel: l10n("ToolboxWebAudioEditor1.panelLabel", webAudioEditorStrings),
|
|
|
|
tooltip: l10n("ToolboxWebAudioEditor1.tooltip", webAudioEditorStrings),
|
|
|
|
|
|
|
|
isTargetSupported: function(target) {
|
|
|
|
return !target.chrome && target.hasActor("webaudio");
|
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
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",
|
2015-04-23 12:24:49 +03:00
|
|
|
invertIconForLightTheme: true,
|
2015-09-21 20:02:37 +03:00
|
|
|
url: "chrome://devtools/content/scratchpad/scratchpad.xul",
|
2015-04-23 12:24:49 +03:00
|
|
|
label: l10n("scratchpad.label", scratchpadStrings),
|
|
|
|
panelLabel: l10n("scratchpad.panelLabel", scratchpadStrings),
|
|
|
|
tooltip: l10n("scratchpad.tooltip", scratchpadStrings),
|
|
|
|
inMenu: false,
|
2015-09-21 20:04:18 +03:00
|
|
|
commands: "devtools/client/scratchpad/scratchpad-commands",
|
2015-04-23 12:24:49 +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
|
|
|
},
|
|
|
|
|
|
|
|
build: function(iframeWindow, toolbox) {
|
|
|
|
return new ScratchpadPanel(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,
|
2015-04-23 12:24:49 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
exports.defaultTools = defaultTools;
|
|
|
|
|
|
|
|
Tools.darkTheme = {
|
|
|
|
id: "dark",
|
|
|
|
label: l10n("options.darkTheme.label", toolboxStrings),
|
|
|
|
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",
|
|
|
|
label: l10n("options.lightTheme.label", toolboxStrings),
|
|
|
|
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"],
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.defaultThemes = [
|
|
|
|
Tools.darkTheme,
|
|
|
|
Tools.lightTheme,
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lookup l10n string from a string bundle.
|
|
|
|
*
|
|
|
|
* @param {string} name
|
|
|
|
* The key to lookup.
|
|
|
|
* @param {StringBundle} bundle
|
|
|
|
* The key to lookup.
|
|
|
|
* @returns A localized version of the given key.
|
|
|
|
*/
|
2016-01-26 12:53:45 +03:00
|
|
|
function l10n(name, bundle, arg) {
|
2015-04-23 12:24:49 +03:00
|
|
|
try {
|
2015-06-09 21:07:01 +03:00
|
|
|
return arg ? bundle.formatStringFromName(name, [arg], 1)
|
|
|
|
: bundle.GetStringFromName(name);
|
2015-04-23 12:24:49 +03:00
|
|
|
} catch (ex) {
|
|
|
|
Services.console.logStringMessage("Error reading '" + name + "'");
|
|
|
|
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];
|
|
|
|
}
|