Bug 1579735 - Let PB windows be identified by backend and themes. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Tue, 01 Oct 2019 16:39:56 +0200
changeset 37040 549e605f5eabe363f4437084af0a81124647e664
parent 37039 57752d5ccb8168d9e4eae4cf723df07ffbbc8f91
child 37041 1b84ea4d5b17f664644d712cb9c8fb5140bb9849
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersfrg
bugs1579735
Bug 1579735 - Let PB windows be identified by backend and themes. r=frg
suite/base/content/tasksOverlay.js
suite/browser/navigator.js
--- a/suite/base/content/tasksOverlay.js
+++ b/suite/base/content/tasksOverlay.js
@@ -139,25 +139,25 @@ function OpenBrowserWindow()
   if (document.documentElement.getAttribute("windowtype") ==
       "navigator:browser" && window.content && window.content.document)
   {
     // if and only if the current window is a browser window and
     // it has a document with a character set, then extract the
     // current charset menu setting from the current document
     // and use it to initialize the new browser window
     return window.openDialog(getBrowserURL(), "_blank",
-                             "chrome,all,dialog=no", null,
+                             "chrome,all,dialog=no,non-private", null,
                              "charset=" + window.content.document.characterSet);
   }
 
   if (win) {
     // if a browser window already exists then set startpage to null so
     // navigator.js can check pref for how new window should be opened
     return win.openDialog(getBrowserURL(), "_blank",
-                          "chrome,all,dialog=no", null);
+                          "chrome,all,dialog=no,non-private", null);
   }
 
   // open the first browser window as if we were starting up
   var cmdLine = {
     handleFlagWithParam: function handleFlagWithParam(flag, caseSensitive) {
       return flag == "remote" ? "xfeDoCommand(openBrowser)" : null;
     },
     handleFlag: function handleFlag(flag, caseSensitive) {
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -816,23 +816,25 @@ function Startup()
   // set home button tooltip text
   updateHomeButtonTooltip();
 
   var lc = window.QueryInterface(Ci.nsIInterfaceRequestor)
                  .getInterface(Ci.nsIWebNavigation)
                  .QueryInterface(Ci.nsILoadContext);
   if (lc.usePrivateBrowsing) {
     gPrivate = window;
-    document.documentElement.removeAttribute("windowtype");
-    var titlemodifier = document.documentElement.getAttribute("titlemodifier");
+    let docElement = document.documentElement;
+    var titlemodifier = docElement.getAttribute("titlemodifier");
     if (titlemodifier)
       titlemodifier += " ";
-    titlemodifier += document.documentElement.getAttribute("titleprivate");
-    document.documentElement.setAttribute("titlemodifier", titlemodifier);
+    titlemodifier += docElement.getAttribute("titleprivate");
+    docElement.setAttribute("titlemodifier", titlemodifier);
     document.title = titlemodifier;
+    docElement.setAttribute("privatebrowsingmode",
+      PrivateBrowsingUtils.permanentPrivateBrowsing ? "permanent" : "temporary");
   }
 
   // initialize observers and listeners
   var xw = lc.QueryInterface(Ci.nsIDocShellTreeItem)
              .treeOwner
              .QueryInterface(Ci.nsIInterfaceRequestor)
              .getInterface(Ci.nsIXULWindow);
   xw.XULBrowserWindow = window.XULBrowserWindow = new nsBrowserStatusHandler();