Bug 1251276 part 1. Change WorkerPrivate::CancelAllTimeouts to no longer call RunExpiredTimeouts. r=khuey

If you walk through what RunExpiredTimeouts used to when called from here do
carefully, it used to do the following:

1)  If mRunningExpiredTimeouts, no-op.
2)  Not run anything, because everything is canceled.
3)  Remove everything from mTimeouts, since everything is canceled.
4)  Since mTimeouts is now empty, modify the busy count and set mTimerRunning to false.

None of this could report a JS exception, so the JS_ReportPendingException call
in CancelAllTimouts was dead code.  Note that the return value of
RunExpiredTimeouts only affected whether JS_ReportPendingException is called, so
we don't even need to worry about ModifyBusyCountFromWorker failing: that
failure used to be silently swallowed.
This commit is contained in:
Boris Zbarsky 2016-02-26 21:15:56 -05:00
Родитель d71c9dd868
Коммит 7dc5bbf023
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -5186,10 +5186,18 @@ WorkerPrivate::CancelAllTimeouts(JSContext* aCx)
mTimeouts[index]->mCanceled = true;
}
if (!RunExpiredTimeouts(aCx)) {
JS_ReportPendingException(aCx);
// If mRunningExpiredTimeouts, then the fact that they are all canceled now
// means that the currently executing RunExpiredTimeouts will deal with
// them. Otherwise, we need to clean them up ourselves.
if (!mRunningExpiredTimeouts) {
mTimeouts.Clear();
ModifyBusyCountFromWorker(false);
}
// Set mTimerRunning false even if mRunningExpiredTimeouts is true, so that
// if we get reentered under this same RunExpiredTimeouts call we don't
// assert above that !mTimeouts().IsEmpty(), because that's clearly false
// now.
mTimerRunning = false;
}
#ifdef DEBUG