Bug 910329 - Don't use the channel status as a proxy for load group membership. r=mayhemer, a=lizzard
authorMatthew Gregan <kinetik@flim.org>
Thu, 09 Jun 2016 13:36:58 +1200
changeset 339786 9f1e8d6946eacd1220c8f08d9260d8f1aa33cdd0
parent 339785 8902dc8b9ab1f1e055f6f70a2862392220fa4176
child 339787 a220a220982c3691b9b673c499221e7401d0b3ab
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, lizzard
bugs910329
milestone49.0a2
Bug 910329 - Don't use the channel status as a proxy for load group membership. r=mayhemer, a=lizzard
dom/media/MediaResource.cpp
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -1550,36 +1550,36 @@ void BaseMediaResource::SetLoadInBackgro
     }
     ModifyLoadFlags(loadFlags);
   }
 }
 
 void BaseMediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
 {
   nsCOMPtr<nsILoadGroup> loadGroup;
-  DebugOnly<nsresult> rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
-  NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadGroup() failed!");
+  nsresult rv = mChannel->GetLoadGroup(getter_AddRefs(loadGroup));
+  MOZ_ASSERT(NS_SUCCEEDED(rv), "GetLoadGroup() failed!");
 
   nsresult status;
   mChannel->GetStatus(&status);
 
-  // Note: if (NS_FAILED(status)), the channel won't be in the load group.
-  if (loadGroup &&
-      NS_SUCCEEDED(status)) {
+  bool inLoadGroup = false;
+  if (loadGroup) {
     rv = loadGroup->RemoveRequest(mChannel, nullptr, status);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveRequest() failed!");
+    if (NS_SUCCEEDED(rv)) {
+      inLoadGroup = true;
+    }
   }
 
   rv = mChannel->SetLoadFlags(aFlags);
-  NS_ASSERTION(NS_SUCCEEDED(rv), "SetLoadFlags() failed!");
+  MOZ_ASSERT(NS_SUCCEEDED(rv), "SetLoadFlags() failed!");
 
-  if (loadGroup &&
-      NS_SUCCEEDED(status)) {
+  if (inLoadGroup) {
     rv = loadGroup->AddRequest(mChannel, nullptr);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "AddRequest() failed!");
+    MOZ_ASSERT(NS_SUCCEEDED(rv), "AddRequest() failed!");
   }
 }
 
 void BaseMediaResource::DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset)
 {
   if (aNumBytes <= 0) {
     return;
   }