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 109679 fa5fa35e15df7e67f5f6ae9cf0a50ffffd226067
parent 109678 479174108809b512f3e849c9e388dee4d5c69056
child 109680 957abd0620e113d21470d58a38d36ba93d37aaf7
push id16129
push usereakhgari@mozilla.com
push dateMon, 08 Oct 2012 15:18:44 +0000
treeherdermozilla-inbound@957abd0620e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs798965
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;
       }
     }