Bug 266985 - Obey middlemouse.openNewWindow preference r=dao

Differential Revision: https://phabricator.services.mozilla.com/D70267

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sander Van de Moortel 2020-04-09 15:52:29 +00:00
parent f9abd62b34
commit e948520730

View File

@ -223,11 +223,15 @@ function whereToOpenLink(e, ignoreButton, ignoreAlt) {
var alt = e.altKey && !ignoreAlt;
// ignoreButton allows "middle-click paste" to use function without always opening in a new window.
var middle = !ignoreButton && e.button == 1;
var middleUsesTabs = Services.prefs.getBoolPref(
let middle = !ignoreButton && e.button == 1;
let middleUsesTabs = Services.prefs.getBoolPref(
"browser.tabs.opentabfor.middleclick",
true
);
let middleUsesNewWindow = Services.prefs.getBoolPref(
"middlemouse.openNewWindow",
false
);
// Don't do anything special with right-mouse clicks. They're probably clicks on context menu items.
@ -240,7 +244,7 @@ function whereToOpenLink(e, ignoreButton, ignoreAlt) {
return "save";
}
if (shift || (middle && !middleUsesTabs)) {
if (shift || (middle && !middleUsesTabs && middleUsesNewWindow)) {
return "window";
}