Bug 844497 Open Location dialog should not save state when opened from a private window r=IanN
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 24 Feb 2013 00:27:24 +0000
changeset 15037 5eaf09f06d3adbba549d4350a1050d9230e7d8a8
parent 15036 97ec0b9859f156ebeae3a95a7edb5b86db85a1ea
child 15038 1095b29486f0a5dd71476cb891fbb6fcb30ed46a
push id898
push userbugzilla@standard8.plus.com
push dateMon, 13 May 2013 17:03:31 +0000
treeherdercomm-beta@3106694b14de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs844497
Bug 844497 Open Location dialog should not save state when opened from a private window r=IanN
suite/browser/navigator.js
suite/common/openLocation.js
suite/mailnews/compose/MsgComposeCommands.js
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -1278,17 +1278,17 @@ function QualifySearchTerm()
   return "";
 }
 
 //Note: BrowserNewEditorWindow() was moved to globalOverlay.xul and renamed to NewEditorWindow()
 
 function BrowserOpenWindow()
 {
   //opens a window where users can select a web location to open
-  var params = { action: "0", url: "" };
+  var params = { action: gPrivate ? "4" : "0", url: "" };
   openDialog("chrome://communicator/content/openLocation.xul", "_blank", "chrome,modal,titlebar", params);
   var postData = { };
   var url = getShortcutOrURI(params.url, postData);
   switch (params.action) {
     case "0": // current window
       loadURI(url, null, postData.value, true);
       break;
     case "1": // new window
--- a/suite/common/openLocation.js
+++ b/suite/common/openLocation.js
@@ -17,17 +17,17 @@ function onLoad()
   gAcceptButton = document.documentElement.getButton("accept");
   gOpenAppList = document.getElementById("openAppList");
   gBundle = document.getElementById("openLocationBundle");
   gAction = window.arguments[0].action;
   // Set arguments action to prevent problems on cancel.
   window.arguments[0].action = "-1";
 
   switch (gAction) {
-    case "4": // attach web page
+    case "5": // attach web page
       document.title = gBundle.getString("attachTitle");
       document.getElementById("enterLabel").value = gBundle.getString("attachEnterLabel");
       document.getElementById("openWhereBox").setAttribute("hidden", true);
 
       // Change accept button text to 'attach'.
       gAcceptButton.label = gBundle.getString("attachButtonLabel");
       gLastPref = "mailnews.attach_web_page.last_url";
 
@@ -66,20 +66,20 @@ function doEnabling()
   gAcceptButton.disabled = !gInput.value;
 }
 
 function accept()
 {
   var params = window.arguments[0];
   params.url = gInput.value;
   params.action = gOpenAppList.value;
-  if (params.action == "4")
+  if (gAction == "4" || params.action == "4")
     return; // private, don't set any preferences
 
-  if (gAction != "4") { // open web page
+  if (gAction != "5") { // open web page
     // If there were no browser windows open and not set to open in composer
     // then set to open in a new window.
     if (gAction == "-1" && params.action != "2")
       params.action = "1";
 
     // If open web page from navigator window, save last window choice.
     if (gAction == "0")
       Services.prefs.setIntPref("general.open_location.last_window_choice",
@@ -90,17 +90,17 @@ function accept()
 }
 
 function onChooseFile()
 {
   const nsIFilePicker = Components.interfaces.nsIFilePicker;
   try {
     var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
     fp.init(window, gBundle.getString("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
-    if (window.arguments[0].action != "4" && gOpenAppList.value == "2") {
+    if (window.arguments[0].action != "5" && gOpenAppList.value == "2") {
       // When loading into Composer, direct user to prefer HTML files and text
       // files, so we call separately to control the order of the filter list.
       fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText);
       fp.appendFilters(nsIFilePicker.filterAll);
     }
     else {
       fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
                        nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -2573,17 +2573,17 @@ function MessageHasAttachments()
 function MessageGetNumSelectedAttachments()
 {
   var bucketList = GetMsgAttachmentElement();
   return (bucketList) ? bucketList.selectedItems.length : 0;
 }
 
 function AttachPage()
 {
-  var params = { action: "4", url: null };
+  var params = { action: "5", url: null };
   window.openDialog("chrome://communicator/content/openLocation.xul",
                     "_blank", "chrome,close,titlebar,modal", params);
   if (params.url)
   {
     var attachment =
         Components.classes["@mozilla.org/messengercompose/attachment;1"]
                   .createInstance(Components.interfaces.nsIMsgAttachment);
     attachment.url = params.url;