Bug 799314 - Add utility method to get a privacy context from a window. r=ehsan a=lsblakk
authorJosh Matthews <josh@joshmatthews.net>
Thu, 25 Oct 2012 14:17:35 -0400
changeset 109690 8c3b288ab1be6d111609008d66844718fa83e478
parent 109689 a2cc1ba868179ec39e91b1ce4035437e6f2add66
child 109691 b14b009ce8aa7e41171a969d0c310cd69662d00f
push id1616
push usereakhgari@mozilla.com
push dateFri, 26 Oct 2012 19:46:58 +0000
treeherdermozilla-beta@8c3b288ab1be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, lsblakk
bugs799314
milestone17.0
Bug 799314 - Add utility method to get a privacy context from a window. r=ehsan a=lsblakk
toolkit/content/PrivateBrowsingUtils.jsm
--- a/toolkit/content/PrivateBrowsingUtils.jsm
+++ b/toolkit/content/PrivateBrowsingUtils.jsm
@@ -3,14 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var EXPORTED_SYMBOLS = ["PrivateBrowsingUtils"];
 
 const Ci = Components.interfaces;
 
 var PrivateBrowsingUtils = {
   isWindowPrivate: function pbu_isWindowPrivate(aWindow) {
+    return this.privacyContextFromWindow(aWindow).usePrivateBrowsing;
+  },
+
+  privacyContextFromWindow: function pbu_privacyContextFromWindow(aWindow) {
     return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                   .getInterface(Ci.nsIWebNavigation)
-                  .QueryInterface(Ci.nsILoadContext)
-                  .usePrivateBrowsing;
+                  .QueryInterface(Ci.nsILoadContext);
   }
 };