diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index add8fb136f00..4c979acc0d50 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -218,7 +218,6 @@ #include "nsIScriptSecurityManager.h" #include "nsIServiceWorkerManager.h" #include "nsISiteSecurityService.h" -#include "nsISound.h" #include "nsIStringBundle.h" #include "nsITimer.h" #include "nsIURL.h" @@ -3631,47 +3630,6 @@ ContentParent::AllocPClipboardWriteRequestParent( return request.forget(); } -mozilla::ipc::IPCResult ContentParent::RecvPlaySound(nsIURI* aURI) { - // If the check here fails, it can only mean that this message was spoofed. - if (!aURI || !aURI->SchemeIs("chrome")) { - // PlaySound only accepts a valid chrome URI. - return IPC_FAIL(this, "Invalid aURI passed."); - } - nsCOMPtr soundURL(do_QueryInterface(aURI)); - if (!soundURL) { - return IPC_OK(); - } - - nsresult rv; - nsCOMPtr sound(do_GetService(NS_SOUND_CID, &rv)); - NS_ENSURE_SUCCESS(rv, IPC_OK()); - - sound->Play(soundURL); - - return IPC_OK(); -} - -mozilla::ipc::IPCResult ContentParent::RecvBeep() { - nsresult rv; - nsCOMPtr sound(do_GetService(NS_SOUND_CID, &rv)); - NS_ENSURE_SUCCESS(rv, IPC_OK()); - - sound->Beep(); - - return IPC_OK(); -} - -mozilla::ipc::IPCResult ContentParent::RecvPlayEventSound( - const uint32_t& aEventId) { - nsresult rv; - nsCOMPtr sound(do_GetService(NS_SOUND_CID, &rv)); - NS_ENSURE_SUCCESS(rv, IPC_OK()); - - sound->PlayEventSound(aEventId); - - return IPC_OK(); -} - mozilla::ipc::IPCResult ContentParent::RecvGetIconForExtension( const nsACString& aFileExt, const uint32_t& aIconSize, nsTArray* bits) { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 2e9a4e957f53..c3d44f57f468 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -1002,10 +1002,6 @@ class ContentParent final : public PContentParent, already_AddRefed AllocPClipboardWriteRequestParent(const int32_t& aClipboardType); - mozilla::ipc::IPCResult RecvPlaySound(nsIURI* aURI); - mozilla::ipc::IPCResult RecvBeep(); - mozilla::ipc::IPCResult RecvPlayEventSound(const uint32_t& aEventId); - mozilla::ipc::IPCResult RecvGetIconForExtension(const nsACString& aFileExt, const uint32_t& aIconSize, nsTArray* bits); diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 1349e75750cc..229f88c886eb 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -1240,12 +1240,6 @@ parent: */ async PClipboardWriteRequest(int32_t aClipboardType); - // 'Play', 'Beep' and 'PlayEventSound' are the only nsISound methods used in - // the content process. - [Compress] async PlaySound(nullable nsIURI aURL); - [Compress] async Beep(); - [Compress] async PlayEventSound(uint32_t aEventId); - sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize) returns (uint8_t[] bits); diff --git a/widget/cocoa/components.conf b/widget/cocoa/components.conf index 2f9cb911367f..e8570fd50205 100644 --- a/widget/cocoa/components.conf +++ b/widget/cocoa/components.conf @@ -44,8 +44,8 @@ Classes = [ 'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_GMPLUGIN_PROCESS, }, { - 'cid': '{15cc80a9-5329-4fcb-9a0b-c6cf1440ae51}', - 'contract_ids': ['@mozilla.org/parent/sound;1'], + 'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}', + 'contract_ids': ['@mozilla.org/sound;1'], 'type': 'nsSound', 'processes': ProcessSelector.MAIN_PROCESS_ONLY, }, diff --git a/widget/components.conf b/widget/components.conf index 4fa7da3bc9cf..ecf1cd5009c8 100644 --- a/widget/components.conf +++ b/widget/components.conf @@ -64,21 +64,6 @@ Classes = [ 'processes': ProcessSelector.CONTENT_PROCESS_ONLY, }, - { - 'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}', - 'contract_ids': ['@mozilla.org/sound;1'], - 'singleton': True, - 'constructor': 'nsSoundSelector', - 'headers': ['/widget/nsContentProcessWidgetFactory.h'], - }, - { - 'cid': '{b02c2470-6e5a-4865-a202-8b5ebae52632}', - 'type': 'nsSoundProxy', - 'headers': ['/widget/nsSoundProxy.h'], - 'contract_ids': ['@mozilla.org/content/sound;1'], - 'processes': ProcessSelector.CONTENT_PROCESS_ONLY, - }, - { 'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}', 'contract_ids': ['@mozilla.org/gfx/screenmanager;1'], diff --git a/widget/gtk/components.conf b/widget/gtk/components.conf index 851de59d0c66..541df9337833 100644 --- a/widget/gtk/components.conf +++ b/widget/gtk/components.conf @@ -55,8 +55,8 @@ Classes = [ 'headers': ['/widget/nsHTMLFormatConverter.h'], }, { - 'cid': '{e711c28b-c1f1-4b87-8448-e1e0da0a7b7d}', - 'contract_ids': ['@mozilla.org/parent/sound;1'], + 'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}', + 'contract_ids': ['@mozilla.org/sound;1'], 'singleton': True, 'type': 'nsISound', 'constructor': 'nsSound::GetInstance', diff --git a/widget/moz.build b/widget/moz.build index e235869060dd..d40d03e5b8d4 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -242,7 +242,6 @@ UNIFIED_SOURCES += [ "nsIWidgetListener.cpp", "nsPrimitiveHelpers.cpp", "nsPrintSettingsImpl.cpp", - "nsSoundProxy.cpp", "nsTransferable.cpp", "nsUserIdleService.cpp", "nsXPLookAndFeel.cpp", diff --git a/widget/nsContentProcessWidgetFactory.h b/widget/nsContentProcessWidgetFactory.h index 24c09a6e48a0..eb2d5a042d5f 100644 --- a/widget/nsContentProcessWidgetFactory.h +++ b/widget/nsContentProcessWidgetFactory.h @@ -47,8 +47,6 @@ MAKE_COMPONENT_CHOOSER(nsScreenManagerSelector, "@mozilla.org/gfx/parent/screenmanager;1", "@mozilla.org/gfx/content/screenmanager;1", do_GetService) -MAKE_COMPONENT_CHOOSER(nsSoundSelector, "@mozilla.org/parent/sound;1", - "@mozilla.org/content/sound;1", do_GetService) MAKE_COMPONENT_CHOOSER(nsDragServiceSelector, "@mozilla.org/widget/parent/dragservice;1", "@mozilla.org/widget/content/dragservice;1", diff --git a/widget/nsSoundProxy.cpp b/widget/nsSoundProxy.cpp deleted file mode 100644 index e991fa240ecf..000000000000 --- a/widget/nsSoundProxy.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/dom/ContentChild.h" -#include "mozilla/ipc/URIUtils.h" -#include "nsIURL.h" -#include "nsIURI.h" -#include "nsSoundProxy.h" - -using namespace mozilla; -using namespace mozilla::dom; - -NS_IMPL_ISUPPORTS(nsSoundProxy, nsISound) - -NS_IMETHODIMP -nsSoundProxy::Play(nsIURL* aURL) { - MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content); - // Only allow playing a chrome:// URL from the content process. - if (!aURL || !aURL->SchemeIs("chrome")) { - return NS_ERROR_FAILURE; - } - - ContentChild::GetSingleton()->SendPlaySound(aURL); - return NS_OK; -} - -NS_IMETHODIMP -nsSoundProxy::Beep() { - MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content); - - ContentChild::GetSingleton()->SendBeep(); - return NS_OK; -} - -NS_IMETHODIMP -nsSoundProxy::Init() { - MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content); - MOZ_DIAGNOSTIC_ASSERT(false, "Only called by XUL in the parent process."); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsSoundProxy::PlayEventSound(uint32_t aEventId) { - MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content); - - ContentChild::GetSingleton()->SendPlayEventSound(aEventId); - return NS_OK; -} diff --git a/widget/nsSoundProxy.h b/widget/nsSoundProxy.h deleted file mode 100644 index d6ffc38ba119..000000000000 --- a/widget/nsSoundProxy.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef NS_SOUND_PROXY_H -#define NS_SOUND_PROXY_H - -#include "nsISound.h" - -class nsSoundProxy final : public nsISound { - public: - NS_DECL_ISUPPORTS - NS_DECL_NSISOUND - - nsSoundProxy() = default; - - private: - ~nsSoundProxy() = default; -}; - -#endif diff --git a/widget/windows/components.conf b/widget/windows/components.conf index 5684dde1ace6..7a9cdbe35c35 100644 --- a/widget/windows/components.conf +++ b/widget/windows/components.conf @@ -37,8 +37,8 @@ Classes = [ 'headers': ['/widget/windows/nsUserIdleServiceWin.h', 'nsUserIdleService.h'], }, { - 'cid': '{919f1217-073a-4a14-b034-67d461eccacc}', - 'contract_ids': ['@mozilla.org/parent/sound;1'], + 'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}', + 'contract_ids': ['@mozilla.org/sound;1'], 'singleton': True, 'type': 'nsISound', 'constructor': 'nsSound::GetInstance',