Bug 1044773 - the window can be null when AudioChannelAgent is created, r=roc

This commit is contained in:
Andrea Marchesini 2014-08-05 15:05:58 +01:00
parent a5f10e8402
commit 2fb6da5400
2 changed files with 5 additions and 3 deletions

View File

@ -3895,6 +3895,11 @@ void HTMLMediaElement::UpdateAudioChannelPlayingState()
if (playingThroughTheAudioChannel != mPlayingThroughTheAudioChannel) {
mPlayingThroughTheAudioChannel = playingThroughTheAudioChannel;
// If we are not playing, we don't need to create a new audioChannelAgent.
if (!mAudioChannelAgent && !mPlayingThroughTheAudioChannel) {
return;
}
if (!mAudioChannelAgent) {
nsresult rv;
mAudioChannelAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1", &rv);

View File

@ -80,9 +80,6 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
nsIAudioChannelAgentCallback *aCallback,
bool aUseWeakRef, bool aWithVideo)
{
// We need the window only for IPC.
MOZ_ASSERT(aWindow || XRE_GetProcessType() == GeckoProcessType_Default);
// We syncd the enum of channel type between nsIAudioChannelAgent.idl and
// AudioChannelBinding.h the same.
MOZ_ASSERT(int(AUDIO_AGENT_CHANNEL_NORMAL) == int(AudioChannel::Normal) &&