Bug 1251697 part 3. Remove the JSContext argument of StopSyncLoopRunnable::MaybeSetException. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 26 Feb 2016 21:15:57 -0500
changeset 324156 e2d9ecda1acf2939def4dcefb9acd0a62b76c768
parent 324155 f94ad4babe1d8828071e1b5b976739b7f633ad1e
child 324157 8e93182402a9742f890c722ae8057e724105a21b
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1251697
milestone47.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 1251697 part 3. Remove the JSContext argument of StopSyncLoopRunnable::MaybeSetException. r=khuey
dom/workers/WorkerRunnable.cpp
dom/workers/WorkerRunnable.h
dom/workers/XMLHttpRequest.cpp
--- a/dom/workers/WorkerRunnable.cpp
+++ b/dom/workers/WorkerRunnable.cpp
@@ -456,17 +456,17 @@ StopSyncLoopRunnable::WorkerRun(JSContex
 {
   aWorkerPrivate->AssertIsOnWorkerThread();
   MOZ_ASSERT(mSyncLoopTarget);
 
   nsCOMPtr<nsIEventTarget> syncLoopTarget;
   mSyncLoopTarget.swap(syncLoopTarget);
 
   if (!mResult) {
-    MaybeSetException(aCx);
+    MaybeSetException();
   }
 
   aWorkerPrivate->StopSyncLoop(syncLoopTarget, mResult);
   return true;
 }
 
 bool
 StopSyncLoopRunnable::DispatchInternal()
--- a/dom/workers/WorkerRunnable.h
+++ b/dom/workers/WorkerRunnable.h
@@ -262,20 +262,24 @@ public:
   // By default StopSyncLoopRunnables cannot be canceled since they could leave
   // a sync loop spinning forever.
   NS_DECL_NSICANCELABLERUNNABLE
 
 protected:
   virtual ~StopSyncLoopRunnable()
   { }
 
-  // Called on the worker thread to set an exception on the context if mResult
-  // is false. Override if you need an exception.
+  // Called on the worker thread, in WorkerRun, right before stopping the
+  // syncloop to set an exception (however subclasses want to handle that) if
+  // mResult is false.  Note that overrides of this method must NOT set an
+  // actual exception on the JSContext; they may only set some state that will
+  // get turned into an exception once the syncloop actually terminates and
+  // control is returned to whoever was spinning the syncloop.
   virtual void
-  MaybeSetException(JSContext* aCx)
+  MaybeSetException()
   { }
 
 private:
   virtual bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
 
   virtual bool
   DispatchInternal() override final;
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -206,17 +206,17 @@ private:
       MOZ_ASSERT(aProxy);
     }
 
   private:
     ~ResponseRunnable()
     { }
 
     virtual void
-    MaybeSetException(JSContext* aCx) override
+    MaybeSetException() override
     {
       mWorkerPrivate->AssertIsOnWorkerThread();
       MOZ_ASSERT(NS_FAILED(mErrorCode));
 
       mRv.Throw(mErrorCode);
     }
   };