mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1184058 - AudioChannelAgent should be muted when used without a proper window object. r=alwu
CLOSED TREE
This commit is contained in:
parent
b6c67c877a
commit
22d8871a7e
@ -103,17 +103,23 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aWindow) {
|
||||
nsCOMPtr<nsPIDOMWindow> pInnerWindow = do_QueryInterface(aWindow);
|
||||
MOZ_ASSERT(pInnerWindow->IsInnerWindow());
|
||||
mInnerWindowID = pInnerWindow->WindowID();
|
||||
if (NS_WARN_IF(!aWindow)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> topWindow;
|
||||
aWindow->GetScriptableTop(getter_AddRefs(topWindow));
|
||||
mWindow = do_QueryInterface(topWindow);
|
||||
if (mWindow) {
|
||||
mWindow = mWindow->GetOuterWindow();
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindow> pInnerWindow = do_QueryInterface(aWindow);
|
||||
MOZ_ASSERT(pInnerWindow->IsInnerWindow());
|
||||
mInnerWindowID = pInnerWindow->WindowID();
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> topWindow;
|
||||
aWindow->GetScriptableTop(getter_AddRefs(topWindow));
|
||||
mWindow = do_QueryInterface(topWindow);
|
||||
if (mWindow) {
|
||||
mWindow = mWindow->GetOuterWindow();
|
||||
}
|
||||
|
||||
if (!mWindow) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mAudioChannelType = aChannelType;
|
||||
@ -134,6 +140,13 @@ NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(uint32_t aNotifyPlayback,
|
||||
MOZ_ASSERT(aVolume);
|
||||
MOZ_ASSERT(aMuted);
|
||||
|
||||
// Window-less AudioChannelAgents are muted by default.
|
||||
if (!mWindow) {
|
||||
*aVolume = 0;
|
||||
*aMuted = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
|
||||
service == nullptr || mIsRegToService) {
|
||||
|
Loading…
Reference in New Issue
Block a user