зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1417869. P3 - pass descriptive messages to NetworkError(). r=jya
MozReview-Commit-ID: 6yaFJvXG3g8 --HG-- extra : rebase_source : 2d1c851098be7eb880a01432c504c6db96d86756 extra : source : a30f9699f49687b23d4ccf955d7a0af8ce0c7653
This commit is contained in:
Родитель
5e22f505ad
Коммит
1f62c1d92b
|
@ -2411,8 +2411,9 @@ void HTMLMediaElement::ResumeLoad(PreloadAction aAction)
|
|||
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_LOADING);
|
||||
if (!mIsLoadingFromSourceChildren) {
|
||||
// We were loading from the element's src attribute.
|
||||
if (NS_FAILED(LoadResource())) {
|
||||
NoSupportedMediaSourceError();
|
||||
MediaResult rv = LoadResource();
|
||||
if (NS_FAILED(rv)) {
|
||||
NoSupportedMediaSourceError(rv.Description());
|
||||
}
|
||||
} else {
|
||||
// We were loading from a child <source> element. Try to resume the
|
||||
|
@ -5540,10 +5541,11 @@ void HTMLMediaElement::FirstFrameLoaded()
|
|||
}
|
||||
}
|
||||
|
||||
void HTMLMediaElement::NetworkError()
|
||||
void
|
||||
HTMLMediaElement::NetworkError(const MediaResult& aError)
|
||||
{
|
||||
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {
|
||||
NoSupportedMediaSourceError();
|
||||
NoSupportedMediaSourceError(aError.Description());
|
||||
} else {
|
||||
Error(MEDIA_ERR_NETWORK);
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public:
|
|||
|
||||
// Called by the video decoder object, on the main thread,
|
||||
// when the resource has a network error during loading.
|
||||
virtual void NetworkError() final override;
|
||||
virtual void NetworkError(const MediaResult& aError) final override;
|
||||
|
||||
// Called by the video decoder object, on the main thread, when the
|
||||
// resource has a decode error during metadata loading or decoding.
|
||||
|
|
|
@ -58,11 +58,12 @@ ChannelMediaDecoder::ResourceCallback::GetMediaOwner() const
|
|||
}
|
||||
|
||||
void
|
||||
ChannelMediaDecoder::ResourceCallback::NotifyNetworkError()
|
||||
ChannelMediaDecoder::ResourceCallback::NotifyNetworkError(
|
||||
const MediaResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mDecoder) {
|
||||
mDecoder->NetworkError();
|
||||
mDecoder->NetworkError(aError);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +307,7 @@ ChannelMediaDecoder::NotifyDownloadEnded(nsresult aStatus)
|
|||
// Download has been cancelled by user.
|
||||
owner->LoadAborted();
|
||||
} else {
|
||||
NetworkError();
|
||||
NetworkError(MediaResult(aStatus, "Download aborted"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class ChannelMediaDecoder : public MediaDecoder
|
|||
/* MediaResourceCallback functions */
|
||||
AbstractThread* AbstractMainThread() const override;
|
||||
MediaDecoderOwner* GetMediaOwner() const override;
|
||||
void NotifyNetworkError() override;
|
||||
void NotifyNetworkError(const MediaResult& aError) override;
|
||||
void NotifyDataArrived() override;
|
||||
void NotifyDataEnded(nsresult aStatus) override;
|
||||
void NotifyPrincipalChanged() override;
|
||||
|
|
|
@ -185,7 +185,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest,
|
|||
// If the request was cancelled by nsCORSListenerProxy due to failing
|
||||
// the CORS security check, send an error through to the media element.
|
||||
if (status == NS_ERROR_DOM_BAD_URI) {
|
||||
mCallback->NotifyNetworkError();
|
||||
mCallback->NotifyNetworkError(MediaResult(status, "CORS not allowed"));
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +215,8 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest,
|
|||
// work here.
|
||||
mCacheStream.NotifyDataEnded(status);
|
||||
} else {
|
||||
mCallback->NotifyNetworkError();
|
||||
mCallback->NotifyNetworkError(
|
||||
MediaResult(NS_ERROR_FAILURE, "HTTP error"));
|
||||
}
|
||||
|
||||
// This disconnects our listener so we don't get any more data. We
|
||||
|
|
|
@ -865,11 +865,11 @@ MediaDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
|||
}
|
||||
|
||||
void
|
||||
MediaDecoder::NetworkError()
|
||||
MediaDecoder::NetworkError(const MediaResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
||||
GetOwner()->NetworkError();
|
||||
GetOwner()->NetworkError(aError);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
void NotifyXPCOMShutdown();
|
||||
|
||||
// Called if the media file encounters a network error.
|
||||
void NetworkError();
|
||||
void NetworkError(const MediaResult& aError);
|
||||
|
||||
// Return the principal of the current URI being played or downloaded.
|
||||
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() = 0;
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
// when the resource has a network error during loading.
|
||||
// The decoder owner should call Shutdown() on the decoder and drop the
|
||||
// reference to the decoder to prevent further calls into the decoder.
|
||||
virtual void NetworkError() = 0;
|
||||
virtual void NetworkError(const MediaResult& aError) = 0;
|
||||
|
||||
// Called by the decoder object, on the main thread, when the
|
||||
// resource has a decode error during metadata loading or decoding.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "nsError.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "MediaResult.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -36,7 +37,7 @@ public:
|
|||
virtual MediaDecoderOwner* GetMediaOwner() const { return nullptr; }
|
||||
|
||||
// Notify that a network error is encountered.
|
||||
virtual void NotifyNetworkError() {}
|
||||
virtual void NotifyNetworkError(const MediaResult& aError) {}
|
||||
|
||||
// Notify that data arrives on the stream and is read into the cache.
|
||||
virtual void NotifyDataArrived() {}
|
||||
|
|
|
@ -94,7 +94,8 @@ HLSResourceCallbacksSupport::OnError(int aErrorCode)
|
|||
if (self->mDecoder) {
|
||||
// Since HLS source should be from the Internet, we treat all resource errors
|
||||
// from GeckoHlsPlayer as network errors.
|
||||
self->mDecoder->NetworkError();
|
||||
self->mDecoder->NetworkError(
|
||||
MediaResult(NS_ERROR_FAILURE, "HLS error"));
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -360,7 +360,7 @@ MediaSource::EndOfStream(const Optional<MediaSourceEndOfStreamError>& aError, Er
|
|||
}
|
||||
switch (aError.Value()) {
|
||||
case MediaSourceEndOfStreamError::Network:
|
||||
mDecoder->NetworkError();
|
||||
mDecoder->NetworkError(MediaResult(NS_ERROR_FAILURE, "MSE network"));
|
||||
break;
|
||||
case MediaSourceEndOfStreamError::Decode:
|
||||
mDecoder->DecodeError(NS_ERROR_DOM_MEDIA_FATAL_ERR);
|
||||
|
|
Загрузка…
Ссылка в новой задаче