Bug 1191491 - Do not dispatch an audio-playback notification when swapping browsers; r=smaug
We send a pagehide event during swapping docshell frame loaders, and before this patch we would not be able to differentiate this event with the one that we send when navigating away from a page, so we would incorrectly dispatch an audio-playback notification indicating that audio playback has stopped. This patch adds a flag to the root docshell when the frame loader swapping is in progress and disables the above behavior when that flag is set.
This commit is contained in:
@@ -103,6 +103,7 @@ static PRLogModuleInfo* gMediaElementEventsLog;
|
||||
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsContentTypeParser.h"
|
||||
#include "nsDocShell.h"
|
||||
|
||||
#include "mozilla/EventStateManager.h"
|
||||
|
||||
@@ -4013,7 +4014,14 @@ void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
|
||||
if (pauseElement && mAudioChannelAgent) {
|
||||
// If the element is being paused since we are navigating away from the
|
||||
// document, notify the audio channel agent.
|
||||
NotifyAudioChannelAgent(false);
|
||||
// Be careful to ignore this event during a docshell frame swap.
|
||||
auto docShell = static_cast<nsDocShell*>(OwnerDoc()->GetDocShell());
|
||||
if (!docShell) {
|
||||
return;
|
||||
}
|
||||
if (!docShell->InFrameSwap()) {
|
||||
NotifyAudioChannelAgent(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user