Bug 1417869. P2 - pass descriptive messages to NotifyLoadError().
MozReview-Commit-ID: JGPOsLvUJFX
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -540,17 +540,18 @@ HTMLMediaElement::MediaLoadListener::OnS
// We make a note of this media node by including it in a dedicated
// array of blocked tracking nodes under its parent document.
if (status == NS_ERROR_TRACKING_URI) {
nsIDocument* ownerDoc = element->OwnerDoc();
if (ownerDoc) {
ownerDoc->AddBlockedTrackingNode(element);
}
}
- element->NotifyLoadError();
+ element->NotifyLoadError(
+ nsPrintfCString("%u: %s", uint32_t(status), "Request failed"));
}
return status;
}
nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(aRequest);
bool succeeded;
if (hc && NS_SUCCEEDED(hc->GetRequestSucceeded(&succeeded)) && !succeeded) {
uint32_t responseStatus = 0;
@@ -574,17 +575,17 @@ HTMLMediaElement::MediaLoadListener::OnS
NS_SUCCEEDED(rv = element->InitializeDecoderForChannel(channel, getter_AddRefs(mNextListener))) &&
mNextListener) {
rv = mNextListener->OnStartRequest(aRequest, aContext);
} else {
// If InitializeDecoderForChannel() returned an error, fire a network error.
if (NS_FAILED(rv) && !mNextListener) {
// Load failed, attempt to load the next candidate resource. If there
// are none, this will trigger a MEDIA_ERR_SRC_NOT_SUPPORTED error.
- element->NotifyLoadError();
+ element->NotifyLoadError(NS_LITERAL_CSTRING("Failed to init decoder"));
}
// If InitializeDecoderForChannel did not return a listener (but may
// have otherwise succeeded), we abort the connection since we aren't
// interested in keeping the channel alive ourselves.
rv = NS_BINDING_ABORTED;
}
return rv;
@@ -1221,17 +1222,17 @@ public:
nullptr, // aCallbacks
nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE_IF_BUSY |
nsIChannel::LOAD_MEDIA_SNIFFER_OVERRIDES_CONTENT_TYPE |
nsIChannel::LOAD_CLASSIFY_URI |
nsIChannel::LOAD_CALL_CONTENT_SNIFFERS);
if (NS_FAILED(rv)) {
// Notify load error so the element will try next resource candidate.
- aElement->NotifyLoadError();
+ aElement->NotifyLoadError(NS_LITERAL_CSTRING("Fail to create channel"));
return;
}
if (setAttrs) {
nsCOMPtr<nsILoadInfo> loadInfo = channel->GetLoadInfo();
if (loadInfo) {
// The function simply returns NS_OK, so we ignore the return value.
Unused << loadInfo->SetOriginAttributes(triggeringPrincipal->OriginAttributesRef());
@@ -1273,17 +1274,17 @@ public:
false);
MOZ_ASSERT(NS_SUCCEEDED(rv));
aElement->SetRequestHeaders(hc);
}
rv = channel->AsyncOpen2(loadListener);
if (NS_FAILED(rv)) {
// Notify load error so the element will try next resource candidate.
- aElement->NotifyLoadError();
+ aElement->NotifyLoadError(NS_LITERAL_CSTRING("Failed to open channel"));
return;
}
// Else the channel must be open and starting to download. If it encounters
// a non-catastrophic failure, it will set a new task to continue loading
// another candidate. It's safe to set it as mChannel now.
mChannel = channel;