Bug 1376004. P1 - include http response code in the error.message field so the UI has more details to display a proper error message. r=cpearce

MozReview-Commit-ID: CHBXZZxfPc0

--HG--
extra : rebase_source : 004f5bb3552b8d2b8b3b911887037c78e7cb9e79
This commit is contained in:
JW Wang 2017-07-14 15:17:32 +08:00
Родитель a68304f47e
Коммит 51b253855d
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -534,9 +534,13 @@ HTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* aRequest,
nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(aRequest);
bool succeeded;
if (hc && NS_SUCCEEDED(hc->GetRequestSucceeded(&succeeded)) && !succeeded) {
element->NotifyLoadError();
uint32_t responseStatus = 0;
Unused << hc->GetResponseStatus(&responseStatus);
nsAutoCString statusText;
Unused << hc->GetResponseStatusText(statusText);
element->NotifyLoadError(
nsPrintfCString("%u: %s", responseStatus, statusText.get()));
nsAutoString code;
code.AppendInt(responseStatus);
nsAutoString src;
@ -2046,11 +2050,12 @@ void HTMLMediaElement::SelectResource()
}
}
void HTMLMediaElement::NotifyLoadError()
void
HTMLMediaElement::NotifyLoadError(const nsACString& aErrorDetails)
{
if (!mIsLoadingFromSourceChildren) {
LOG(LogLevel::Debug, ("NotifyLoadError(), no supported media error"));
NoSupportedMediaSourceError();
NoSupportedMediaSourceError(aErrorDetails);
} else if (mSourceLoadCandidate) {
DispatchAsyncSourceError(mSourceLoadCandidate);
QueueLoadFromSourceTask();

Просмотреть файл

@ -331,7 +331,7 @@ public:
* Called when there's been an error fetching the resource. This decides
* whether it's appropriate to fire an error event.
*/
void NotifyLoadError();
void NotifyLoadError(const nsACString& aErrorDetails = nsCString());
/**
* Called by one of our associated MediaTrackLists (audio/video) when an