зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 123010192259 (bug 1014090) for failing on browser_duplicateIDs.js. CLOSED TREE
This commit is contained in:
Родитель
46d78314dd
Коммит
1f27cbd511
|
@ -73,13 +73,9 @@ Tools.inspector = {
|
|||
label: l10n("inspector.label"),
|
||||
panelLabel: l10n("inspector.panelLabel"),
|
||||
get tooltip() {
|
||||
if (osString == "Darwin") {
|
||||
let cmdShiftC = "Cmd+Shift+" + l10n("inspector.commandkey");
|
||||
let cmdOptC = "Cmd+Opt+" + l10n("inspector.commandkey");
|
||||
return l10n("inspector.mac.tooltip", cmdShiftC, cmdOptC);
|
||||
}
|
||||
|
||||
return l10n("inspector.tooltip2", "Ctrl+Shift+") + l10n("inspector.commandkey");
|
||||
return l10n("inspector.tooltip2",
|
||||
(osString == "Darwin" ? "Cmd+Opt+" : "Ctrl+Shift+") +
|
||||
l10n("inspector.commandkey"));
|
||||
},
|
||||
inMenu: true,
|
||||
commands: [
|
||||
|
@ -624,13 +620,13 @@ exports.ToolboxButtons = [
|
|||
*
|
||||
* @param {string} name
|
||||
* The key to lookup.
|
||||
* @param {...string} args
|
||||
* @param {string} arg
|
||||
* Optional format argument.
|
||||
* @returns A localized version of the given key.
|
||||
*/
|
||||
function l10n(name, ...args) {
|
||||
function l10n(name, arg) {
|
||||
try {
|
||||
return args ? L10N.getFormatStr(name, ...args) : L10N.getStr(name);
|
||||
return arg ? L10N.getFormatStr(name, arg) : L10N.getStr(name);
|
||||
} catch (ex) {
|
||||
console.log("Error reading '" + name + "'");
|
||||
throw new Error("l10n error with " + name);
|
||||
|
|
|
@ -12,11 +12,9 @@ const TEST_URL = "data:text/html,<html><head><title>Test for the " +
|
|||
"<h1>Keybindings!</h1></body></html>";
|
||||
|
||||
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
|
||||
let allKeys = [];
|
||||
let keysetMap = { };
|
||||
|
||||
function buildDevtoolsKeysetMap(keyset) {
|
||||
// Fetches all the keyboard shortcuts which were defined by lazyGetter 'KeyShortcuts' in
|
||||
// devtools-startup.js and added to the DOM by 'hookKeyShortcuts'
|
||||
[].forEach.call(
|
||||
keyset.querySelectorAll("key"),
|
||||
function(key) {
|
||||
|
@ -25,8 +23,8 @@ function buildDevtoolsKeysetMap(keyset) {
|
|||
}
|
||||
|
||||
let modifiers = key.getAttribute("modifiers");
|
||||
allKeys.push({
|
||||
toolId: key.id.split("_")[1],
|
||||
|
||||
keysetMap[key.id.split("_")[1]] = {
|
||||
key: key.getAttribute("key"),
|
||||
modifiers: modifiers,
|
||||
modifierOpt: {
|
||||
|
@ -39,7 +37,7 @@ function buildDevtoolsKeysetMap(keyset) {
|
|||
synthesizeKey: function() {
|
||||
EventUtils.synthesizeKey(this.key, this.modifierOpt);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,57 +59,36 @@ add_task(async function() {
|
|||
|
||||
setupKeyBindingsTest();
|
||||
|
||||
info("Test the first inspector key (there are 2 of them on Mac)");
|
||||
let inspectorKeys = allKeys.filter(({ toolId }) => toolId === "inspector");
|
||||
|
||||
const isMac = Services.appinfo.OS === "Darwin";
|
||||
if (isMac) {
|
||||
is(inspectorKeys.length, 2, "There are 2 inspector keys on Mac");
|
||||
} else {
|
||||
is(inspectorKeys.length, 1, "Only 1 inspector key on non-Mac platforms");
|
||||
}
|
||||
|
||||
info("The first inspector key should open the toolbox.");
|
||||
let onToolboxReady = gDevTools.once("toolbox-ready");
|
||||
inspectorKeys[0].synthesizeKey();
|
||||
keysetMap.inspector.synthesizeKey();
|
||||
let toolbox = await onToolboxReady;
|
||||
await inspectorShouldBeOpenAndHighlighting(inspectorKeys[0]);
|
||||
|
||||
await inspectorShouldBeOpenAndHighlighting();
|
||||
|
||||
let onSelectTool = gDevTools.once("select-tool-command");
|
||||
let webconsole = allKeys.filter(({ toolId }) => toolId === "webconsole")[0];
|
||||
webconsole.synthesizeKey();
|
||||
keysetMap.webconsole.synthesizeKey();
|
||||
await onSelectTool;
|
||||
await webconsoleShouldBeSelected();
|
||||
|
||||
onSelectTool = gDevTools.once("select-tool-command");
|
||||
let jsdebugger = allKeys.filter(({ toolId }) => toolId === "jsdebugger")[0];
|
||||
jsdebugger.synthesizeKey();
|
||||
keysetMap.jsdebugger.synthesizeKey();
|
||||
await onSelectTool;
|
||||
await jsdebuggerShouldBeSelected();
|
||||
|
||||
onSelectTool = gDevTools.once("select-tool-command");
|
||||
let netmonitor = allKeys.filter(({ toolId }) => toolId === "netmonitor")[0];
|
||||
netmonitor.synthesizeKey();
|
||||
keysetMap.netmonitor.synthesizeKey();
|
||||
await onSelectTool;
|
||||
await netmonitorShouldBeSelected();
|
||||
|
||||
if (isMac) {
|
||||
info("The 2nd inspector key (only on Mac) should switch to the inspector again.");
|
||||
onSelectTool = gDevTools.once("select-tool-command");
|
||||
inspectorKeys[1].synthesizeKey();
|
||||
await onSelectTool;
|
||||
await inspectorShouldBeOpenAndHighlighting(inspectorKeys[1]);
|
||||
}
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
async function inspectorShouldBeOpenAndHighlighting(inspector) {
|
||||
async function inspectorShouldBeOpenAndHighlighting() {
|
||||
is(toolbox.currentToolId, "inspector", "Correct tool has been loaded");
|
||||
|
||||
await toolbox.once("picker-started");
|
||||
|
||||
ok(true, "picker-started event received, highlighter started");
|
||||
inspector.synthesizeKey();
|
||||
keysetMap.inspector.synthesizeKey();
|
||||
|
||||
await toolbox.once("picker-stopped");
|
||||
ok(true, "picker-stopped event received, highlighter stopped");
|
||||
|
|
|
@ -154,12 +154,6 @@ inspector.panelLabel=Inspector Panel
|
|||
# Keyboard shortcut for DOM and Style Inspector will be shown inside brackets.
|
||||
inspector.tooltip2=DOM and Style Inspector (%S)
|
||||
|
||||
# LOCALIZATION NOTE (inspector.mac.tooltip)
|
||||
# This is the exact same string as inspector.tooltip2, except that we show it
|
||||
# on mac only, where we support toggling the inspector with either cmd+shift+C,
|
||||
# or cmd+opt+C
|
||||
inspector.mac.tooltip=DOM and Style Inspector (%1$S or %2$S)
|
||||
|
||||
# LOCALIZATION NOTE (netmonitor.label):
|
||||
# This string is displayed in the title of the tab when the Network Monitor is
|
||||
# displayed inside the developer tools window and in the Developer Tools Menu.
|
||||
|
|
|
@ -69,7 +69,7 @@ XPCOMUtils.defineLazyGetter(this, "KeyShortcuts", function() {
|
|||
|
||||
// List of all key shortcuts triggering installation UI
|
||||
// `id` should match tool's id from client/definitions.js
|
||||
let shortcuts = [
|
||||
return [
|
||||
// The following keys are also registered in /client/menus.js
|
||||
// And should be synced.
|
||||
|
||||
|
@ -169,18 +169,6 @@ XPCOMUtils.defineLazyGetter(this, "KeyShortcuts", function() {
|
|||
modifiers
|
||||
},
|
||||
];
|
||||
|
||||
if (isMac) {
|
||||
// Add the extra key command for macOS, so you can open the inspector with cmd+shift+C
|
||||
// like on Chrome DevTools.
|
||||
shortcuts.push({
|
||||
toolId: "inspector",
|
||||
shortcut: KeyShortcutsBundle.GetStringFromName("inspector.commandkey"),
|
||||
modifiers: "accel,shift"
|
||||
});
|
||||
}
|
||||
|
||||
return shortcuts;
|
||||
});
|
||||
|
||||
function DevToolsStartup() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче