зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1417869. P1 - show more descriptive messages for MEDIA_ERR_SRC_NOT_SUPPORTED when SelectResource() fails. r=jya
MozReview-Commit-ID: CySbHaJCaC5 --HG-- extra : rebase_source : fa907c6347b7c65e0b3196bbd370e7154307e645 extra : source : a393280da765a4602aa1486db8f891cf0fe188ee
This commit is contained in:
Родитель
7e30937e7c
Коммит
232dbce4f6
|
@ -2038,7 +2038,7 @@ void HTMLMediaElement::SelectResource()
|
|||
SetupSrcMediaStreamPlayback(mSrcAttrStream);
|
||||
} else if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NewURIFromString(src, getter_AddRefs(uri));
|
||||
MediaResult rv = NewURIFromString(src, getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
LOG(LogLevel::Debug, ("%p Trying load from src=%s", this, NS_ConvertUTF16toUTF8(src).get()));
|
||||
NS_ASSERTION(!mIsLoadingFromSourceChildren,
|
||||
|
@ -2064,13 +2064,16 @@ void HTMLMediaElement::SelectResource()
|
|||
} else {
|
||||
const char16_t* params[] = { src.get() };
|
||||
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
|
||||
rv = MediaResult(rv.Code(), "MediaLoadInvalidURI");
|
||||
}
|
||||
// The media element has neither a src attribute nor a source element child:
|
||||
// set the networkState to NETWORK_EMPTY, and abort these steps; the
|
||||
// synchronous section ends.
|
||||
mMainThreadEventTarget->Dispatch(NewRunnableMethod<nsCString>(
|
||||
"HTMLMediaElement::NoSupportedMediaSourceError",
|
||||
this, &HTMLMediaElement::NoSupportedMediaSourceError, nsCString()));
|
||||
this,
|
||||
&HTMLMediaElement::NoSupportedMediaSourceError,
|
||||
rv.Description()));
|
||||
} else {
|
||||
// Otherwise, the source elements will be used.
|
||||
mIsLoadingFromSourceChildren = true;
|
||||
|
@ -2494,7 +2497,8 @@ void HTMLMediaElement::UpdatePreloadAction()
|
|||
}
|
||||
}
|
||||
|
||||
nsresult HTMLMediaElement::LoadResource()
|
||||
MediaResult
|
||||
HTMLMediaElement::LoadResource()
|
||||
{
|
||||
AbstractThread::AutoEnter context(AbstractMainThread());
|
||||
|
||||
|
@ -2509,7 +2513,7 @@ nsresult HTMLMediaElement::LoadResource()
|
|||
// Check if media is allowed for the docshell.
|
||||
nsCOMPtr<nsIDocShell> docShell = OwnerDoc()->GetDocShell();
|
||||
if (docShell && !docShell->GetAllowMedia()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return MediaResult(NS_ERROR_FAILURE, "Media not allowed");
|
||||
}
|
||||
|
||||
// Set the media element's CORS mode only when loading a resource
|
||||
|
@ -2533,7 +2537,7 @@ nsresult HTMLMediaElement::LoadResource()
|
|||
GetCurrentSrc(spec);
|
||||
const char16_t* params[] = { spec.get() };
|
||||
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
|
||||
return rv;
|
||||
return MediaResult(rv, "MediaLoadInvalidURI");
|
||||
}
|
||||
SetupSrcMediaStreamPlayback(stream);
|
||||
return NS_OK;
|
||||
|
@ -2556,7 +2560,7 @@ nsresult HTMLMediaElement::LoadResource()
|
|||
// all, due to network errors, causing the user agent to give up
|
||||
// trying to fetch the resource" section of resource fetch algorithm.
|
||||
decoder->Shutdown();
|
||||
return NS_ERROR_FAILURE;
|
||||
return MediaResult(NS_ERROR_FAILURE, "Failed to attach MediaSource");
|
||||
}
|
||||
ChangeDelayLoadStatus(false);
|
||||
nsresult rv = decoder->Load(mMediaSource->GetPrincipal());
|
||||
|
@ -2564,9 +2568,10 @@ nsresult HTMLMediaElement::LoadResource()
|
|||
decoder->Shutdown();
|
||||
LOG(LogLevel::Debug,
|
||||
("%p Failed to load for decoder %p", this, decoder.get()));
|
||||
return rv;
|
||||
return MediaResult(rv, "Fail to load decoder");
|
||||
}
|
||||
return FinishDecoderSetup(decoder);
|
||||
rv = FinishDecoderSetup(decoder);
|
||||
return MediaResult(rv, "Failed to set up decoder");
|
||||
}
|
||||
|
||||
AssertReadyStateIsNothing();
|
||||
|
@ -2576,7 +2581,7 @@ nsresult HTMLMediaElement::LoadResource()
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
mChannelLoader = loader.forget();
|
||||
}
|
||||
return rv;
|
||||
return MediaResult(rv, "Failed to load channel");
|
||||
}
|
||||
|
||||
nsresult HTMLMediaElement::LoadWithChannel(nsIChannel* aChannel,
|
||||
|
|
|
@ -1055,7 +1055,7 @@ protected:
|
|||
/**
|
||||
* The resource-fetch algorithm step of the load algorithm.
|
||||
*/
|
||||
nsresult LoadResource();
|
||||
MediaResult LoadResource();
|
||||
|
||||
/**
|
||||
* Selects the next <source> child from which to load a resource. Called
|
||||
|
|
Загрузка…
Ссылка в новой задаче