Bug 1253793 Update ScriptLoader assertion to handle cancelation case. r=khuey
authorBen Kelly <ben@wanderview.com>
Tue, 22 Mar 2016 13:22:15 -0700
changeset 289944 8d7ed429bf8537950c26158d9044b6cf1871b9ee
parent 289943 49db4760ede4ca12713ae43ecb17865a3f9cf67d
child 289945 6495286a5790d50950cb6c2b9afdae0ef1fe4538
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1253793
milestone48.0a1
Bug 1253793 Update ScriptLoader assertion to handle cancelation case. r=khuey
dom/workers/ScriptLoader.cpp
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -1634,25 +1634,27 @@ CacheScriptLoader::ResolvedCallback(JSCo
 }
 
 NS_IMETHODIMP
 CacheScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
                                     nsresult aStatus, uint32_t aStringLen,
                                     const uint8_t* aString)
 {
   AssertIsOnMainThread();
-  MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::ReadingFromCache);
 
   mPump = nullptr;
 
   if (NS_FAILED(aStatus)) {
+    MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::ReadingFromCache ||
+               mLoadInfo.mCacheStatus == ScriptLoadInfo::Cancel);
     Fail(aStatus);
     return NS_OK;
   }
 
+  MOZ_ASSERT(mLoadInfo.mCacheStatus == ScriptLoadInfo::ReadingFromCache);
   mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
 
   MOZ_ASSERT(mPrincipalInfo);
   mRunnable->DataReceivedFromCache(mIndex, aString, aStringLen, mChannelInfo,
                                    Move(mPrincipalInfo));
   return NS_OK;
 }