Backed out 2 changesets (bug 1250963) for build bustage CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 25 Feb 2016 13:41:42 -0800
changeset 321977 8b81d4ca06800157280f0b4e3b747f438339118e
parent 321976 e048438a36a1a774f265def30e11c42fb8f90145
child 321978 8ae0fba610234292b64a86f62722767f151abc17
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1250963
milestone47.0a1
backs out257324c2ae1725b5221082c5c22f986408290fd6
0e868ee89abc73e4142af02b51c80681c0960293
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 2 changesets (bug 1250963) for build bustage CLOSED TREE Backed out changeset 257324c2ae17 (bug 1250963) Backed out changeset 0e868ee89abc (bug 1250963)
dom/workers/RuntimeService.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/WorkerRunnable.cpp
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -2141,23 +2141,29 @@ void
 RuntimeService::CancelWorkersForWindow(nsPIDOMWindowInner* aWindow)
 {
   AssertIsOnMainThread();
 
   AutoTArray<WorkerPrivate*, MAX_WORKERS_PER_DOMAIN> workers;
   GetWorkersForWindow(aWindow, workers);
 
   if (!workers.IsEmpty()) {
+    AutoJSAPI jsapi;
+    if (NS_WARN_IF(!jsapi.InitWithLegacyErrorReporting(aWindow))) {
+      return;
+    }
+    JSContext* cx = jsapi.cx();
+
     for (uint32_t index = 0; index < workers.Length(); index++) {
       WorkerPrivate*& worker = workers[index];
 
       if (worker->IsSharedWorker()) {
         worker->CloseSharedWorkersForWindow(aWindow);
-      } else {
-        worker->Cancel();
+      } else if (!worker->Cancel(cx)) {
+        JS_ReportPendingException(cx);
       }
     }
   }
 }
 
 void
 RuntimeService::FreezeWorkersForWindow(nsPIDOMWindowInner* aWindow)
 {
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -466,17 +466,17 @@ public:
   : WorkerControlRunnable(aWorkerPrivate, ParentThreadUnchangedBusyCount),
     mIncrease(aIncrease)
   { }
 
 private:
   virtual bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
   {
-    return aWorkerPrivate->ModifyBusyCount(mIncrease);
+    return aWorkerPrivate->ModifyBusyCount(aCx, mIncrease);
   }
 
   virtual void
   PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aRunResult)
           override
   {
     if (mIncrease) {
       WorkerControlRunnable::PostRun(aCx, aWorkerPrivate, aRunResult);
@@ -842,43 +842,33 @@ public:
   NotifyRunnable(WorkerPrivate* aWorkerPrivate, Status aStatus)
   : WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount),
     mStatus(aStatus)
   {
     MOZ_ASSERT(aStatus == Closing || aStatus == Terminating ||
                aStatus == Canceling || aStatus == Killing);
   }
 
-  // We can be dispatched without a JSContext, because all we do with the
-  // JSContext passed to Dispatch() normally for worker runnables is call
-  // ModifyBusyCount... but that doesn't actually use its JSContext argument.
-  bool Dispatch()
-  {
-    return WorkerControlRunnable::Dispatch(nullptr);
-  }
-
 private:
   virtual bool
   PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
   {
-    aWorkerPrivate->AssertIsOnParentThread();
     // Modify here, but not in PostRun! This busy count addition will be matched
     // by the CloseEventRunnable.
-    return aWorkerPrivate->ModifyBusyCount(true);
+    return aWorkerPrivate->ModifyBusyCount(aCx, true);
   }
 
   virtual void
   PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
                bool aDispatchResult) override
   {
-    aWorkerPrivate->AssertIsOnParentThread();
     if (!aDispatchResult) {
       // We couldn't dispatch to the worker, which means it's already dead.
       // Undo the busy count modification.
-      aWorkerPrivate->ModifyBusyCount(false);
+      aWorkerPrivate->ModifyBusyCount(aCx, false);
     }
   }
 
   virtual bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
   {
     return aWorkerPrivate->NotifyInternal(aCx, mStatus);
   }
