зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 8d68726f1c34 (bug 1359855)
This commit is contained in:
Родитель
faf348ee1d
Коммит
c25a2aad53
|
@ -184,7 +184,6 @@ DevToolsStartup.prototype = {
|
||||||
this.handleDebuggerServerFlag(cmdLine, debuggerServerFlag);
|
this.handleDebuggerServerFlag(cmdLine, debuggerServerFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only top level Firefox Windows fire a browser-delayed-startup-finished event
|
|
||||||
let onWindowReady = window => {
|
let onWindowReady = window => {
|
||||||
this.hookWindow(window);
|
this.hookWindow(window);
|
||||||
|
|
||||||
|
@ -513,15 +512,6 @@ DevToolsStartup.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Used by tests and the toolbox to register the same key shortcuts in toolboxes loaded
|
|
||||||
// in a window window.
|
|
||||||
get KeyShortcuts() {
|
|
||||||
return KeyShortcuts;
|
|
||||||
},
|
|
||||||
get wrappedJSObject() {
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
helpInfo: " --jsconsole Open the Browser Console.\n" +
|
helpInfo: " --jsconsole Open the Browser Console.\n" +
|
||||||
" --jsdebugger Open the Browser Toolbox.\n" +
|
" --jsdebugger Open the Browser Toolbox.\n" +
|
||||||
|
|
|
@ -5,22 +5,16 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports)
|
|
||||||
.wrappedJSObject;
|
|
||||||
var {Toolbox} = require("devtools/client/framework/toolbox");
|
var {Toolbox} = require("devtools/client/framework/toolbox");
|
||||||
|
|
||||||
var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = [];
|
var toolbox, toolIDs, idIndex, modifiedPrefs = [];
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
addTab("about:blank").then(function () {
|
addTab("about:blank").then(function () {
|
||||||
toolIDs = [];
|
toolIDs = [];
|
||||||
for (let [id, definition] of gDevTools._tools) {
|
for (let [id, definition] of gDevTools._tools) {
|
||||||
let shortcut = Startup.KeyShortcuts.filter(s => s.toolId == id)[0];
|
if (definition.key) {
|
||||||
if (!shortcut) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
toolIDs.push(id);
|
toolIDs.push(id);
|
||||||
toolShortcuts.push(shortcut);
|
|
||||||
|
|
||||||
// Enable disabled tools
|
// Enable disabled tools
|
||||||
let pref = definition.visibilityswitch, prefValue;
|
let pref = definition.visibilityswitch, prefValue;
|
||||||
|
@ -34,6 +28,7 @@ function test() {
|
||||||
Services.prefs.setBoolPref(pref, true);
|
Services.prefs.setBoolPref(pref, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||||
idIndex = 0;
|
idIndex = 0;
|
||||||
gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW)
|
gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW)
|
||||||
|
@ -54,9 +49,8 @@ function testShortcuts(aToolbox, aIndex) {
|
||||||
|
|
||||||
toolbox.once("select", selectCB);
|
toolbox.once("select", selectCB);
|
||||||
|
|
||||||
let shortcut = toolShortcuts[aIndex];
|
let key = gDevTools._tools.get(toolIDs[aIndex]).key;
|
||||||
let key = shortcut.shortcut;
|
let toolModifiers = gDevTools._tools.get(toolIDs[aIndex]).modifiers;
|
||||||
let toolModifiers = shortcut.modifiers;
|
|
||||||
let modifiers = {
|
let modifiers = {
|
||||||
accelKey: toolModifiers.includes("accel"),
|
accelKey: toolModifiers.includes("accel"),
|
||||||
altKey: toolModifiers.includes("alt"),
|
altKey: toolModifiers.includes("alt"),
|
||||||
|
|
|
@ -14,7 +14,7 @@ const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST";
|
||||||
const SCREENSIZE_HISTOGRAM = "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER";
|
const SCREENSIZE_HISTOGRAM = "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER";
|
||||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||||
|
|
||||||
var {Ci, Cu, Cc} = require("chrome");
|
var {Ci, Cu} = require("chrome");
|
||||||
var promise = require("promise");
|
var promise = require("promise");
|
||||||
var defer = require("devtools/shared/defer");
|
var defer = require("devtools/shared/defer");
|
||||||
var Services = require("Services");
|
var Services = require("Services");
|
||||||
|
@ -27,8 +27,6 @@ var Menu = require("devtools/client/framework/menu");
|
||||||
var MenuItem = require("devtools/client/framework/menu-item");
|
var MenuItem = require("devtools/client/framework/menu-item");
|
||||||
var { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
|
var { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
|
||||||
const { KeyCodes } = require("devtools/client/shared/keycodes");
|
const { KeyCodes } = require("devtools/client/shared/keycodes");
|
||||||
var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports)
|
|
||||||
.wrappedJSObject;
|
|
||||||
|
|
||||||
const { BrowserLoader } =
|
const { BrowserLoader } =
|
||||||
Cu.import("resource://devtools/client/shared/browser-loader.js", {});
|
Cu.import("resource://devtools/client/shared/browser-loader.js", {});
|
||||||
|
@ -859,25 +857,24 @@ Toolbox.prototype = {
|
||||||
|
|
||||||
let doc = this.win.parent.document;
|
let doc = this.win.parent.document;
|
||||||
|
|
||||||
for (let item of Startup.KeyShortcuts) {
|
for (let [id, toolDefinition] of gDevTools.getToolDefinitionMap()) {
|
||||||
// KeyShortcuts contain tool-specific and global key shortcuts,
|
// Prevent multiple entries for the same tool.
|
||||||
// here we only need to copy shortcut specific to each tool.
|
if (!toolDefinition.key || doc.getElementById("key_" + id)) {
|
||||||
if (!item.toolId) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let { toolId, shortcut, modifiers } = item;
|
|
||||||
|
|
||||||
|
let toolId = id;
|
||||||
let key = doc.createElement("key");
|
let key = doc.createElement("key");
|
||||||
|
|
||||||
key.id = "key_" + toolId;
|
key.id = "key_" + toolId;
|
||||||
|
|
||||||
if (shortcut.startsWith("VK_")) {
|
if (toolDefinition.key.startsWith("VK_")) {
|
||||||
key.setAttribute("keycode", shortcut);
|
key.setAttribute("keycode", toolDefinition.key);
|
||||||
} else {
|
} else {
|
||||||
key.setAttribute("key", shortcut);
|
key.setAttribute("key", toolDefinition.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
key.setAttribute("modifiers", modifiers);
|
key.setAttribute("modifiers", toolDefinition.modifiers);
|
||||||
// needed. See bug 371900
|
// needed. See bug 371900
|
||||||
key.setAttribute("oncommand", "void(0);");
|
key.setAttribute("oncommand", "void(0);");
|
||||||
key.addEventListener("command", () => {
|
key.addEventListener("command", () => {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче