Bug 1244768 part 3 - modify the resource selection algorithm; r?jwwang
4.8.12.5
https://html.spec.whatwg.org/multipage/embedded-content.html#concept-media-load-algorithm
https://html.spec.whatwg.org/multipage/embedded-content.html#dedicated-media-source-failure-steps
MozReview-Commit-ID: DKFQC4v92Vi
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1690,16 +1690,17 @@ void HTMLMediaElement::AbortExistingLoad
void HTMLMediaElement::NoSupportedMediaSourceError(const nsACString& aErrorDetails)
{
if (mDecoder) {
ShutdownDecoder();
}
mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
ChangeDelayLoadStatus(false);
UpdateAudioChannelPlayingState();
+ RejectPromises(TakePendingPlayPromises(), NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR);
}
typedef void (HTMLMediaElement::*SyncSectionFn)();
// Runs a "synchronous section", a function that must run once the event loop
// has reached a "stable state". See:
// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#synchronous-section
class nsSyncSection : public nsMediaEvent
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -951,16 +951,17 @@ protected:
/**
* Execute the initial steps of the load algorithm that ensure existing
* loads are aborted, the element is emptied, and a new load ID is
* created.
*/
void AbortExistingLoads();
/**
+ * This is the dedicated media source failure steps.
* Called when all potential resources are exhausted. Changes network
* state to NETWORK_NO_SOURCE, and sends error event with code
* MEDIA_ERR_SRC_NOT_SUPPORTED.
*/
void NoSupportedMediaSourceError(const nsACString& aErrorDetails = nsCString());
/**
* Attempts to load resources from the <source> children. This is a