mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1329075 - Fix potential null deref issues in media element track sources. r=jesup
MozReview-Commit-ID: ExUh2magc2z --HG-- extra : rebase_source : 9377109b8b5881d3cc122bc0c1447019dce5e069
This commit is contained in:
parent
13c708b237
commit
03beb7fb5e
@ -2936,6 +2936,11 @@ public:
|
||||
|
||||
CORSMode GetCORSMode() const override
|
||||
{
|
||||
if (!mCapturedTrackSource) {
|
||||
// This could happen during shutdown.
|
||||
return CORS_NONE;
|
||||
}
|
||||
|
||||
return mCapturedTrackSource->GetCORSMode();
|
||||
}
|
||||
|
||||
@ -2954,6 +2959,11 @@ public:
|
||||
|
||||
void PrincipalChanged() override
|
||||
{
|
||||
if (!mCapturedTrackSource) {
|
||||
// This could happen during shutdown.
|
||||
return;
|
||||
}
|
||||
|
||||
mPrincipal = mCapturedTrackSource->GetPrincipal();
|
||||
MediaStreamTrackSource::PrincipalChanged();
|
||||
}
|
||||
@ -2999,10 +3009,12 @@ public:
|
||||
|
||||
void Destroy() override
|
||||
{
|
||||
MOZ_ASSERT(mElement);
|
||||
DebugOnly<bool> res = mElement->RemoveDecoderPrincipalChangeObserver(this);
|
||||
NS_ASSERTION(res, "Removing decoder principal changed observer failed. "
|
||||
"Had it already been removed?");
|
||||
if (mElement) {
|
||||
DebugOnly<bool> res = mElement->RemoveDecoderPrincipalChangeObserver(this);
|
||||
NS_ASSERTION(res, "Removing decoder principal changed observer failed. "
|
||||
"Had it already been removed?");
|
||||
mElement = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
MediaSourceEnum GetMediaSource() const override
|
||||
@ -3012,6 +3024,11 @@ public:
|
||||
|
||||
CORSMode GetCORSMode() const override
|
||||
{
|
||||
if (!mElement) {
|
||||
MOZ_ASSERT(false, "Should always have an element if in use");
|
||||
return CORS_NONE;
|
||||
}
|
||||
|
||||
return mElement->GetCORSMode();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user