Backed out changeset 5555ee7490fb (bug 1113631) for asan mochitest-4 bustage on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 23 Jan 2015 19:51:33 -0800
changeset 225505 e9d37cd95335336532e6e5d1b32207e31ccc7a51
parent 225504 961c75198f9d996a4952a3b0b776331b49d6acb0
child 225506 fbf421e77962aaa7f9d64bee8a9438e6263f2fd2
push id28163
push userphilringnalda@gmail.com
push dateSat, 24 Jan 2015 16:27:39 +0000
treeherdermozilla-central@1cf171c1a177 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1113631
milestone38.0a1
backs out5555ee7490fb910f26877ede648f231dc37e7eca
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
Backed out changeset 5555ee7490fb (bug 1113631) for asan mochitest-4 bustage on a CLOSED TREE
dom/workers/ServiceWorkerManager.cpp
dom/workers/test/serviceworkers/test_installation_simple.html
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -499,17 +499,18 @@ public:
   }
 
   // Public so our error handling code can use it.
   void
   Fail(const ErrorEventInit& aError)
   {
     MOZ_ASSERT(mCallback);
     mCallback->UpdateFailed(aError);
-    FailCommon(NS_ERROR_DOM_JS_EXCEPTION);
+    mCallback = nullptr;
+    Done(NS_ERROR_DOM_JS_EXCEPTION);
   }
 
   // Public so our error handling code can continue with a successful worker.
   void
   ContinueInstall()
   {
     nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
     nsRefPtr<ServiceWorkerManager::ServiceWorkerDomainInfo> domainInfo =
@@ -628,49 +629,26 @@ private:
   void
   Succeed()
   {
     MOZ_ASSERT(mCallback);
     mCallback->UpdateSucceeded(mRegistration);
     mCallback = nullptr;
   }
 
-  void
-  FailCommon(nsresult aRv)
-  {
-    mCallback = nullptr;
-    MaybeRemoveRegistration();
-    // Ensures that the job can't do anything useful from this point on.
-    mRegistration = nullptr;
-    Done(aRv);
-  }
-
   // This MUST only be called when the job is still performing actions related
   // to registration or update. After the spec resolves the update promise, use
   // Done() with the failure code instead.
   void
-  Fail(nsresult aRv)
+  Fail(nsresult rv)
   {
     MOZ_ASSERT(mCallback);
-    mCallback->UpdateFailed(aRv);
-    FailCommon(aRv);
-  }
-
-  void
-  MaybeRemoveRegistration()
-  {
-    MOZ_ASSERT(mRegistration);
-    nsRefPtr<ServiceWorkerInfo> newest = mRegistration->Newest();
-    if (!newest) {
-      nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
-      nsRefPtr<ServiceWorkerManager::ServiceWorkerDomainInfo> domainInfo =
-        swm->GetDomainInfo(mRegistration->mScope);
-      MOZ_ASSERT(domainInfo);
-      domainInfo->RemoveRegistration(mRegistration);
-    }
+    mCallback->UpdateFailed(rv);
+    mCallback = nullptr;
+    Done(rv);
   }
 
   void
   ContinueAfterInstallEvent(bool aSuccess, bool aActivateImmediately)
   {
     // By this point the callback should've been notified about success or fail
     // and nulled.
     MOZ_ASSERT(!mCallback);
@@ -683,17 +661,16 @@ private:
     nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
 
     // "If installFailed is true"
     if (!aSuccess) {
       mRegistration->mInstallingWorker->UpdateState(ServiceWorkerState::Redundant);
       mRegistration->mInstallingWorker = nullptr;
       swm->InvalidateServiceWorkerRegistrationWorker(mRegistration,
                                                      WhichServiceWorker::INSTALLING_WORKER);
-      MaybeRemoveRegistration();
       return Done(NS_ERROR_DOM_ABORT_ERR);
     }
 
     // "If registration's waiting worker is not null"
     if (mRegistration->mWaitingWorker) {
       // FIXME(nsm): Terminate
       mRegistration->mWaitingWorker->UpdateState(ServiceWorkerState::Redundant);
     }
--- a/dom/workers/test/serviceworkers/test_installation_simple.html
+++ b/dom/workers/test/serviceworkers/test_installation_simple.html
@@ -101,20 +101,16 @@
         ok(e.name === "NetworkError", "Should fail with NetworkError");
       });
   }
 
   function parseError() {
     var p = navigator.serviceWorker.register("parse_error_worker.js", { scope: "parse_error/" });
     return p.then(function(wr) {
       ok(false, "Registration should fail with parse error");
-      return navigator.serviceWorker.getRegistration("parse_error/").then(function(swr) {
-        // See https://github.com/slightlyoff/ServiceWorker/issues/547
-        is(swr, undefined, "A failed registration for a scope with no prior controllers should clear itself");
-      });
     }, function(e) {
     info("NSM " + e.name);
       ok(e instanceof Error, "Registration should fail with parse error");
     });
   }
 
   // FIXME(nsm): test for parse error when Update step doesn't happen (directly from register).