Bug 1026951 - Assertion failure: NS_IsMainThread() (OnStateStop should only be called on the main thread.). r=sworkman

This commit is contained in:
Michal Novotny 2014-08-14 05:45:00 -04:00
parent 43aad61439
commit bb9e12a5bf

View File

@ -469,6 +469,16 @@ nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream)
// EnsureWaiting isn't blocked by it.
mProcessingCallbacks = false;
// We must break the loop when we're switching event delivery to another
// thread and the input stream pump is suspended, otherwise
// OnStateStop() might be called off the main thread. See bug 1026951
// comment #107 for the exact scenario.
if (mSuspendCount && mRetargeting) {
mState = nextState;
mWaitingForInputStreamReady = false;
break;
}
// Wait asynchronously if there is still data to transfer, or we're
// switching event delivery to another thread.
if (!mSuspendCount && (stillTransferring || mRetargeting)) {