зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445776 - Add development restart shortcut to Browser Console. r=bgrins
Adds the browser restart shortcut (Cmd / Ctrl + Alt + R) to the Browser Console window. Only enabled for local development builds. MozReview-Commit-ID: 2oTT55TYCx6 --HG-- extra : rebase_source : a9864af63590c803a412959bf922c87859455448
This commit is contained in:
Родитель
0b084ac6c6
Коммит
5af4bc7b50
|
@ -135,8 +135,16 @@ KeyShortcuts.parseElectronKey = function(window, str) {
|
|||
}
|
||||
|
||||
if (typeof key === "string" && key.length === 1) {
|
||||
// Match any single character
|
||||
shortcut.key = key.toLowerCase();
|
||||
if (shortcut.alt) {
|
||||
// When Alt is involved, some platforms (macOS) give different printable characters
|
||||
// for the `key` value, like `®` for the key `R`. In this case, prefer matching by
|
||||
// `keyCode` instead.
|
||||
shortcut.keyCode = KeyCodes[`DOM_VK_${key.toUpperCase()}`];
|
||||
shortcut.keyCodeString = key;
|
||||
} else {
|
||||
// Match any single character
|
||||
shortcut.key = key.toLowerCase();
|
||||
}
|
||||
} else if (key in ElectronKeysMapping) {
|
||||
// Maps the others manually to DOM API DOM_VK_*
|
||||
key = ElectronKeysMapping[key];
|
||||
|
|
|
@ -253,6 +253,16 @@ NewWebConsoleFrame.prototype = {
|
|||
this.window.top.close.bind(this.window.top));
|
||||
|
||||
ZoomKeys.register(this.window);
|
||||
|
||||
if (!system.constants.MOZILLA_OFFICIAL) {
|
||||
// In local builds, inject the "quick restart" shortcut.
|
||||
// This script expects to have Services on the global and we haven't yet imported
|
||||
// it into the window, so assign it.
|
||||
this.window.Services = Services;
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://browser/content/browser-development-helpers.js", this.window);
|
||||
shortcuts.on("CmdOrCtrl+Alt+R", this.window.DevelopmentHelpers.quickRestart);
|
||||
}
|
||||
} else if (Services.prefs.getBoolPref(PREF_SIDEBAR_ENABLED)) {
|
||||
shortcuts.on("Esc", event => {
|
||||
if (!this.jsterm.autocompletePopup || !this.jsterm.autocompletePopup.isOpen) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче