зеркало из https://github.com/mozilla/gecko-dev.git
Bug 658245 - Part 1: pref to open bookmark in a new tab. r=mak
MozReview-Commit-ID: A8nhmBjbNGh --HG-- extra : rebase_source : 53d3c57bf6e894b46e99163b951d521191439363
This commit is contained in:
Родитель
f9ecfce269
Коммит
d506417ae0
|
@ -460,6 +460,7 @@ pref("browser.tabs.loadInBackground", true);
|
||||||
pref("browser.tabs.opentabfor.middleclick", true);
|
pref("browser.tabs.opentabfor.middleclick", true);
|
||||||
pref("browser.tabs.loadDivertedInBackground", false);
|
pref("browser.tabs.loadDivertedInBackground", false);
|
||||||
pref("browser.tabs.loadBookmarksInBackground", false);
|
pref("browser.tabs.loadBookmarksInBackground", false);
|
||||||
|
pref("browser.tabs.loadBookmarksInTabs", false);
|
||||||
pref("browser.tabs.tabClipWidth", 140);
|
pref("browser.tabs.tabClipWidth", 140);
|
||||||
#ifdef UNIX_BUT_NOT_MAC
|
#ifdef UNIX_BUT_NOT_MAC
|
||||||
pref("browser.tabs.drawInTitlebar", false);
|
pref("browser.tabs.drawInTitlebar", false);
|
||||||
|
|
|
@ -40,6 +40,8 @@ let gFaviconLoadDataMap = new Map();
|
||||||
|
|
||||||
// copied from utilityOverlay.js
|
// copied from utilityOverlay.js
|
||||||
const TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
|
const TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
|
||||||
|
const PREF_LOAD_BOOKMARKS_IN_BACKGROUND = "browser.tabs.loadBookmarksInBackground";
|
||||||
|
const PREF_LOAD_BOOKMARKS_IN_TABS = "browser.tabs.loadBookmarksInTabs";
|
||||||
|
|
||||||
// This function isn't public both because it's synchronous and because it is
|
// This function isn't public both because it's synchronous and because it is
|
||||||
// going to be removed in bug 1072833.
|
// going to be removed in bug 1072833.
|
||||||
|
@ -1018,7 +1020,14 @@ this.PlacesUIUtils = {
|
||||||
openNodeWithEvent:
|
openNodeWithEvent:
|
||||||
function PUIU_openNodeWithEvent(aNode, aEvent) {
|
function PUIU_openNodeWithEvent(aNode, aEvent) {
|
||||||
let window = aEvent.target.ownerGlobal;
|
let window = aEvent.target.ownerGlobal;
|
||||||
this._openNodeIn(aNode, window.whereToOpenLink(aEvent, false, true), window);
|
|
||||||
|
let where = window.whereToOpenLink(aEvent, false, true);
|
||||||
|
if (where == "current" && this.loadBookmarksInTabs &&
|
||||||
|
PlacesUtils.nodeIsBookmark(aNode) && !aNode.uri.startsWith("javascript:")) {
|
||||||
|
where = "tab";
|
||||||
|
}
|
||||||
|
|
||||||
|
this._openNodeIn(aNode, where, window);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1031,7 +1040,7 @@ this.PlacesUIUtils = {
|
||||||
this._openNodeIn(aNode, aWhere, window, aPrivate);
|
this._openNodeIn(aNode, aWhere, window, aPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
_openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aWindow, aPrivate = false) {
|
_openNodeIn: function PUIU__openNodeIn(aNode, aWhere, aWindow, aPrivate = false) {
|
||||||
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
|
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
|
||||||
this.checkURLSecurity(aNode, aWindow)) {
|
this.checkURLSecurity(aNode, aWindow)) {
|
||||||
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
|
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
|
||||||
|
@ -1058,7 +1067,7 @@ this.PlacesUIUtils = {
|
||||||
|
|
||||||
aWindow.openUILinkIn(aNode.uri, aWhere, {
|
aWindow.openUILinkIn(aNode.uri, aWhere, {
|
||||||
allowPopups: aNode.uri.startsWith("javascript:"),
|
allowPopups: aNode.uri.startsWith("javascript:"),
|
||||||
inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
|
inBackground: this.loadBookmarksInBackground,
|
||||||
private: aPrivate,
|
private: aPrivate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1525,6 +1534,11 @@ XPCOMUtils.defineLazyGetter(PlacesUIUtils, "useAsyncTransactions", function() {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyPreferenceGetter(PlacesUIUtils, "loadBookmarksInBackground",
|
||||||
|
PREF_LOAD_BOOKMARKS_IN_BACKGROUND, false);
|
||||||
|
XPCOMUtils.defineLazyPreferenceGetter(PlacesUIUtils, "loadBookmarksInTabs",
|
||||||
|
PREF_LOAD_BOOKMARKS_IN_TABS, false);
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "URIFixup",
|
XPCOMUtils.defineLazyServiceGetter(this, "URIFixup",
|
||||||
"@mozilla.org/docshell/urifixup;1",
|
"@mozilla.org/docshell/urifixup;1",
|
||||||
"nsIURIFixup");
|
"nsIURIFixup");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче