Bug 707672 - openUILink[In] behavior should not be determined by browser.tabs.loadBookmarksInBackground. r=mak

--HG--
extra : rebase_source : a4bb56be12da09134fb83c9b6dee6edee4030a54
This commit is contained in:
Dão Gottwald 2011-12-20 01:17:08 +01:00
parent 2fbf5d570b
commit 88dac5f765
5 changed files with 13 additions and 27 deletions

View File

@ -8800,7 +8800,7 @@ function switchToTabHavingURI(aURI, aOpenNew) {
if (isBrowserWindow && isTabEmpty(gBrowser.selectedTab))
gBrowser.selectedBrowser.loadURI(aURI.spec);
else
openUILinkIn(aURI.spec, "tab", { inBackground: false });
openUILinkIn(aURI.spec, "tab");
}
return false;
@ -8910,20 +8910,16 @@ function duplicateTabIn(aTab, where, delta) {
.getService(Ci.nsISessionStore)
.duplicateTab(window, aTab, delta);
var loadInBackground =
getBoolPref("browser.tabs.loadBookmarksInBackground", false);
switch (where) {
case "window":
gBrowser.hideTab(newTab);
gBrowser.replaceTabWithWindow(newTab);
break;
case "tabshifted":
loadInBackground = !loadInBackground;
// fall through
// A background tab has been opened, nothing else to do here.
break;
case "tab":
if (!loadInBackground)
gBrowser.selectedTab = newTab;
gBrowser.selectedTab = newTab;
break;
}
}

View File

@ -35,24 +35,19 @@
* ***** END LICENSE BLOCK ***** */
function test() {
let backgroundPref = "browser.tabs.loadBookmarksInBackground";
let newTab = gBrowser.addTab("http://example.com");
waitForExplicitFinish();
newTab.linkedBrowser.addEventListener("load", mainPart, true);
Services.prefs.setBoolPref(backgroundPref, true);
function mainPart() {
newTab.linkedBrowser.removeEventListener("load", mainPart, true);
gBrowser.pinTab(newTab);
gBrowser.selectedTab = newTab;
openUILinkIn("http://example.org/", "current");
openUILinkIn("http://example.org/", "current", { inBackground: true });
isnot(gBrowser.selectedTab, newTab, "shouldn't load in background");
if (Services.prefs.prefHasUserValue(backgroundPref))
Services.prefs.clearUserPref(backgroundPref);
gBrowser.removeTab(newTab);
gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
finish();

View File

@ -363,8 +363,6 @@
} else {
this.handleRevert();
let params = { allowThirdPartyFixup: true, postData: postData };
if (altEnter)
params.inBackground = false;
if (!this.valueIsTyped)
params.isUTF8 = true;
openUILinkIn(url, where, params);

View File

@ -100,12 +100,7 @@ function openUILink( url, e, ignoreButton, ignoreAlt, allowKeywordFixup, postDat
* Ctrl+Shift new tab, in background
* Alt save
*
* You can swap Ctrl and Ctrl+shift by toggling the hidden pref
* browser.tabs.loadBookmarksInBackground (not browser.tabs.loadInBackground, which
* is for content area links).
*
* Middle-clicking is the same as Ctrl+clicking (it opens a new tab) and it is
* subject to the shift modifier and pref in the same way.
* Middle-clicking is the same as Ctrl+clicking (it opens a new tab).
*
* Exceptions:
* - Alt is ignored for menu items selected using the keyboard so you don't accidentally save stuff.
@ -249,7 +244,7 @@ function openLinkIn(url, where, params) {
let loadInBackground = aInBackground;
if (loadInBackground == null) {
loadInBackground = aFromChrome ?
getBoolPref("browser.tabs.loadBookmarksInBackground") :
false :
getBoolPref("browser.tabs.loadInBackground");
}

View File

@ -729,7 +729,9 @@ var PlacesUIUtils = {
}
}
}
aWindow.openUILinkIn(aNode.uri, aWhere);
aWindow.openUILinkIn(aNode.uri, aWhere, {
inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground")
});
}
},