Bug 1550633 - part8 : no need to reload if the new url is the same. r=jya
☠☠ backed out by 6acae89335b0 ☠ ☠
authoralwu <alwu@mozilla.com>
Thu, 23 May 2019 09:03:35 +0000
changeset 475257 470d8fae0461968d745100f64c23aa296f0d9a05
parent 475256 8024fcefe8b13d215211cbfe09f979998f3c5217
child 475258 afaef937598b8c46c009a0523c0fbe4ba61c6c25
push id36058
push useraciure@mozilla.com
push dateFri, 24 May 2019 03:53:25 +0000
treeherdermozilla-central@c87317c41902 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1550633
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/html/HTMLTrackElement.cpp
--- a/dom/html/HTMLTrackElement.cpp
+++ b/dom/html/HTMLTrackElement.cpp
@@ -208,16 +208,25 @@ bool HTMLTrackElement::ParseAttribute(in
   }
 
   // Otherwise call the generic implementation.
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                               aMaybeScriptedPrincipal, aResult);
 }
 
 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) {
     return;
   }
 
   // Stop WebVTTListener.
   mListener = nullptr;