Bug 1550633 - part15 : return error when we failed to create channel. r=jya
☠☠ backed out by 6acae89335b0 ☠ ☠
authoralwu <alwu@mozilla.com>
Thu, 23 May 2019 09:03:08 +0000
changeset 475270 bbd8f62b9bff25922b19925a83cf287be4b2dc1d
parent 475269 583d4e0945ad964ef5a9cc1a8ccec8faa248e32b
child 475271 e1a33576d6ad38789b39e381c2ebaac2c2a81b93
push id36058
push useraciure@mozilla.com
push dateFri, 24 May 2019 03:53:25 +0000
treeherdermozilla-central@c87317c41902 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1550633
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550633 - part15 : return error when we failed to create channel. r=jya The channel might not be created correctly if we pass invaild url (eg. "invalid://url"), we should handle this error. Differential Revision: https://phabricator.services.mozilla.com/D32038
dom/html/HTMLTrackElement.cpp
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -353,17 +353,21 @@ void HTMLTrackElement::LoadResource(RefP
         nsCOMPtr<nsIChannel> channel;
         nsCOMPtr<nsILoadGroup> loadGroup = OwnerDoc()->GetDocumentLoadGroup();
         nsresult rv = NS_NewChannel(getter_AddRefs(channel), uri,
                                     static_cast<Element*>(this), secFlags,
                                     nsIContentPolicy::TYPE_INTERNAL_TRACK,
                                     nullptr,  // PerformanceStorage
                                     loadGroup);
 
-        NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
+        if (NS_FAILED(rv)) {
+          LOG("create channel failed.");
+          SetReadyState(TextTrackReadyState::FailedToLoad);
+          return;
+        }
 
         channel->SetNotificationCallbacks(mListener);
 
         LOG("opening webvtt channel");
         rv = channel->AsyncOpen(mListener);
 
         if (NS_FAILED(rv)) {
           SetReadyState(TextTrackReadyState::FailedToLoad);