diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js
index f48aea85183a..ebe3c4d584f2 100755
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1327,6 +1327,56 @@ var PlacesController = {
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=331908
*/
openLinksInTabs: function PC_openLinksInTabs() {
+ var pref =
+ Components.classes["@mozilla.org/preferences-service;1"].
+ getService(Components.interfaces.nsIPrefBranch);
+
+ const kWarnOnOpenPref = "browser.tabs.warnOnOpen";
+ if (pref.getBoolPref(kWarnOnOpenPref))
+ {
+ var reallyOpen = true;
+
+ // determine how many tabs we are attempting to open
+ var node = this._activeView.selectedNode;
+ asFolder(node);
+ var wasOpen = node.containerOpen;
+ node.containerOpen = true;
+ var tabsToOpen = node.childCount;
+ node.containerOpen = wasOpen;
+
+ if (tabsToOpen >= pref.getIntPref("browser.tabs.maxOpenBeforeWarn"))
+ {
+ var promptService =
+ Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
+ getService(Components.interfaces.nsIPromptService);
+
+ // default to true: if it were false, we wouldn't get this far
+ var warnOnOpen = { value: true };
+
+ var messageKey = "tabs.openWarningMultiple";
+ var openKey = "tabs.openButtonMultiple";
+ var strings = document.getElementById("placeBundle");
+
+ var buttonPressed = promptService.confirmEx(window,
+ strings.getString("tabs.openWarningTitle"),
+ strings.getFormattedString(messageKey, [tabsToOpen]),
+ (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0)
+ + (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
+ strings.getString(openKey),
+ null, null,
+ strings.getString("tabs.openWarningPromptMe"),
+ warnOnOpen);
+
+ reallyOpen = (buttonPressed == 0);
+ // don't set the pref unless they press OK and it's false
+ if (reallyOpen && !warnOnOpen.value)
+ pref.setBoolPref(kWarnOnOpen, false);
+ }
+
+ if (!reallyOpen)
+ return;
+ }
+
var node = this._activeView.selectedNode;
if (this._activeView.hasSingleSelection && this.nodeIsFolder(node)) {
// Check prefs to see whether to open over existing tabs.
diff --git a/browser/components/preferences/tabs.xul b/browser/components/preferences/tabs.xul
index 7144d3eb3f16..099a09aa84fb 100644
--- a/browser/components/preferences/tabs.xul
+++ b/browser/components/preferences/tabs.xul
@@ -55,6 +55,7 @@
+
@@ -79,6 +80,9 @@
+
diff --git a/browser/locales/en-US/chrome/browser/places/places.properties b/browser/locales/en-US/chrome/browser/places/places.properties
index b19c60cb28d6..eb6c359a9b14 100644
--- a/browser/locales/en-US/chrome/browser/places/places.properties
+++ b/browser/locales/en-US/chrome/browser/places/places.properties
@@ -63,3 +63,8 @@ sortByPrefix=Sort by %S
searchDefault=Search in Bookmarks & History
searchCurrentDefault=Search in '%S'
findInPrefix=Find in '%S'...
+
+tabs.openWarningTitle=Confirm open
+tabs.openWarningMultiple=You have asked to open %S tabs at once. This might slow down your system while the pages are loading.
+tabs.openButtonMultiple=Open tabs
+tabs.openWarningPromptMe=Warn me when I attempt to open a lot of tabs at once
diff --git a/browser/locales/en-US/chrome/browser/preferences/tabs.dtd b/browser/locales/en-US/chrome/browser/preferences/tabs.dtd
index 4349472a6f07..9c1456a26ba2 100644
--- a/browser/locales/en-US/chrome/browser/preferences/tabs.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/tabs.dtd
@@ -11,5 +11,9 @@
+
+
+
+
diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
index 5376445b37b6..62445a739a74 100644
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -153,6 +153,8 @@ pref("browser.tabs.autoHide", true);
pref("browser.tabs.forceHide", false);
pref("browser.tabs.warnOnClose", true);
pref("browser.tabs.warnOnCloseOther", true);
+pref("browser.tabs.warnOnOpen", true);
+pref("browser.tabs.maxOpenBeforeWarn", 15);
// 0 = append, 1 = replace
pref("browser.tabs.loadGroup", 1);