Bug 1603374 - account for Cancel calling WorkerRun r=dom-workers-and-storage-reviewers,asuth
authorPerry Jiang <perry@mozilla.com>
Thu, 30 Jan 2020 10:32:38 +0000
changeset 512117 aed68d2d967db45a05cba610f7783f773864264d
parent 512116 784fdbec47d2351b211f1fceae1d68974ea21798
child 512118 b1105fc269d77c96f3bc3b4da81510d8c49b143a
push id37072
push usercsabou@mozilla.com
push dateThu, 30 Jan 2020 15:44:43 +0000
treeherdermozilla-central@f97c48da9cee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-workers-and-storage-reviewers, asuth
bugs1603374
milestone74.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 1603374 - account for Cancel calling WorkerRun r=dom-workers-and-storage-reviewers,asuth MainThreadWorkerControlRunnable::Cancel (indirectly) calls WorkerRun, which is neither intuitive nor documented, but UpdateStateOpRunnable needs to account for that to avoid a release assertion failure in ServiceWorkerOpArgs::AssertSanity. Differential Revision: https://phabricator.services.mozilla.com/D61282
dom/serviceworkers/ServiceWorkerOp.cpp
--- a/dom/serviceworkers/ServiceWorkerOp.cpp
+++ b/dom/serviceworkers/ServiceWorkerOp.cpp
@@ -504,20 +504,21 @@ class UpdateServiceWorkerStateOp final :
 
    private:
     ~UpdateStateOpRunnable() = default;
 
     bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
       MOZ_ASSERT(aWorkerPrivate);
       aWorkerPrivate->AssertIsOnWorkerThread();
       MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
-      MOZ_ASSERT(mOwner);
 
-      Unused << mOwner->Exec(aCx, aWorkerPrivate);
-      mOwner = nullptr;
+      if (mOwner) {
+        Unused << mOwner->Exec(aCx, aWorkerPrivate);
+        mOwner = nullptr;
+      }
 
       return true;
     }
 
     nsresult Cancel() override {
       MOZ_ASSERT(mOwner);
 
       mOwner->RejectAll(NS_ERROR_DOM_ABORT_ERR);