Bug 722986 - Make WebContentConverter use the per-window Private Browsing APIs in order to decide how to behave; r=ehsan
authorHessam Salehi <hessamms@gmail.com>
Mon, 16 Apr 2012 23:51:04 -0400
changeset 91808 d0988a66f47ad9bdd0939ec15cd02d6f74b550b5
parent 91807 793b37be195339d2a4dca519fcbc2ccd3d84f34c
child 91809 6b33a2960e6858c253963fcd514be90085bf6d0e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs722986
milestone14.0a1
Bug 722986 - Make WebContentConverter use the per-window Private Browsing APIs in order to decide how to behave; r=ehsan
browser/components/feeds/src/WebContentConverter.js
--- a/browser/components/feeds/src/WebContentConverter.js
+++ b/browser/components/feeds/src/WebContentConverter.js
@@ -396,19 +396,18 @@ WebContentConverterRegistrar.prototype =
 
   /**
    * See nsIWebContentHandlerRegistrar
    */
   registerProtocolHandler: 
   function WCCR_registerProtocolHandler(aProtocol, aURIString, aTitle, aContentWindow) {
     LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
 
-    if (Cc["@mozilla.org/privatebrowsing;1"].
-        getService(Ci.nsIPrivateBrowsingService).
-        privateBrowsingEnabled) {
+    var browserWindow = this._getBrowserWindowForContentWindow(aContentWindow);    
+    if (browserWindow.gPrivateBrowsingUI.privateWindow) {
       // Inside the private browsing mode, we don't want to alert the user to save
       // a protocol handler.  We log it to the error console so that web developers
       // would have some way to tell what's going wrong.
       Cc["@mozilla.org/consoleservice;1"].
       getService(Ci.nsIConsoleService).
       logStringMessage("Web page denied access to register a protocol handler inside private browsing mode");
       return;
     }
@@ -483,17 +482,17 @@ WebContentConverterRegistrar.prototype =
           var hs = Cc["@mozilla.org/uriloader/handler-service;1"].
                    getService(Ci.nsIHandlerService);
           hs.store(handlerInfo);
         }
       };
       buttons = [addButton];
     }
 
-    var browserWindow = this._getBrowserWindowForContentWindow(aContentWindow);
+
     var browserElement = this._getBrowserForContentWindow(browserWindow, aContentWindow);
     var notificationBox = browserWindow.getBrowser().getNotificationBox(browserElement);
     notificationBox.appendNotification(message,
                                        notificationValue,
                                        notificationIcon,
                                        notificationBox.PRIORITY_INFO_LOW,
                                        buttons);
   },