Bug 1455326 - Don't open search in new tab if current tab is blank. r?adw
MozReview-Commit-ID: BqjoKZ3H7Yq
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -276,18 +276,20 @@
return;
where = whereToOpenLink(aEvent, false, true);
} else if (aForceNewTab) {
where = "tab";
if (Services.prefs.getBoolPref("browser.tabs.loadInBackground"))
where += "-background";
} else {
var newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
- if (((aEvent instanceof KeyboardEvent) && aEvent.altKey) ^ newTabPref)
+ if (((aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref) &&
+ !isTabEmpty(gBrowser.selectedTab)) {
where = "tab";
+ }
if ((aEvent instanceof MouseEvent) &&
(aEvent.button == 1 || aEvent.getModifierState("Accel"))) {
where = "tab";
params = {
inBackground: true,
};
}
}
@@ -1778,18 +1780,20 @@
where = "tab";
if (Services.prefs.getBoolPref("browser.tabs.loadInBackground")) {
params = {
inBackground: true,
};
}
} else {
var newTabPref = Services.prefs.getBoolPref("browser.search.openintab");
- if (((aEvent instanceof KeyboardEvent) && aEvent.altKey) ^ newTabPref)
+ if (((aEvent instanceof KeyboardEvent && aEvent.altKey) ^ newTabPref) &&
+ !isTabEmpty(gBrowser.selectedTab)) {
where = "tab";
+ }
if ((aEvent instanceof MouseEvent) &&
(aEvent.button == 1 || aEvent.getModifierState("Accel"))) {
where = "tab";
params = {
inBackground: true,
};
}
}