Bug 1276328 - Remove private browsing flags r=baku
authorJames Andreou <jandreou25@gmail.com>
Tue, 07 Jun 2016 13:50:00 +0200
changeset 301209 52d483132bc13e66f739de21885168f1a8f1b20c
parent 301208 d922a8d7ed26353247f04ef490b2827b0587b32b
child 301210 37ba135cae82c169c0567b6dec6e844c52694e35
push id78252
push usercbook@mozilla.com
push dateThu, 09 Jun 2016 04:27:51 +0000
treeherdermozilla-inbound@52d483132bc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1276328
milestone50.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 1276328 - Remove private browsing flags r=baku
dom/broadcastchannel/BroadcastChannel.cpp
dom/broadcastchannel/BroadcastChannel.h
ipc/glue/BackgroundChildImpl.cpp
ipc/glue/BackgroundChildImpl.h
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/BackgroundParentImpl.h
ipc/glue/PBackground.ipdl
--- a/dom/broadcastchannel/BroadcastChannel.cpp
+++ b/dom/broadcastchannel/BroadcastChannel.cpp
@@ -66,24 +66,22 @@ GetPrincipalFromWorkerPrivate(WorkerPriv
 
   return wp->GetPrincipal();
 }
 
 class InitializeRunnable final : public WorkerMainThreadRunnable
 {
 public:
   InitializeRunnable(WorkerPrivate* aWorkerPrivate, nsACString& aOrigin,
-                     PrincipalInfo& aPrincipalInfo, bool& aPrivateBrowsing,
-                     ErrorResult& aRv)
+                     PrincipalInfo& aPrincipalInfo, ErrorResult& aRv)
     : WorkerMainThreadRunnable(aWorkerPrivate,
                                NS_LITERAL_CSTRING("BroadcastChannel :: Initialize"))
     , mWorkerPrivate(GetCurrentThreadWorkerPrivate())
     , mOrigin(aOrigin)
     , mPrincipalInfo(aPrincipalInfo)
-    , mPrivateBrowsing(aPrivateBrowsing)
     , mRv(aRv)
   {
     MOZ_ASSERT(mWorkerPrivate);
   }
 
   bool MainThreadRun() override
   {
     MOZ_ASSERT(NS_IsMainThread());
@@ -122,29 +120,23 @@ public:
     }
 
     // Window doesn't exist for some kind of workers (eg: SharedWorkers)
     nsPIDOMWindowInner* window = wp->GetWindow();
     if (!window) {
       return true;
     }
 
-    nsIDocument* doc = window->GetExtantDoc();
-    if (doc) {
-      mPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);
-    }
-
     return true;
   }
 
 private:
   WorkerPrivate* mWorkerPrivate;
   nsACString& mOrigin;
   PrincipalInfo& mPrincipalInfo;
-  bool& mPrivateBrowsing;
   ErrorResult& mRv;
 };
 
 class BCPostMessageRunnable final : public nsIRunnable,
                                     public nsICancelableRunnable
 {
 public:
   NS_DECL_ISUPPORTS
@@ -301,24 +293,22 @@ private:
   }
 };
 
 } // namespace
 
 BroadcastChannel::BroadcastChannel(nsPIDOMWindowInner* aWindow,
                                    const PrincipalInfo& aPrincipalInfo,
                                    const nsACString& aOrigin,
-                                   const nsAString& aChannel,
-                                   bool aPrivateBrowsing)
+                                   const nsAString& aChannel)
   : DOMEventTargetHelper(aWindow)
   , mWorkerFeature(nullptr)
   , mPrincipalInfo(new PrincipalInfo(aPrincipalInfo))
   , mOrigin(aOrigin)
   , mChannel(aChannel)
-  , mPrivateBrowsing(aPrivateBrowsing)
   , mIsKeptAlive(false)
   , mInnerID(0)
   , mState(StateActive)
 {
   // Window can be null in workers
 }
 
 BroadcastChannel::~BroadcastChannel()
