Bug 1296863 - Stop disabling the "New Tab" command in popups. r=gijs

This commit is contained in:
Dão Gottwald 2016-08-22 18:06:04 +02:00
Родитель 3bdd9bbad2
Коммит 48a7a69310
3 изменённых файлов: 5 добавлений и 12 удалений

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

@ -196,7 +196,7 @@
key="&newNavigatorCmd.key;"
command="cmd_newNavigator"
modifiers="accel"/>
<key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel" command="cmd_newNavigatorTab"/>
<key id="key_newNavigatorTab" key="&tabCmd.commandkey;" modifiers="accel" oncommand="BrowserOpenTab();"/>
<key id="focusURLBar" key="&openCmd.commandkey;" command="Browser:OpenLocation"
modifiers="accel"/>
#ifndef XP_MACOSX

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

@ -979,7 +979,6 @@ var gBrowserInit = {
// adjust browser UI for popups
gURLBar.setAttribute("readonly", "true");
gURLBar.setAttribute("enablehistory", "false");
goSetCommandEnabled("cmd_newNavigatorTab", false);
}
// Misc. inits.
@ -1901,16 +1900,8 @@ function BrowserOpenTab(event) {
case "tab":
case "tabshifted":
// When accel-click or middle-click are used, open the new tab as
// related to the current tab. We need to exclude key events here,
// where the accel key is required for the shortcut.
// 'event' and its sourceEvent are command events, the latter of which
// doesn't have its own sourceEvent. These events don't indicate how
// they were invoked, except that the sourceEvent for keyboard
// shortcuts have <key> targets, and those for clicking a toolbar
// button or activating a menu item have that button or menuitem as
// their target.
relatedToCurrent = !event.sourceEvent ||
event.sourceEvent.target.localName != "key";
// related to the current tab.
relatedToCurrent = true;
break;
case "current":
where = "tab";

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

@ -44,6 +44,8 @@ function testPopupUI(win) {
EventUtils.synthesizeKey("t", { accelKey: true }, win);
is(win.gBrowser.browsers.length, 1, "Accel+T doesn't open a new tab in the popup");
is(gBrowser.browsers.length, 2, "Accel+T opened a new tab in the parent window");
gBrowser.removeCurrentTab();
EventUtils.synthesizeKey("w", { accelKey: true }, win);
ok(win.closed, "Accel+W closes the popup");