Bug 941701 - Fix crash in TextTrackCue::GetCueAsHTML r=rillian

TextTrackCue::GetCueAsHTML gets called when the HTMLMediaElement
shutsdown which means that TextTrackCue's mDocument sometimes no longer
exists based on when the cycle collector freed it. I've added a null
check to make sure that it exists before we start doing anything.
This commit is contained in:
Rick Eyre 2014-02-14 10:00:00 -08:00
Родитель 6ece642af0
Коммит 3daf27dc4e
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -79,8 +79,8 @@ TextTrackCue::TextTrackCue(nsISupports* aGlobal,
}
}
/** Save a reference to our creating document so it's available
* even when unlinked during discard/teardown.
/** Save a reference to our creating document so we don't have to
* keep getting it from our window.
*/
nsresult
TextTrackCue::StashDocument(nsISupports* aGlobal)
@ -99,7 +99,11 @@ TextTrackCue::StashDocument(nsISupports* aGlobal)
already_AddRefed<DocumentFragment>
TextTrackCue::GetCueAsHTML()
{
MOZ_ASSERT(mDocument);
// mDocument may be null during cycle collector shutdown.
// See bug 941701.
if (!mDocument) {
return nullptr;
}
if (!sParserWrapper) {
nsresult rv;