Bug 1439099 P2 Remove ServiceWorkerRegistrationInfo::GetByID(). r=asuth
authorBen Kelly <ben@wanderview.com>
Mon, 19 Feb 2018 12:06:19 -0800
changeset 404415 3c0e2869bb10216d07548322aa94f5585b35df4b
parent 404414 e645473ee112196fe72083441762fa6e004c1000
child 404416 a2ebde19d2781370ea487c93ce9a7a0c7d6b263f
push id100001
push userbkelly@mozilla.com
push dateMon, 19 Feb 2018 20:06:28 +0000
treeherdermozilla-inbound@a2ebde19d278 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1439099
milestone60.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 1439099 P2 Remove ServiceWorkerRegistrationInfo::GetByID(). r=asuth
dom/clients/manager/ClientSource.cpp
dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
dom/serviceworkers/ServiceWorkerRegistrationInfo.h
--- a/dom/clients/manager/ClientSource.cpp
+++ b/dom/clients/manager/ClientSource.cpp
@@ -564,20 +564,19 @@ ClientSource::PostMessage(const ClientPo
     // Shutting down. Just don't deliver this message.
     ref = ClientOpPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
     return ref.forget();
   }
 
   RefPtr<ServiceWorkerRegistrationInfo> reg =
     swm->GetRegistration(principal, source.Scope());
   if (reg) {
-    RefPtr<ServiceWorkerInfo> serviceWorker = reg->GetByID(source.Id());
-    if (serviceWorker) {
-      RefPtr<ServiceWorker> instance =
-        globalObject->GetOrCreateServiceWorker(source);
+    RefPtr<ServiceWorker> instance =
+      globalObject->GetOrCreateServiceWorker(source);
+    if (instance) {
       init.mSource.SetValue().SetAsServiceWorker() = instance;
     }
   }
 
   RefPtr<MessageEvent> event =
     MessageEvent::Constructor(target, NS_LITERAL_STRING("message"), init);
   event->SetTrusted(true);
 
--- a/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
+++ b/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp
@@ -487,34 +487,16 @@ ServiceWorkerRegistrationInfo::GetWaitin
 ServiceWorkerInfo*
 ServiceWorkerRegistrationInfo::GetActive() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   return mActiveWorker;
 }
 
 ServiceWorkerInfo*
-ServiceWorkerRegistrationInfo::GetByID(uint64_t aID) const
-{
-  if (mActiveWorker && mActiveWorker->ID() == aID) {
-    return mActiveWorker;
-  }
-  if (mWaitingWorker && mWaitingWorker->ID() == aID) {
-    return mWaitingWorker;
-  }
-  if (mInstallingWorker && mInstallingWorker->ID() == aID) {
-    return mInstallingWorker;
-  }
-  if (mEvaluatingWorker && mEvaluatingWorker->ID() == aID) {
-    return mEvaluatingWorker;
-  }
-  return nullptr;
-}
-
-ServiceWorkerInfo*
 ServiceWorkerRegistrationInfo::GetByDescriptor(const ServiceWorkerDescriptor& aDescriptor) const
 {
   if (mActiveWorker && mActiveWorker->Descriptor().Matches(aDescriptor)) {
     return mActiveWorker;
   }
   if (mWaitingWorker && mWaitingWorker->Descriptor().Matches(aDescriptor)) {
     return mWaitingWorker;
   }
--- a/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
+++ b/dom/serviceworkers/ServiceWorkerRegistrationInfo.h
@@ -147,19 +147,16 @@ public:
 
   ServiceWorkerInfo*
   GetWaiting() const;
 
   ServiceWorkerInfo*
   GetActive() const;
 
   ServiceWorkerInfo*
-  GetByID(uint64_t aID) const;
-
-  ServiceWorkerInfo*
   GetByDescriptor(const ServiceWorkerDescriptor& aDescriptor) const;
 
   // Set the given worker as the evaluating service worker.  The worker
   // state is not changed.
   void
   SetEvaluating(ServiceWorkerInfo* aServiceWorker);
 
   // Remove an existing evaluating worker, if present.  The worker will