Bug 798965 - Avoid using gPrivateBrowsingUI.privateBrowsingEnabled in browser.js and use the per-window PB API instead; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 07 Oct 2012 17:47:10 -0400
changeset 109685 fa5fa35e15df7e67f5f6ae9cf0a50ffffd226067
parent 109684 479174108809b512f3e849c9e388dee4d5c69056
child 109686 957abd0620e113d21470d58a38d36ba93d37aaf7
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjdm
bugs798965
milestone18.0a1
Bug 798965 - Avoid using gPrivateBrowsingUI.privateBrowsingEnabled in browser.js and use the per-window PB API instead; r=jdm
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -516,17 +516,17 @@ var gPopupBlockerObserver = {
         blockedPopupAllowSite.setAttribute("label", allowString);
         blockedPopupAllowSite.removeAttribute("block");
       }
     }
     catch (e) {
       blockedPopupAllowSite.setAttribute("hidden", "true");
     }
 
-    if (gPrivateBrowsingUI.privateBrowsingEnabled)
+    if (PrivateBrowsingUtils.isWindowPrivate(window))
       blockedPopupAllowSite.setAttribute("disabled", "true");
     else
       blockedPopupAllowSite.removeAttribute("disabled");
 
     var foundUsablePopupURI = false;
     var pageReports = gBrowser.pageReport;
     if (pageReports) {
       for (let pageReport of pageReports) {
@@ -2059,17 +2059,17 @@ var gLastOpenDirectory = {
       if (!val || !val.isDirectory())
         return;
     } catch(e) {
       return;
     }
     this._lastDir = val.clone();
 
     // Don't save the last open directory pref inside the Private Browsing mode
-    if (!gPrivateBrowsingUI.privateBrowsingEnabled)
+    if (!PrivateBrowsingUtils.isWindowPrivate(window))
       gPrefService.setComplexValue("browser.open.lastDir", Ci.nsILocalFile,
                                    this._lastDir);
   },
   reset: function() {
     this._lastDir = null;
   }
 };
 
@@ -3230,17 +3230,17 @@ const DOMLinkHandler = {
           break;
         case "search":
           if (!searchAdded) {
             var type = link.type && link.type.toLowerCase();
             type = type.replace(/^\s+|\s*(?:;.*)?$/g, "");
 
             if (type == "application/opensearchdescription+xml" && link.title &&
                 /^(?:https?|ftp):/i.test(link.href) &&
-                !gPrivateBrowsingUI.privateBrowsingEnabled) {
+                !PrivateBrowsingUtils.isWindowPrivate(window)) {
               var engine = { title: link.title, href: link.href };
               BrowserSearch.addEngine(engine, link.ownerDocument);
               searchAdded = true;
             }
           }
           break;
       }
     }