@@ -891,17 +881,17 @@ public:
   : WorkerControlRunnable(aWorkerPrivate, ParentThreadUnchangedBusyCount)
   { }
 
 private:
   virtual bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
   {
     // This busy count will be matched by the CloseEventRunnable.
-    return aWorkerPrivate->ModifyBusyCount(true) &&
+    return aWorkerPrivate->ModifyBusyCount(aCx, true) &&
            aWorkerPrivate->Close();
   }
 };
 
 class FreezeRunnable final : public WorkerControlRunnable
 {
 public:
   explicit FreezeRunnable(WorkerPrivate* aWorkerPrivate)
@@ -2524,17 +2514,17 @@ WorkerPrivateParent<Derived>::Start()
   }
 
   return false;
 }
 
 // aCx is null when called from the finalizer
 template <class Derived>
 bool
-WorkerPrivateParent<Derived>::NotifyPrivate(Status aStatus)
+WorkerPrivateParent<Derived>::NotifyPrivate(JSContext* aCx, Status aStatus)
 {
   AssertIsOnParentThread();
 
   bool pending;
   {
     MutexAutoLock lock(mMutex);
 
     if (mParentStatus >= aStatus) {
@@ -2576,17 +2566,17 @@ WorkerPrivateParent<Derived>::NotifyPriv
   NS_ASSERTION(aStatus != Terminating || mQueuedRunnables.IsEmpty(),
                "Shouldn't have anything queued!");
 
   // Anything queued will be discarded.
   mQueuedRunnables.Clear();
 
   RefPtr<NotifyRunnable> runnable =
     new NotifyRunnable(ParentAsWorkerPrivate(), aStatus);
-  return runnable->Dispatch();
+  return runnable->Dispatch(aCx);
 }
 
 template <class Derived>
 bool
 WorkerPrivateParent<Derived>::Freeze(JSContext* aCx,
                                      nsPIDOMWindowInner* aWindow)
 {
   AssertIsOnParentThread();
@@ -2783,17 +2773,17 @@ WorkerPrivateParent<Derived>::Close()
     }
   }
 
   return true;
 }
 
 template <class Derived>
 bool
