From 58d248f6f0923476dcef8f155cf969c25ac5da4f Mon Sep 17 00:00:00 2001 From: alwu Date: Wed, 22 May 2019 01:49:35 +0000 Subject: [PATCH] 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 --- dom/html/HTMLTrackElement.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index e4a8390a44fd..0c12b7a09986 100644 --- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -213,6 +213,15 @@ bool HTMLTrackElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, } 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); SetReadyState(TextTrackReadyState::NotLoaded); if (!mMediaParent) {