Bug 1578609 - part1 : only check source element's type attribute when it's not empty. r=bryce

According to the spec [1], we abort loading only when we're sure the type of source element is something we don't support.

If source element's type is empty, it's equal to not having any type, so we won't have to check can play type, we should start loading to see if we can play it or not.

[1] https://html.spec.whatwg.org/multipage/media.html#loading-the-media-resource:attr-source-type

Differential Revision: https://phabricator.services.mozilla.com/D45269

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alastor Wu 2019-09-10 19:42:25 +00:00
Родитель d31ca19e4d
Коммит 07f8890bbd
1 изменённых файлов: 2 добавлений и 1 удалений

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

@ -2521,7 +2521,8 @@ void HTMLMediaElement::LoadFromSourceChildren() {
// If we have a type attribute, it must be a supported type.
nsAutoString type;
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
!type.IsEmpty()) {
DecoderDoctorDiagnostics diagnostics;
CanPlayStatus canPlay = GetCanPlay(type, &diagnostics);
diagnostics.StoreFormatDiagnostics(OwnerDoc(), type,