Bug 1325172 - unregister agent when nsNPAPI releases it. r=baku

When the global window detroyed, the service would notify agent's callback to mute its volume.
And the nsNSNPAPI's detroy would release the agent, I guess these things would happen in the same time.
So we should check whether the agent exists before calling agent's function.

MozReview-Commit-ID: 7uNmbdOLqxe

--HG--
extra : rebase_source : a93f70b34f881a06439ef237217d472fa9d886b1
This commit is contained in:
Alastor Wu 2016-12-23 15:04:51 +08:00
Родитель c25c957225
Коммит 9bd913bac6
1 изменённых файлов: 7 добавлений и 5 удалений

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

@ -1797,11 +1797,13 @@ nsNPAPIPluginInstance::WindowVolumeChanged(float aVolume, bool aMuted)
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "SetMuted failed");
if (mMuted != aMuted) {
mMuted = aMuted;
AudioChannelService::AudibleState audible = aMuted ?
AudioChannelService::AudibleState::eNotAudible :
AudioChannelService::AudibleState::eAudible;
mAudioChannelAgent->NotifyStartedAudible(audible,
AudioChannelService::AudibleChangedReasons::eVolumeChanged);
if (mAudioChannelAgent) {
AudioChannelService::AudibleState audible = aMuted ?
AudioChannelService::AudibleState::eNotAudible :
AudioChannelService::AudibleState::eAudible;
mAudioChannelAgent->NotifyStartedAudible(audible,
AudioChannelService::AudibleChangedReasons::eVolumeChanged);
}
}
return rv;
}