Bug 844497 Open Location dialog should not save state when opened from a private window r=IanN a=IanN
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Fri, 05 Apr 2013 21:56:27 +0100
changeset 14971 186f171a3d401b11b4981f9e817e4edd6395c79e
parent 14970 73971e6fef8d05c63e78cb8a77d41bf289a97c58
child 14972 f3408ba1247a6ea767a3d2204242ba58232328d9
push id870
push userneil@parkwaycc.co.uk
push dateFri, 05 Apr 2013 21:17:14 +0000
treeherdercomm-beta@997fbd08ee62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs844497
Bug 844497 Open Location dialog should not save state when opened from a private window r=IanN a=IanN
suite/browser/navigator.js
suite/common/openLocation.js
suite/mailnews/compose/MsgComposeCommands.js
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -1279,17 +1279,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;