Bug 1371408 - stylo: MediaList getter should return null when string is not found; r=bholley
authorManish Goregaokar <manishearth@gmail.com>
Thu, 08 Jun 2017 13:32:25 -0700
changeset 413557 be872a73b67be9e0f1f9ec5e4b1132d7b862545f
parent 413556 bfc4b019d8e81e3172dafda44ff36f38ab440a5e
child 413558 cff7d788936904e78a5b499ad2782fb4f21cf2b1
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1371408
milestone55.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 1371408 - stylo: MediaList getter should return null when string is not found; r=bholley MozReview-Commit-ID: Ic17C29dX33
layout/style/ServoMediaList.cpp
--- a/layout/style/ServoMediaList.cpp
+++ b/layout/style/ServoMediaList.cpp
@@ -51,16 +51,19 @@ ServoMediaList::Length()
   return Servo_MediaList_GetLength(mRawList);
 }
 
 void
 ServoMediaList::IndexedGetter(uint32_t aIndex, bool& aFound,
                               nsAString& aReturn)
 {
   aFound = Servo_MediaList_GetMediumAt(mRawList, aIndex, &aReturn);
+  if (!aFound) {
+    SetDOMStringToNull(aReturn);
+  }
 }
 
 nsresult
 ServoMediaList::Append(const nsAString& aNewMedium)
 {
   if (aNewMedium.IsEmpty()) {
     return NS_ERROR_DOM_NOT_FOUND_ERR;
   }