-WorkerPrivateParent<Derived>::ModifyBusyCount(bool aIncrease)
+WorkerPrivateParent<Derived>::ModifyBusyCount(JSContext* aCx, bool aIncrease)
 {
   AssertIsOnParentThread();
 
   NS_ASSERTION(aIncrease || mBusyCount, "Mismatched busy count mods!");
 
   if (aIncrease) {
     mBusyCount++;
     return true;
@@ -2802,17 +2792,17 @@ WorkerPrivateParent<Derived>::ModifyBusy
   if (--mBusyCount == 0) {
 
     bool shouldCancel;
     {
       MutexAutoLock lock(mMutex);
       shouldCancel = mParentStatus == Terminating;
     }
 
-    if (shouldCancel && !Cancel()) {
+    if (shouldCancel && !Cancel(aCx)) {
       return false;
     }
   }
 
   return true;
 }
 
 template <class Derived>
@@ -3337,35 +3327,38 @@ WorkerPrivateParent<Derived>::CloseShare
   // if that was the last SharedWorker then it's time to cancel this worker.
 
   AutoSafeJSContext cx;
 
   if (!mSharedWorkers.IsEmpty()) {
     if (!Freeze(cx, nullptr)) {
       JS_ReportPendingException(cx);
     }
-  } else {
-    Cancel();
+  } else if (!Cancel(cx)) {
+    JS_ReportPendingException(cx);
   }
 }
 
 template <class Derived>
 void
 WorkerPrivateParent<Derived>::CloseAllSharedWorkers()
 {
   AssertIsOnMainThread();
   MOZ_ASSERT(IsSharedWorker() || IsServiceWorker());
 
   for (uint32_t i = 0; i < mSharedWorkers.Length(); ++i) {
     mSharedWorkers[i]->Close();
   }
 
   mSharedWorkers.Clear();
 
-  Cancel();
+  AutoSafeJSContext cx;
+  if (!Cancel(cx)) {
+    JS_ReportPendingException(cx);
+  }
 }
 
 template <class Derived>
 void
 WorkerPrivateParent<Derived>::WorkerScriptLoaded()
 {
   AssertIsOnMainThread();
 
@@ -5187,17 +5180,17 @@ WorkerPrivate::NotifyFeatures(JSContext*
       NS_WARNING("Failed to notify feature!");
     }
   }
 
   AutoTArray<ParentType*, 10> children;
   children.AppendElements(mChildWorkers);
 
   for (uint32_t index = 0; index < children.Length(); index++) {
-    if (!children[index]->Notify(aStatus)) {
+    if (!children[index]->Notify(aCx, aStatus)) {
       NS_WARNING("Failed to notify child worker!");
     }
   }
 }
 
 void
 WorkerPrivate::CancelAllTimeouts(JSContext* aCx)
 {
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -213,23 +213,23 @@ private:
   Derived*
   ParentAsWorkerPrivate() const
   {
     return static_cast<Derived*>(const_cast<WorkerPrivateParent*>(this));
   }
 
   // aCx is null when called from the finalizer
   bool
-  NotifyPrivate(Status aStatus);
+  NotifyPrivate(JSContext* aCx, Status aStatus);
 
   // aCx is null when called from the finalizer
   bool
   TerminatePrivate(JSContext* aCx)
   {
-    return NotifyPrivate(Terminating);
+    return NotifyPrivate(aCx, Terminating);
   }
 
   void
   PostMessageInternal(JSContext* aCx, JS::Handle<JS::Value> aMessage,
                       const Optional<Sequence<JS::Value>>& aTransferable,
                       UniquePtr<ServiceWorkerClientInfo>&& aClientInfo,
                       ErrorResult& aRv);
 
@@ -277,31 +277,31 @@ public:
   GetEventTarget();
 
   // May be called on any thread...
   bool
   Start();
 
   // Called on the parent thread.
   bool
-  Notify(Status aStatus)
+  Notify(JSContext* aCx, Status aStatus)
   {
-    return NotifyPrivate(aStatus);
+    return NotifyPrivate(aCx, aStatus);
   }
 
   bool
-  Cancel()
+  Cancel(JSContext* aCx)
   {
-    return Notify(Canceling);
+    return Notify(aCx, Canceling);
   }
 
   bool
   Kill(JSContext* aCx)
   {
-    return Notify(Killing);
+    return Notify(aCx, Killing);
   }
 
   // We can assume that an nsPIDOMWindow will be available for Freeze, Thaw
   // as these are only used for globals going in and out of the bfcache.
   bool
   Freeze(JSContext* aCx, nsPIDOMWindowInner* aWindow);
 
   bool
@@ -319,17 +319,17 @@ public:
     AssertIsOnParentThread();
     return TerminatePrivate(aCx);
   }
 
   bool
   Close();
 
   bool
-  ModifyBusyCount(bool aIncrease);
+  ModifyBusyCount(JSContext* aCx, bool aIncrease);
 
   void
   ForgetOverridenLoadGroup(nsCOMPtr<nsILoadGroup>& aLoadGroupOut);
 
   void
   ForgetMainThreadObjects(nsTArray<nsCOMPtr<nsISupports> >& aDoomed);
 
   void
--- a/dom/workers/WorkerRunnable.cpp
+++ b/dom/workers/WorkerRunnable.cpp
@@ -79,17 +79,17 @@ WorkerRunnable::PreDispatch(JSContext* a
       break;
 
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown behavior!");
   }
 #endif
 
   if (mBehavior == WorkerThreadModifyBusyCount) {
-    return aWorkerPrivate->ModifyBusyCount(true);
+    return aWorkerPrivate->ModifyBusyCount(aCx, true);
   }
 
   return true;
 }
 
 bool
 WorkerRunnable::Dispatch(JSContext* aCx)
 {
@@ -173,17 +173,17 @@ WorkerRunnable::PostDispatch(JSContext* 
 
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown behavior!");
   }
 #endif
 
   if (!aDispatchResult) {
     if (mBehavior == WorkerThreadModifyBusyCount) {
-      aWorkerPrivate->ModifyBusyCount(false);
+      aWorkerPrivate->ModifyBusyCount(aCx, false);
     }
     if (aCx) {
       JS_ReportPendingException(aCx);
     }
   }
 }
 
 void