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:
Ehsan Akhgari
2015-08-06 10:03:24 -04:00
parent e79a496046
commit 9e1ae0a6f8
6 changed files with 68 additions and 6 deletions

View File

@@ -900,6 +900,7 @@ nsDocShell::nsDocShell()
, mUseRemoteTabs(false)
, mDeviceSizeIsPageSize(false)
, mWindowDraggingAllowed(false)
, mInFrameSwap(false)
, mCanExecuteScripts(false)
, mFiredUnloadEvent(false)
, mEODForCurrentDocument(false)
@@ -14074,3 +14075,16 @@ nsDocShell::GetPaymentRequestId(nsAString& aPaymentRequestId)
aPaymentRequestId = GetInheritedPaymentRequestId();
return NS_OK;
}
bool
nsDocShell::InFrameSwap()
{
nsRefPtr<nsDocShell> shell = this;
do {
if (shell->mInFrameSwap) {
return true;
}
shell = shell->GetParentDocshell();
} while (shell);
return false;
}