diff --git a/toolkit/content/Makefile.in b/toolkit/content/Makefile.in index 40086389855b..b4e9949e884c 100644 --- a/toolkit/content/Makefile.in +++ b/toolkit/content/Makefile.in @@ -62,6 +62,7 @@ EXTRA_JS_MODULES = \ PopupNotifications.jsm \ Dict.jsm \ PropertyListUtils.jsm \ + PrivateBrowsingUtils.jsm \ $(NULL) EXTRA_PP_JS_MODULES = \ diff --git a/toolkit/content/PrivateBrowsingUtils.jsm b/toolkit/content/PrivateBrowsingUtils.jsm new file mode 100644 index 000000000000..63adf3a5c97f --- /dev/null +++ b/toolkit/content/PrivateBrowsingUtils.jsm @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * 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 aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsILoadContext) + .usePrivateBrowsing; + } +};