Bug 1521596 expose private browsing flag in nsIRemoteWindowContext r=kmag
authorShane Caraveo <scaraveo@mozilla.com>
Wed, 27 Feb 2019 01:46:07 +0000
changeset 519277 57545823008093781ee9812e3feb4afe4a5f0893
parent 519276 d954c8365626fc7dac127fd9c464f1008b9b06ba
child 519278 91f7275e170c6f8c6d5b6f6934ebc900d48205ad
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1521596
milestone67.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 1521596 expose private browsing flag in nsIRemoteWindowContext r=kmag Differential Revision: https://phabricator.services.mozilla.com/D20872
dom/base/nsIRemoteWindowContext.idl
dom/ipc/ContentParent.cpp
--- a/dom/base/nsIRemoteWindowContext.idl
+++ b/dom/base/nsIRemoteWindowContext.idl
@@ -6,10 +6,15 @@
 
 #include "nsISupports.idl"
 
 interface nsIURI;
 
 [scriptable, builtinclass, uuid(94f4a92b-752e-4fd9-8345-11b069ca19f3)]
 interface nsIRemoteWindowContext : nsISupports
 {
+  /*
+   * Determines if the window is in private browsing.
+   */
+  readonly attribute boolean usePrivateBrowsing;
+
   void openURI(in nsIURI aURI);
 };
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1299,16 +1299,23 @@ RemoteWindowContext::GetInterface(const 
 }
 
 NS_IMETHODIMP
 RemoteWindowContext::OpenURI(nsIURI* aURI) {
   mTabParent->LoadURL(aURI);
   return NS_OK;
 }
 
+NS_IMETHODIMP
+RemoteWindowContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
+  nsCOMPtr<nsILoadContext> loadContext = mTabParent->GetLoadContext();
+  *aUsePrivateBrowsing = loadContext && loadContext->UsePrivateBrowsing();
+  return NS_OK;
+}
+
 }  // namespace
 
 void ContentParent::ShutDownProcess(ShutDownMethod aMethod) {
   if (mScriptableHelper) {
     static_cast<ScriptableCPInfo*>(mScriptableHelper.get())->ProcessDied();
     mScriptableHelper = nullptr;
   }