Bug 1550633 - part8 : no need to reload if the new url is the same. r=jya

Accoding to spec [1], after loading finished, the start the track processing model would stop at step12 and wait until the track URL changes to the URL which is not equal to the URL we have loaded before. That means, if we change track URL to the same URL we loaded before, we won't have to reload the resource.

[1] https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks:track-url-5

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2019-05-23 09:03:35 +00:00
Родитель ab8de37693
Коммит 7e5bb0ce04
1 изменённых файлов: 9 добавлений и 0 удалений

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

@ -213,6 +213,15 @@ bool HTMLTrackElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
} }
void HTMLTrackElement::SetSrc(const nsAString& aSrc, ErrorResult& aError) { void HTMLTrackElement::SetSrc(const nsAString& aSrc, ErrorResult& aError) {
LOG(LogLevel::Info,
("%p Set src=%s", this, NS_ConvertUTF16toUTF8(aSrc).get()));
nsAutoString src;
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src) && src == aSrc) {
LOG(LogLevel::Info, ("%p No need to reload for same src url", this));
return;
}
SetHTMLAttr(nsGkAtoms::src, aSrc, aError); SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
SetReadyState(TextTrackReadyState::NotLoaded); SetReadyState(TextTrackReadyState::NotLoaded);
if (!mMediaParent) { if (!mMediaParent) {