Bug 1280373 - Fix the label and language attribute in TextTrack object. r=rillian
authorbechen <bechen@mozilla.com>
Thu, 30 Jun 2016 13:36:31 +0800
changeset 303656 589018d53fc5c7fd2090e1c2a5c05b3cc49b6f5d
parent 303655 977e5fd31b3d8f83e3c6b4560f6784fbabdbf49a
child 303657 2456ca84d07250b225359b3dc53033750823ffc7
push id79139
push usercbook@mozilla.com
push dateTue, 05 Jul 2016 13:44:07 +0000
treeherdermozilla-inbound@018db940b995 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1280373
milestone50.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 1280373 - Fix the label and language attribute in TextTrack object. r=rillian MozReview-Commit-ID: 2NFJ5fCCkDy
dom/html/HTMLTrackElement.h
dom/media/TextTrack.cpp
dom/media/TextTrack.h
testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/label.html.ini
testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/language.html.ini
--- a/dom/html/HTMLTrackElement.h
+++ b/dom/html/HTMLTrackElement.h
@@ -50,30 +50,30 @@ public:
   {
     SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
   }
 
   void GetSrclang(DOMString& aSrclang) const
   {
     GetHTMLAttr(nsGkAtoms::srclang, aSrclang);
   }
-  void GetSrclang(nsString& aSrclang) const
+  void GetSrclang(nsAString& aSrclang) const
   {
     GetHTMLAttr(nsGkAtoms::srclang, aSrclang);
   }
   void SetSrclang(const nsAString& aSrclang, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::srclang, aSrclang, aError);
   }
 
   void GetLabel(DOMString& aLabel) const
   {
     GetHTMLAttr(nsGkAtoms::label, aLabel);
   }
-  void GetLabel(nsString& aLabel) const
+  void GetLabel(nsAString& aLabel) const
   {
     GetHTMLAttr(nsGkAtoms::label, aLabel);
   }
   void SetLabel(const nsAString& aLabel, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::label, aLabel, aError);
   }
 
--- a/dom/media/TextTrack.cpp
+++ b/dom/media/TextTrack.cpp
@@ -294,10 +294,29 @@ TextTrack::NotifyCueUpdated(TextTrackCue
     HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
     if (mediaElement) {
       mediaElement->NotifyCueUpdated(aCue);
     }
   }
   SetDirty();
 }
 
+void
+TextTrack::GetLabel(nsAString& aLabel) const
+{
+  if (mTrackElement) {
+    mTrackElement->GetLabel(aLabel);
+  } else {
+    aLabel = mLabel;
+  }
+}
+void
+TextTrack::GetLanguage(nsAString& aLanguage) const
+{
+  if (mTrackElement) {
+    mTrackElement->GetSrclang(aLanguage);
+  } else {
+    aLanguage = mLanguage;
+  }
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/TextTrack.h
+++ b/dom/media/TextTrack.h
@@ -60,24 +60,18 @@ public:
   void SetDefaultSettings();
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   TextTrackKind Kind() const
   {
     return mKind;
   }
-  void GetLabel(nsAString& aLabel) const
-  {
-    aLabel = mLabel;
-  }
-  void GetLanguage(nsAString& aLanguage) const
-  {
-    aLanguage = mLanguage;
-  }
+  void GetLabel(nsAString& aLabel) const;
+  void GetLanguage(nsAString& aLanguage) const;
   void GetInBandMetadataTrackDispatchType(nsAString& aType) const
   {
     aType = mType;
   }
   void GetId(nsAString& aId) const;
 
   TextTrackMode Mode() const
   {
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/label.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[label.html]
-  type: testharness
-  [TextTrack.label]
-    expected: FAIL
-
-  [TextTrack.label, \\u0000]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/embedded-content/media-elements/interfaces/TextTrack/language.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[language.html]
-  type: testharness
-  [TextTrack.language]
-    expected: FAIL
-
-  [TextTrack.language, \\u0000]
-    expected: FAIL
-