зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160361 - Load tilt commands from ToolboxButtons to avoid in non-Firefox. r=bgrins
This commit is contained in:
Родитель
c4c5d2e928
Коммит
055a395833
|
@ -70,7 +70,7 @@ XPCOMUtils.defineLazyGetter(this, "is64Bit", () => {
|
|||
// 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)
|
||||
const ToolboxButtons = [
|
||||
const ToolboxButtons = exports.ToolboxButtons = [
|
||||
{ id: "command-button-pick",
|
||||
isTargetSupported: target =>
|
||||
target.getTrait("highlightable")
|
||||
|
@ -83,7 +83,8 @@ const ToolboxButtons = [
|
|||
isTargetSupported: target => !target.isAddon },
|
||||
{ id: "command-button-responsive" },
|
||||
{ id: "command-button-paintflashing" },
|
||||
{ id: "command-button-tilt" },
|
||||
{ id: "command-button-tilt",
|
||||
commands: "devtools/tilt/tilt-commands" },
|
||||
{ id: "command-button-scratchpad" },
|
||||
{ id: "command-button-eyedropper" },
|
||||
{ id: "command-button-screenshot" },
|
||||
|
|
|
@ -54,7 +54,6 @@ exports.baseModules = [
|
|||
* modules that are *not* owned by a tool.
|
||||
*/
|
||||
exports.devtoolsModules = [
|
||||
"devtools/tilt/tilt-commands",
|
||||
"gcli/commands/addon",
|
||||
"gcli/commands/appcache",
|
||||
"gcli/commands/calllog",
|
||||
|
@ -88,6 +87,20 @@ try {
|
|||
exports.devtoolsToolModules = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands from toolbox buttons with 'command: [ "some/module" ]'
|
||||
* definitions. The map/reduce incantation squashes the array of arrays to a
|
||||
* single array.
|
||||
*/
|
||||
try {
|
||||
const { ToolboxButtons } = require("devtools/framework/toolbox");
|
||||
exports.devtoolsButtonModules = ToolboxButtons.map(def => def.commands || [])
|
||||
.reduce((prev, curr) => prev.concat(curr), []);
|
||||
} catch(e) {
|
||||
// "devtools/framework/toolbox" is only accessible from Firefox
|
||||
exports.devtoolsButtonModules = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add modules to a system for use in a content process (but don't call load)
|
||||
*/
|
||||
|
@ -95,6 +108,7 @@ exports.addAllItemsByModule = function(system) {
|
|||
system.addItemsByModule(exports.baseModules, { delayedLoad: true });
|
||||
system.addItemsByModule(exports.devtoolsModules, { delayedLoad: true });
|
||||
system.addItemsByModule(exports.devtoolsToolModules, { delayedLoad: true });
|
||||
system.addItemsByModule(exports.devtoolsButtonModules, { delayedLoad: true });
|
||||
|
||||
const { mozDirLoader } = require("gcli/commands/cmd");
|
||||
system.addItemsByModule("mozcmd", { delayedLoad: true, loader: mozDirLoader });
|
||||
|
|
Загрузка…
Ссылка в новой задаче