Bug 1411504. P8 - return an error for RecreateChannel() when the decoder is shutting down. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 25 Oct 2017 09:45:14 +0800
changeset 687250 fc4e976431be6f65f78ffd9d78815935eac499ef
parent 687249 c7d38ffe73d4984a64c8739ec8d64d3373b33fed
child 687257 3d1138d52be195ad8037b71fa6978448637b3618
push id86457
push userjwwang@mozilla.com
push dateFri, 27 Oct 2017 02:39:04 +0000
bugs1411504
milestone58.0a1
Bug 1411504. P8 - return an error for RecreateChannel() when the decoder is shutting down. Otherwise Seek() will continue to call OpenChannel() and hit null-deref for mChannel is null. MozReview-Commit-ID: 4nhbF9lUOSR
dom/media/ChannelMediaResource.cpp
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -739,22 +739,22 @@ ChannelMediaResource::RecreateChannel()
   nsLoadFlags loadFlags =
     nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE_IF_BUSY |
     nsIChannel::LOAD_CLASSIFY_URI |
     (mLoadInBackground ? nsIRequest::LOAD_BACKGROUND : 0);
 
   MediaDecoderOwner* owner = mCallback->GetMediaOwner();
   if (!owner) {
     // The decoder is being shut down, so don't bother opening a new channel
-    return NS_OK;
+    return NS_ERROR_ABORT;
   }
   dom::HTMLMediaElement* element = owner->GetMediaElement();
   if (!element) {
     // The decoder is being shut down, so don't bother opening a new channel
-    return NS_OK;
+    return NS_ERROR_ABORT;
   }
   nsCOMPtr<nsILoadGroup> loadGroup = element->GetDocumentLoadGroup();
   NS_ENSURE_TRUE(loadGroup, NS_ERROR_NULL_POINTER);
 
   nsSecurityFlags securityFlags = element->ShouldCheckAllowOrigin()
                                   ? nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS
                                   : nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;