Bug 1188776 - Remove appId/isInBrowserElement from BroadcastChannel. r=bholley
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 29 Jul 2015 06:56:00 -0400
changeset 287203 4ddd82cb5c0b58d14ceb732ee6f9bcb4f83edc9a
parent 287202 de77ffb0f7689a30d4173f8e26d66b9c96400540
child 287204 f8e637f308e1fb1d6173e8983c156689ec506c5f
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1188776
milestone42.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 1188776 - Remove appId/isInBrowserElement from BroadcastChannel. r=bholley
dom/broadcastchannel/BroadcastChannelParent.cpp
dom/broadcastchannel/BroadcastChannelParent.h
dom/broadcastchannel/BroadcastChannelService.cpp
dom/broadcastchannel/BroadcastChannelService.h
ipc/glue/BackgroundParentImpl.cpp
--- a/dom/broadcastchannel/BroadcastChannelParent.cpp
+++ b/dom/broadcastchannel/BroadcastChannelParent.cpp
@@ -13,55 +13,43 @@
 #include "nsIScriptSecurityManager.h"
 
 namespace mozilla {
 
 using namespace ipc;
 
 namespace dom {
 
-BroadcastChannelParent::BroadcastChannelParent(
-                                            const PrincipalInfo& aPrincipalInfo,
-                                            const nsACString& aOrigin,
-                                            const nsAString& aChannel,
-                                            bool aPrivateBrowsing)
+BroadcastChannelParent::BroadcastChannelParent(const nsACString& aOrigin,
+                                               const nsAString& aChannel,
+                                               bool aPrivateBrowsing)
   : mService(BroadcastChannelService::GetOrCreate())
   , mOrigin(aOrigin)
   , mChannel(aChannel)
-  , mAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID)
-  , mIsInBrowserElement(false)
   , mPrivateBrowsing(aPrivateBrowsing)
 {
   AssertIsOnBackgroundThread();
   mService->RegisterActor(this);
-
-  if (aPrincipalInfo.type() ==PrincipalInfo::TContentPrincipalInfo) {
-    const ContentPrincipalInfo& info =
-      aPrincipalInfo.get_ContentPrincipalInfo();
-    mAppId = info.appId();
-    mIsInBrowserElement = info.isInBrowserElement();
-  }
 }
 
 BroadcastChannelParent::~BroadcastChannelParent()
 {
   AssertIsOnBackgroundThread();
 }
 
 bool
 BroadcastChannelParent::RecvPostMessage(const ClonedMessageData& aData)
 {
   AssertIsOnBackgroundThread();
 
   if (NS_WARN_IF(!mService)) {
     return false;
   }
 
-  mService->PostMessage(this, aData, mOrigin, mAppId, mIsInBrowserElement,
-                        mChannel, mPrivateBrowsing);
+  mService->PostMessage(this, aData, mOrigin, mChannel, mPrivateBrowsing);
   return true;
 }
 
 bool
 BroadcastChannelParent::RecvClose()
 {
   AssertIsOnBackgroundThread();
 
@@ -87,26 +75,22 @@ BroadcastChannelParent::ActorDestroy(Act
     // released too.
     mService->UnregisterActor(this);
   }
 }
 
 void
 BroadcastChannelParent::CheckAndDeliver(const ClonedMessageData& aData,
                                         const nsCString& aOrigin,
-                                        uint64_t aAppId,
-                                        bool aInBrowserElement,
                                         const nsString& aChannel,
                                         bool aPrivateBrowsing)
 {
   AssertIsOnBackgroundThread();
 
   if (aOrigin == mOrigin &&
-      aAppId == mAppId &&
-      aInBrowserElement == mIsInBrowserElement &&
       aChannel == mChannel &&
       aPrivateBrowsing == mPrivateBrowsing) {
     // We need to duplicate data only if we have blobs or if the manager of
     // them is different than the manager of this parent actor.
     if (aData.blobsParent().IsEmpty() ||
         static_cast<BlobParent*>(aData.blobsParent()[0])->GetBackgroundManager() == Manager()) {
       unused << SendNotify(aData);
       return;
--- a/dom/broadcastchannel/BroadcastChannelParent.h
+++ b/dom/broadcastchannel/BroadcastChannelParent.h
@@ -24,39 +24,34 @@ class BroadcastChannelParent final : pub
 {
   friend class mozilla::ipc::BackgroundParentImpl;
 
   typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
 
 public:
   void CheckAndDeliver(const ClonedMessageData& aData,
                        const nsCString& aOrigin,
-                       const uint64_t aAppId,
-                       const bool aIsInBrowserElement,
                        const nsString& aChannel,
                        bool aPrivateBrowsing);
 
 private:
-  BroadcastChannelParent(const PrincipalInfo& aPrincipalInfo,
-                         const nsACString& aOrigin,
+  BroadcastChannelParent(const nsACString& aOrigin,
                          const nsAString& aChannel,
                          bool aPrivateBrowsing);
   ~BroadcastChannelParent();
 
   virtual bool
   RecvPostMessage(const ClonedMessageData& aData) override;
 
   virtual bool RecvClose() override;
 
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   nsRefPtr<BroadcastChannelService> mService;
   nsCString mOrigin;
   nsString mChannel;
-  uint64_t mAppId;
-  bool mIsInBrowserElement;
   bool mPrivateBrowsing;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_BroadcastChannelParent_h
--- a/dom/broadcastchannel/BroadcastChannelService.cpp
+++ b/dom/broadcastchannel/BroadcastChannelService.cpp
@@ -76,18 +76,16 @@ BroadcastChannelService::UnregisterActor
 
   mAgents.RemoveEntry(aParent);
 }
 
 void
 BroadcastChannelService::PostMessage(BroadcastChannelParent* aParent,
                                      const ClonedMessageData& aData,
                                      const nsACString& aOrigin,
-                                     uint64_t aAppId,
-                                     bool aIsInBrowserElement,
                                      const nsAString& aChannel,
                                      bool aPrivateBrowsing)
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aParent);
   MOZ_ASSERT(mAgents.Contains(aParent));
 
   // We need to keep the array alive for the life-time of this operation.
@@ -104,16 +102,15 @@ BroadcastChannelService::PostMessage(Bro
   }
 
   for (auto iter = mAgents.Iter(); !iter.Done(); iter.Next()) {
     BroadcastChannelParent* parent = iter.Get()->GetKey();
     MOZ_ASSERT(parent);
 
     if (parent != aParent) {
       parent->CheckAndDeliver(aData, PromiseFlatCString(aOrigin),
-                              aAppId, aIsInBrowserElement,
                               PromiseFlatString(aChannel), aPrivateBrowsing);
     }
   }
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/broadcastchannel/BroadcastChannelService.h
+++ b/dom/broadcastchannel/BroadcastChannelService.h
@@ -29,18 +29,16 @@ public:
   static already_AddRefed<BroadcastChannelService> GetOrCreate();
 
   void RegisterActor(BroadcastChannelParent* aParent);
   void UnregisterActor(BroadcastChannelParent* aParent);
 
   void PostMessage(BroadcastChannelParent* aParent,
                    const ClonedMessageData& aData,
                    const nsACString& aOrigin,
-                   uint64_t aAppId,
-                   bool aIsInBrowserElement,
                    const nsAString& aChannel,
                    bool aPrivateBrowsing);
 
 private:
   BroadcastChannelService();
   ~BroadcastChannelService();
 
   nsTHashtable<nsPtrHashKey<BroadcastChannelParent>> mAgents;
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -350,18 +350,17 @@ BackgroundParentImpl::AllocPBroadcastCha
                                             const PrincipalInfo& aPrincipalInfo,
                                             const nsCString& aOrigin,
                                             const nsString& aChannel,
                                             const bool& aPrivateBrowsing)
 {
   AssertIsInMainProcess();
   AssertIsOnBackgroundThread();
 
-  return new BroadcastChannelParent(aPrincipalInfo, aOrigin, aChannel,
-                                    aPrivateBrowsing);
+  return new BroadcastChannelParent(aOrigin, aChannel, aPrivateBrowsing);
 }
 
 namespace {
 
 class CheckPrincipalRunnable final : public nsRunnable
 {
 public:
   CheckPrincipalRunnable(already_AddRefed<ContentParent> aParent,