Bug 1344604 - part2: Return empty DocumentFragment if the ConvertCueToDOMTree() return null. r=alwu
authorbechen <bechen@mozilla.com>
Thu, 16 Mar 2017 15:25:56 +0800
changeset 396219 c284d23cc142207f094693e1afb7163f6a44496f
parent 396218 b6252f00b4718a6365aeafc74da81bf1cca525ec
child 396220 64fc7575528e60a79e73beccbdb998064fbf6ca0
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersalwu
bugs1344604, 1307710
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 1344604 - part2: Return empty DocumentFragment if the ConvertCueToDOMTree() return null. r=alwu It is a regression of bug1307710, if something wrong during the ConvertCueToDOMTree() in vtt.jsm, we will get null ptr. MozReview-Commit-ID: LSQrJIhBzRU
dom/media/TextTrackCue.cpp
--- a/dom/media/TextTrackCue.cpp
+++ b/dom/media/TextTrackCue.cpp
@@ -131,16 +131,19 @@ TextTrackCue::GetCueAsHTML()
   nsPIDOMWindowInner* window = mDocument->GetInnerWindow();
   if (!window) {
     return mDocument->CreateDocumentFragment();
   }
 
   nsCOMPtr<nsIDOMDocumentFragment> frag;
   sParserWrapper->ConvertCueToDOMTree(window, this,
                                       getter_AddRefs(frag));
+  if (!frag) {
+    return mDocument->CreateDocumentFragment();
+  }
   return frag.forget().downcast<DocumentFragment>();
 }
 
 void
 TextTrackCue::SetTrackElement(HTMLTrackElement* aTrackElement)
 {
   mTrackElement = aTrackElement;
 }