Bug 1425316 P6 Remove ServiceWorkerManager::ShouldReportToWindow(). r=asuth
authorBen Kelly <ben@wanderview.com>
Tue, 19 Dec 2017 10:04:49 -0500
changeset 396924 1e2457625325ac08b5820c186d82a8f1bdc7b20f
parent 396923 8c2c417bbe76fe6f49f2e55503232b5cd54fe16f
child 396925 8e6356ea82b27a29aad6a0eea2bfa850dc4fd893
push id33117
push userebalazs@mozilla.com
push dateWed, 20 Dec 2017 09:47:43 +0000
treeherdermozilla-central@a235bf4868ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1425316
milestone59.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 1425316 P6 Remove ServiceWorkerManager::ShouldReportToWindow(). r=asuth
dom/workers/ServiceWorkerManager.cpp
dom/workers/ServiceWorkerManager.h
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -3627,73 +3627,16 @@ ServiceWorkerManager::RemoveListener(nsI
     return NS_ERROR_INVALID_ARG;
   }
 
   mListeners.RemoveElement(aListener);
 
   return NS_OK;
 }
 
-nsresult
-ServiceWorkerManager::ShouldReportToWindow(mozIDOMWindowProxy* aWindow,
-                                           const nsACString& aScope,
-                                           bool* aResult)
-{
-  AssertIsOnMainThread();
-  MOZ_ASSERT(aResult);
-
-  *aResult = false;
-
-  // Get the inner window ID to compare to our document windows below.
-  nsCOMPtr<nsPIDOMWindowOuter> targetWin = nsPIDOMWindowOuter::From(aWindow);
-  if (NS_WARN_IF(!targetWin)) {
-    return NS_OK;
-  }
-
-  targetWin = targetWin->GetScriptableTop();
-  uint64_t winId = targetWin->WindowID();
-
-  // Examine any windows performing a navigation that we are currently
-  // intercepting.
-  InterceptionList* intList = mNavigationInterceptions.Get(aScope);
-  if (intList) {
-    for (uint32_t i = 0; i < intList->Length(); ++i) {
-      nsCOMPtr<nsIInterceptedChannel> channel = intList->ElementAt(i);
-
-      nsCOMPtr<nsIChannel> inner;
-      nsresult rv = channel->GetChannel(getter_AddRefs(inner));
-      if (NS_WARN_IF(NS_FAILED(rv))) {
-        continue;
-      }
-
-      uint64_t id = nsContentUtils::GetInnerWindowID(inner);
-      if (id == 0) {
-        continue;
-      }
-
-      nsCOMPtr<nsPIDOMWindowInner> win =
-        nsGlobalWindowInner::GetInnerWindowWithId(id)->AsInner();
-      if (!win) {
-        continue;
-      }
-
-      nsCOMPtr<nsPIDOMWindowOuter> outer = win->GetScriptableTop();
-
-      // Match.  We should report to this window.
-      if (outer && winId == outer->WindowID()) {
-        *aResult = true;
-        return NS_OK;
-      }
-    }
-  }
-
-  // No match.  We should not report to this window.
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 ServiceWorkerManager::Observe(nsISupports* aSubject,
                               const char* aTopic,
                               const char16_t* aData)
 {
   if (strcmp(aTopic, PURGE_SESSION_HISTORY) == 0) {
     MOZ_ASSERT(XRE_IsParentProcess());
     RemoveAll();
--- a/dom/workers/ServiceWorkerManager.h
+++ b/dom/workers/ServiceWorkerManager.h
@@ -319,20 +319,16 @@ public:
   NotifyUnregister(nsIPrincipal* aPrincipal, const nsAString& aScope);
 
   void
   WorkerIsIdle(ServiceWorkerInfo* aWorker);
 
   void
   CheckPendingReadyPromises();
 
-  nsresult
-  ShouldReportToWindow(mozIDOMWindowProxy* aWindow, const nsACString& aScope,
-                       bool* aResult);
-
 private:
   ServiceWorkerManager();
   ~ServiceWorkerManager();
 
   void
   Init(ServiceWorkerRegistrar* aRegistrar);
 
   void