Backed out changeset 8d68726f1c34 (bug 1359855)

This commit is contained in:
Carsten "Tomcat" Book 2017-07-24 12:07:16 +02:00
Родитель faf348ee1d
Коммит c25a2aad53
3 изменённых файлов: 25 добавлений и 44 удалений

Просмотреть файл

@ -184,7 +184,6 @@ DevToolsStartup.prototype = {
this.handleDebuggerServerFlag(cmdLine, debuggerServerFlag);
}
// Only top level Firefox Windows fire a browser-delayed-startup-finished event
let onWindowReady = 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 */
helpInfo: " --jsconsole Open the Browser Console.\n" +
" --jsdebugger Open the Browser Toolbox.\n" +

Просмотреть файл

@ -5,22 +5,16 @@
"use strict";
var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports)
.wrappedJSObject;
var {Toolbox} = require("devtools/client/framework/toolbox");
var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = [];
var toolbox, toolIDs, idIndex, modifiedPrefs = [];
function test() {
addTab("about:blank").then(function () {
toolIDs = [];
for (let [id, definition] of gDevTools._tools) {
let shortcut = Startup.KeyShortcuts.filter(s => s.toolId == id)[0];
if (!shortcut) {
continue;
}
if (definition.key) {
toolIDs.push(id);
toolShortcuts.push(shortcut);
// Enable disabled tools
let pref = definition.visibilityswitch, prefValue;
@ -34,6 +28,7 @@ function test() {
Services.prefs.setBoolPref(pref, true);
}
}
}
let target = TargetFactory.forTab(gBrowser.selectedTab);
idIndex = 0;
gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW)
@ -54,9 +49,8 @@ function testShortcuts(aToolbox, aIndex) {
toolbox.once("select", selectCB);
let shortcut = toolShortcuts[aIndex];
let key = shortcut.shortcut;
let toolModifiers = shortcut.modifiers;
let key = gDevTools._tools.get(toolIDs[aIndex]).key;
let toolModifiers = gDevTools._tools.get(toolIDs[aIndex]).modifiers;
let modifiers = {
accelKey: toolModifiers.includes("accel"),
altKey: toolModifiers.includes("alt"),

Просмотреть файл

@ -14,7 +14,7 @@ const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST";
const SCREENSIZE_HISTOGRAM = "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER";
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 defer = require("devtools/shared/defer");
var Services = require("Services");
@ -27,8 +27,6 @@ var Menu = require("devtools/client/framework/menu");
var MenuItem = require("devtools/client/framework/menu-item");
var { DOMHelpers } = require("resource://devtools/client/shared/DOMHelpers.jsm");
const { KeyCodes } = require("devtools/client/shared/keycodes");
var Startup = Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports)
.wrappedJSObject;
const { BrowserLoader } =
Cu.import("resource://devtools/client/shared/browser-loader.js", {});
@ -859,25 +857,24 @@ Toolbox.prototype = {
let doc = this.win.parent.document;
for (let item of Startup.KeyShortcuts) {
// KeyShortcuts contain tool-specific and global key shortcuts,
// here we only need to copy shortcut specific to each tool.
if (!item.toolId) {
for (let [id, toolDefinition] of gDevTools.getToolDefinitionMap()) {
// Prevent multiple entries for the same tool.
if (!toolDefinition.key || doc.getElementById("key_" + id)) {
continue;
}
let { toolId, shortcut, modifiers } = item;
let toolId = id;
let key = doc.createElement("key");
key.id = "key_" + toolId;
if (shortcut.startsWith("VK_")) {
key.setAttribute("keycode", shortcut);
if (toolDefinition.key.startsWith("VK_")) {
key.setAttribute("keycode", toolDefinition.key);
} else {
key.setAttribute("key", shortcut);
key.setAttribute("key", toolDefinition.key);
}
key.setAttribute("modifiers", modifiers);
key.setAttribute("modifiers", toolDefinition.modifiers);
// needed. See bug 371900
key.setAttribute("oncommand", "void(0);");
key.addEventListener("command", () => {