Bug 1241531 - Part 3: Call Cancel() on all service worker jobs. r=ehsan
authorBen Kelly <ben@wanderview.com>
Thu, 21 Jan 2016 08:49:00 -0500
changeset 318167 9979b9c3314a045f7b010c8d39f60a19d3b4469e
parent 318166 62452453a63600b7cb86ab72b2d4540ee4462907
child 318168 ae7300dbece69cbd90e102fe8f4f2d90747d8a0f
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1241531
milestone46.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 1241531 - Part 3: Call Cancel() on all service worker jobs. r=ehsan
dom/workers/ServiceWorkerManager.cpp
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -1609,23 +1609,20 @@ ServiceWorkerJobQueue::CancelJobs()
 void
 ServiceWorkerJobQueue::CancelJobs(QueueData& aQueue)
 {
   if (aQueue.mJobs.IsEmpty()) {
     return;
   }
 
   // We have to treat the first job specially. It is the running job and needs
-  // to be notified correctly.
-  RefPtr<ServiceWorkerJob> runningJob = aQueue.mJobs[0];
-  // We can just let an Unregister job run to completion.
-  if (runningJob->IsRegisterOrInstallJob()) {
-    ServiceWorkerJobBase* job = static_cast<ServiceWorkerJobBase*>(runningJob.get());
-    job->Cancel();
-  }
+  // to be notified correctly.  Even if the job continues some work in the
+  // background, this still needs to be done to let the job know its no longer
+  // in the queue.
+  aQueue.mJobs[0]->Cancel();
 
   // Get rid of everything. Non-main thread objects may still be holding a ref
   // to the running register job. Since we called Cancel() on it, the job's
   // main thread functions will just exit.
   aQueue.mJobs.Clear();
 }
 
 NS_IMETHODIMP