Bug 604067 - Ensure media loads-from-channels propagate their errors so the controls work correctly. r=roc a=blocking2.0

This commit is contained in:
Chris Pearce 2010-10-17 08:57:50 +13:00
Родитель 95912164df
Коммит 5136f8703c
2 изменённых файлов: 11 добавлений и 9 удалений

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

@ -653,8 +653,8 @@ protected:
// PR_TRUE if we're running the "load()" method.
PRPackedBool mIsRunningLoadMethod;
// PR_TRUE if we're loading exclusively from the src attribute's resource.
PRPackedBool mIsLoadingFromSrcAttribute;
// PR_TRUE if we're loading the resource from the child source elements.
PRPackedBool mIsLoadingFromSourceChildren;
// PR_TRUE if we're delaying the "load" event. They are delayed until either
// an error occurs, or the first frame is loaded.

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

@ -491,7 +491,7 @@ void nsHTMLMediaElement::AbortExistingLoads()
mError = nsnull;
mLoadedFirstFrame = PR_FALSE;
mAutoplaying = PR_TRUE;
mIsLoadingFromSrcAttribute = PR_FALSE;
mIsLoadingFromSourceChildren = PR_FALSE;
mSuspendedAfterFirstFrame = PR_FALSE;
mAllowSuspendAfterFirstFrame = PR_TRUE;
mSourcePointer = nsnull;
@ -654,7 +654,8 @@ void nsHTMLMediaElement::SelectResource()
nsresult rv = NewURIFromString(src, getter_AddRefs(uri));
if (NS_SUCCEEDED(rv)) {
LOG(PR_LOG_DEBUG, ("%p Trying load from src=%s", this, NS_ConvertUTF16toUTF8(src).get()));
mIsLoadingFromSrcAttribute = PR_TRUE;
NS_ASSERTION(!mIsLoadingFromSourceChildren,
"Should think we're not loading from source children by default");
mLoadingSrc = uri;
if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) {
// preload:none media, suspend the load here before we make any
@ -673,6 +674,7 @@ void nsHTMLMediaElement::SelectResource()
NoSupportedMediaSourceError();
} else {
// Otherwise, the source elements will be used.
mIsLoadingFromSourceChildren = PR_TRUE;
LoadFromSourceChildren();
}
mIsRunningSelectResource = PR_FALSE;
@ -680,7 +682,7 @@ void nsHTMLMediaElement::SelectResource()
void nsHTMLMediaElement::NotifyLoadError()
{
if (mIsLoadingFromSrcAttribute) {
if (!mIsLoadingFromSourceChildren) {
LOG(PR_LOG_DEBUG, ("NotifyLoadError(), no supported media error"));
NoSupportedMediaSourceError();
} else {
@ -733,7 +735,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
{
NS_ASSERTION(mDelayingLoadEvent,
"Should delay load event (if in document) during load");
NS_ASSERTION(!mIsLoadingFromSrcAttribute,
NS_ASSERTION(mIsLoadingFromSourceChildren,
"Must remember we're loading from source children");
while (PR_TRUE) {
nsresult rv;
@ -809,7 +811,7 @@ void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
mPreloadAction = aAction;
ChangeDelayLoadStatus(PR_TRUE);
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
if (mIsLoadingFromSrcAttribute) {
if (!mIsLoadingFromSourceChildren) {
// We were loading from the element's src attribute.
if (NS_FAILED(LoadResource(uri))) {
NoSupportedMediaSourceError();
@ -1286,7 +1288,7 @@ nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mWaitingFired(PR_FALSE),
mIsBindingToTree(PR_FALSE),
mIsRunningLoadMethod(PR_FALSE),
mIsLoadingFromSrcAttribute(PR_FALSE),
mIsLoadingFromSourceChildren(PR_FALSE),
mDelayingLoadEvent(PR_FALSE),
mIsRunningSelectResource(PR_FALSE),
mSuspendedAfterFirstFrame(PR_FALSE),
@ -1981,7 +1983,7 @@ void nsHTMLMediaElement::NetworkError()
void nsHTMLMediaElement::DecodeError()
{
if (!mIsLoadingFromSrcAttribute) {
if (mIsLoadingFromSourceChildren) {
NS_ASSERTION(mSourceLoadCandidate, "Must know the source we were loading from!");
if (mDecoder) {
mDecoder->Shutdown();