Bug 1953680 Reorder media event error event and state handling to align more closely with spec r=media-playback-reviewers,padenot
The error event is no longer dispatched when "The fetching process for the media resource was aborted by the user agent at the user's request." https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-media_err_aborted This path could be reached only when a channel ends with NS_BINDING_ABORTED before HAVE_METADATA. https://searchfox.org/mozilla-central/rev/3a3965bc78cf76f23ac0569c7f3c98b15f1dca5c/dom/media/ChannelMediaDecoder.cpp#331,333 I don't know of any UI to trigger this state. The reordering has no observable effect as the events are still being queued for later dispatch. Differential Revision: https://phabricator.services.mozilla.com/D243056
This commit is contained in:
@@ -2012,12 +2012,9 @@ class HTMLMediaElement::ErrorSink {
|
||||
}
|
||||
|
||||
ReportErrorProbe(aErrorCode, aResult);
|
||||
mError = new MediaError(mOwner, aErrorCode,
|
||||
aResult ? aResult->Message() : nsCString());
|
||||
mOwner->QueueEvent(u"error"_ns);
|
||||
if (mOwner->ReadyState() == HAVE_NOTHING &&
|
||||
aErrorCode == MEDIA_ERR_ABORTED) {
|
||||
// https://html.spec.whatwg.org/multipage/embedded-content.html#media-data-processing-steps-list
|
||||
// https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list
|
||||
// "If the media data fetching process is aborted by the user"
|
||||
mOwner->QueueEvent(u"abort"_ns);
|
||||
mOwner->ChangeNetworkState(NETWORK_EMPTY);
|
||||
@@ -2025,11 +2022,21 @@ class HTMLMediaElement::ErrorSink {
|
||||
if (mOwner->mDecoder) {
|
||||
mOwner->ShutdownDecoder();
|
||||
}
|
||||
} else if (aErrorCode == MEDIA_ERR_SRC_NOT_SUPPORTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aErrorCode == MEDIA_ERR_SRC_NOT_SUPPORTED) {
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dedicated-media-source-failure-steps
|
||||
mOwner->ChangeNetworkState(NETWORK_NO_SOURCE);
|
||||
} else {
|
||||
// https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list
|
||||
// "If the connection is interrupted after some media data has been
|
||||
// received" or "If the media data is corrupted"
|
||||
mOwner->ChangeNetworkState(NETWORK_IDLE);
|
||||
}
|
||||
mError = new MediaError(mOwner, aErrorCode,
|
||||
aResult ? aResult->Message() : nsCString());
|
||||
mOwner->QueueEvent(u"error"_ns);
|
||||
}
|
||||
|
||||
void ResetError() { mError = nullptr; }
|
||||
|
||||
Reference in New Issue
Block a user