@@ -339,17 +329,16 @@ BroadcastChannel::Constructor(const Glob
                               ErrorResult& aRv)
 {
   nsCOMPtr<nsPIDOMWindowInner> window =
     do_QueryInterface(aGlobal.GetAsSupports());
   // Window is null in workers.
 
   nsAutoCString origin;
   PrincipalInfo principalInfo;
-  bool privateBrowsing = false;
   WorkerPrivate* workerPrivate = nullptr;
 
   if (NS_IsMainThread()) {
     nsCOMPtr<nsIGlobalObject> incumbent = mozilla::dom::GetIncumbentGlobal();
 
     if (!incumbent) {
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
@@ -376,39 +365,32 @@ BroadcastChannel::Constructor(const Glob
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
 
     aRv = PrincipalToPrincipalInfo(principal, &principalInfo);
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
-
-    nsIDocument* doc = window->GetExtantDoc();
-    if (doc) {
-      privateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);
-    }
   } else {
     JSContext* cx = aGlobal.Context();
     workerPrivate = GetWorkerPrivateFromContext(cx);
     MOZ_ASSERT(workerPrivate);
 
     RefPtr<InitializeRunnable> runnable =
-      new InitializeRunnable(workerPrivate, origin, principalInfo,
-                             privateBrowsing, aRv);
+      new InitializeRunnable(workerPrivate, origin, principalInfo, aRv);
     runnable->Dispatch(aRv);
   }
 
   if (aRv.Failed()) {
     return nullptr;
   }
 
   RefPtr<BroadcastChannel> bc =
-    new BroadcastChannel(window, principalInfo, origin, aChannel,
-                         privateBrowsing);
+    new BroadcastChannel(window, principalInfo, origin, aChannel);
 
   // Register this component to PBackground.
   PBackgroundChild* actor = BackgroundChild::GetForCurrentThread();
   if (actor) {
     bc->ActorCreated(actor);
   } else {
     BackgroundChild::GetOrCreateForCurrentThread(bc);
   }
@@ -517,18 +499,17 @@ BroadcastChannel::ActorCreated(PBackgrou
 {
   MOZ_ASSERT(aActor);
 
   if (mState == StateClosed) {
     return;
   }
 
   PBroadcastChannelChild* actor =
-    aActor->SendPBroadcastChannelConstructor(*mPrincipalInfo, mOrigin, mChannel,
-                                             mPrivateBrowsing);
+    aActor->SendPBroadcastChannelConstructor(*mPrincipalInfo, mOrigin, mChannel);
 
   mActor = static_cast<BroadcastChannelChild*>(actor);
   MOZ_ASSERT(mActor);
 
   mActor->SetParent(this);
 
   // Flush pending messages.
   for (uint32_t i = 0; i < mPendingMessages.Length(); ++i) {
--- a/dom/broadcastchannel/BroadcastChannel.h
+++ b/dom/broadcastchannel/BroadcastChannel.h
@@ -83,18 +83,17 @@ public:
                                    ErrorResult& aRv) override;
 
   void Shutdown();
 
 private:
   BroadcastChannel(nsPIDOMWindowInner* aWindow,
                    const PrincipalInfo& aPrincipalInfo,
                    const nsACString& aOrigin,
-                   const nsAString& aChannel,
-                   bool aPrivateBrowsing);
+                   const nsAString& aChannel);
 
   ~BroadcastChannel();
 
   void PostMessageData(BroadcastChannelMessage* aData);
 
   void PostMessageInternal(JSContext* aCx, JS::Handle<JS::Value> aMessage,
                            ErrorResult& aRv);
 
@@ -111,17 +110,16 @@ private:
   nsTArray<RefPtr<BroadcastChannelMessage>> mPendingMessages;
 
   nsAutoPtr<workers::WorkerFeature> mWorkerFeature;
 
   nsAutoPtr<PrincipalInfo> mPrincipalInfo;
 
   nsCString mOrigin;
   nsString mChannel;
-  bool mPrivateBrowsing;
 
   bool mIsKeptAlive;
 
   uint64_t mInnerID;
 
   enum {
     StateActive,
     StateClosing,
--- a/ipc/glue/BackgroundChildImpl.cpp
+++ b/ipc/glue/BackgroundChildImpl.cpp
@@ -271,18 +271,17 @@ BackgroundChildImpl::DeallocPUDPSocketCh
 
 // -----------------------------------------------------------------------------
 // BroadcastChannel API
 // -----------------------------------------------------------------------------
 
 dom::PBroadcastChannelChild*
 BackgroundChildImpl::AllocPBroadcastChannelChild(const PrincipalInfo& aPrincipalInfo,
                                                  const nsCString& aOrigin,
-                                                 const nsString& aChannel,
-                                                 const bool& aPrivateBrowsing)
+                                                 const nsString& aChannel)
 {
   RefPtr<dom::BroadcastChannelChild> agent =
     new dom::BroadcastChannelChild(aOrigin);
   return agent.forget().take();
 }
 
 bool
 BackgroundChildImpl::DeallocPBroadcastChannelChild(
--- a/ipc/glue/BackgroundChildImpl.h
+++ b/ipc/glue/BackgroundChildImpl.h
@@ -99,18 +99,17 @@ protected:
   AllocPUDPSocketChild(const OptionalPrincipalInfo& aPrincipalInfo,
                        const nsCString& aFilter) override;
   virtual bool
   DeallocPUDPSocketChild(PUDPSocketChild* aActor) override;
 
   virtual PBroadcastChannelChild*
   AllocPBroadcastChannelChild(const PrincipalInfo& aPrincipalInfo,
                               const nsCString& aOrigin,
-                              const nsString& aChannel,
-                              const bool& aPrivateBrowsing) override;
+                              const nsString& aChannel) override;
 
   virtual bool
   DeallocPBroadcastChannelChild(PBroadcastChannelChild* aActor) override;
 
   virtual PServiceWorkerManagerChild*
   AllocPServiceWorkerManagerChild() override;
 
   virtual bool
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -462,34 +462,29 @@ BackgroundParentImpl::DeallocPUDPSocketP
   p->Release();
   return true;
 }
 
 mozilla::dom::PBroadcastChannelParent*
 BackgroundParentImpl::AllocPBroadcastChannelParent(
                                             const PrincipalInfo& aPrincipalInfo,
                                             const nsCString& aOrigin,
-                                            const nsString& aChannel,
-                                            const bool& aPrivateBrowsing)
+                                            const nsString& aChannel)
 {
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
 
   nsString originChannelKey;
 
   // The format of originChannelKey is:
-  //  <channelName>|pb={true,false}|<origin+OriginAttributes>
+  //  <channelName>|<origin+OriginAttributes>
 
   originChannelKey.Assign(aChannel);
 
-  if (aPrivateBrowsing) {
-    originChannelKey.AppendLiteral("|pb=true|");
-  } else {
-    originChannelKey.AppendLiteral("|pb=false|");
-  }
+  originChannelKey.AppendLiteral("|");
 
   originChannelKey.Append(NS_ConvertUTF8toUTF16(aOrigin));
 
   return new BroadcastChannelParent(originChannelKey);
 }
 
 namespace {
 
@@ -643,18 +638,17 @@ private:
 
 } // namespace
 
 bool
 BackgroundParentImpl::RecvPBroadcastChannelConstructor(
                                             PBroadcastChannelParent* actor,
                                             const PrincipalInfo& aPrincipalInfo,
                                             const nsCString& aOrigin,
-                                            const nsString& aChannel,
-                                            const bool& aPrivateBrowsing)
+                                            const nsString& aChannel)
 {
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
 
   RefPtr<ContentParent> parent = BackgroundParent::GetContentParent(this);
 
   // If the ContentParent is null we are dealing with a same-process actor.
   if (!parent) {
--- a/ipc/glue/BackgroundParentImpl.h
+++ b/ipc/glue/BackgroundParentImpl.h
@@ -85,25 +85,23 @@ protected:
   AllocPVsyncParent() override;
 
   virtual bool
   DeallocPVsyncParent(PVsyncParent* aActor) override;
 
   virtual PBroadcastChannelParent*
   AllocPBroadcastChannelParent(const PrincipalInfo& aPrincipalInfo,
                                const nsCString& aOrigin,
-                               const nsString& aChannel,
-                               const bool& aPrivateBrowsing) override;
+                               const nsString& aChannel) override;
 
   virtual bool
   RecvPBroadcastChannelConstructor(PBroadcastChannelParent* actor,
                                    const PrincipalInfo& aPrincipalInfo,
                                    const nsCString& origin,
-                                   const nsString& channel,
-                                   const bool& aPrivateBrowsing) override;
+                                   const nsString& channel) override;
 
   virtual bool
   DeallocPBroadcastChannelParent(PBroadcastChannelParent* aActor) override;
 
   virtual PNuwaParent*
   AllocPNuwaParent() override;
 
   virtual bool
--- a/ipc/glue/PBackground.ipdl
+++ b/ipc/glue/PBackground.ipdl
@@ -74,18 +74,17 @@ parent:
   // Use only for testing!
   async FlushPendingFileDeletions();
 
   async PVsync();
 
   async PCameras();
 
   async PUDPSocket(OptionalPrincipalInfo pInfo, nsCString filter);
-  async PBroadcastChannel(PrincipalInfo pInfo, nsCString origin, nsString channel,
-                          bool privateBrowsing);
+  async PBroadcastChannel(PrincipalInfo pInfo, nsCString origin, nsString channel);
 
   async PServiceWorkerManager();
 
   async ShutdownServiceWorkerRegistrar();
 
   async PCacheStorage(Namespace aNamespace, PrincipalInfo aPrincipalInfo);
 
   async PMessagePort(nsID uuid, nsID destinationUuid, uint32_t sequenceId);