Bug 1374930. P2 - add an entry only after FinishDecoderSetup() succeeds. r=cpearce

MozReview-Commit-ID: 6MKRhVIZ4Z6
This commit is contained in:
JW Wang
2017-06-20 15:27:45 +08:00
parent b1c2027a8e
commit e1ce375b5d

View File

@@ -4685,7 +4685,13 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
mChannelLoader = nullptr;
}
return FinishDecoderSetup(decoder, resource, aListener);
nsresult rv = FinishDecoderSetup(decoder, resource, aListener);
if (NS_SUCCEEDED(rv)) {
AddMediaElementToURITable();
NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 1,
"Media element should have single table entry if decode initialized");
}
return rv;
}
nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
@@ -4751,8 +4757,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
mChannelLoader = nullptr;
}
AddMediaElementToURITable();
// We may want to suspend the new stream now.
// This will also do an AddRemoveSelfReference.
NotifyOwnerDocumentActivityChanged();
@@ -4768,9 +4772,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
ShutdownDecoder();
}
NS_ASSERTION(NS_SUCCEEDED(rv) == (MediaElementTableCount(this, mLoadingSrc) == 1),
"Media element should have single table entry if decode initialized");
return rv;
}