Bug 1317853 - Remove DOM/speakermanager and related code. r=jst
authorMichelangelo De Simone <mdesimone@mozilla.com>
Wed, 16 Nov 2016 13:14:36 -0800
changeset 322903 8e874a9530d3e3a47ec8923b3e0568328bbc3eb3
parent 322902 ea17d4edd453337325be6140c4e9e8b1dbfd31fd
child 322904 ca02f30bc3a0f9a53a1675770363603f829981da
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersjst
bugs1317853
milestone53.0a1
Bug 1317853 - Remove DOM/speakermanager and related code. r=jst MozReview-Commit-ID: AHkMHalG99K
dom/audiochannel/AudioChannelService.cpp
dom/audiochannel/AudioChannelService.h
dom/bindings/Bindings.conf
dom/events/EventNameList.h
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
dom/moz.build
dom/speakermanager/SpeakerManager.cpp
dom/speakermanager/SpeakerManager.h
dom/speakermanager/SpeakerManagerService.cpp
dom/speakermanager/SpeakerManagerService.h
dom/speakermanager/SpeakerManagerServiceChild.cpp
dom/speakermanager/SpeakerManagerServiceChild.h
dom/speakermanager/moz.build
dom/speakermanager/tests/mochitest.ini
dom/speakermanager/tests/test_speakermanager.html
dom/webidl/MozSpeakerManager.webidl
dom/webidl/moz.build
layout/build/moz.build
widget/EventMessageList.h
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -24,17 +24,16 @@
 #include "nsComponentManagerUtils.h"
 #include "nsGlobalWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/dom/SettingChangeNotificationBinding.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsJSUtils.h"
-#include "SpeakerManagerService.h"
 #endif
 
 #include "mozilla/Preferences.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::hal;
 
@@ -242,19 +241,16 @@ AudioChannelService::Shutdown()
         obs->RemoveObserver(gAudioChannelService, "mozsettings-changed");
 #endif
       }
     }
 
     gAudioChannelService->mWindows.Clear();
     gAudioChannelService->mPlayingChildren.Clear();
     gAudioChannelService->mTabParents.Clear();
-#ifdef MOZ_WIDGET_GONK
-    gAudioChannelService->mSpeakerManager.Clear();
-#endif
 
     gAudioChannelService = nullptr;
   }
 }
 
 /* static */ bool
 AudioChannelService::IsEnableAudioCompeting()
 {
@@ -334,23 +330,16 @@ AudioChannelService::UnregisterAudioChan
   }
 
   // To make sure agent would be alive because AppendAgent() would trigger the
   // callback function of AudioChannelAgentOwner that means the agent might be
   // released in their callback.
   RefPtr<AudioChannelAgent> kungFuDeathGrip(aAgent);
   winData->RemoveAgent(aAgent);
 
-#ifdef MOZ_WIDGET_GONK
-  bool active = AnyAudioChannelIsActive();
-  for (uint32_t i = 0; i < mSpeakerManager.Length(); i++) {
-    mSpeakerManager[i]->SetAudioChannelActive(active);
-  }
-#endif
-
   MaybeSendStatusUpdate();
 }
 
 void
 AudioChannelService::RegisterTabParent(TabParent* aTabParent)
 {
   MOZ_ASSERT(aTabParent);
   MOZ_ASSERT(!mTabParents.Contains(aTabParent));
@@ -566,22 +555,16 @@ AudioChannelService::Observe(nsISupports
     if (winData) {
       nsTObserverArray<AudioChannelAgent*>::ForwardIterator
         iter(winData->mAgents);
       while (iter.HasMore()) {
         iter.GetNext()->WindowVolumeChanged();
       }
     }
 
-#ifdef MOZ_WIDGET_GONK
-    bool active = AnyAudioChannelIsActive();
-    for (uint32_t i = 0; i < mSpeakerManager.Length(); i++) {
-      mSpeakerManager[i]->SetAudioChannelActive(active);
-    }
-#endif
   } else if (!strcmp(aTopic, "ipc:content-shutdown")) {
     nsCOMPtr<nsIPropertyBag2> props = do_QueryInterface(aSubject);
     if (!props) {
       NS_WARNING("ipc:content-shutdown message without property bag as subject");
       return NS_OK;
     }
 
     uint64_t childID = 0;
--- a/dom/audiochannel/AudioChannelService.h
+++ b/dom/audiochannel/AudioChannelService.h
@@ -20,20 +20,16 @@
 
 class nsIRunnable;
 class nsPIDOMWindowOuter;
 struct PRLogModuleInfo;
 
 namespace mozilla {
 namespace dom {
 
-#ifdef MOZ_WIDGET_GONK
-class SpeakerManagerService;
-#endif
-
 class TabParent;
 
 #define NUMBER_OF_AUDIO_CHANNELS (uint32_t)AudioChannel::EndGuard_
 
 class AudioPlaybackConfig
 {
 public:
   AudioPlaybackConfig()
@@ -178,30 +174,16 @@ public:
   // This method needs to know the inner window that wants to capture audio. We
   // group agents per top outer window, but we can have multiple innerWindow per
   // top outerWindow (subiframes, etc.) and we have to identify all the agents
   // just for a particular innerWindow.
   void SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow,
                               uint64_t aInnerWindowID,
                               bool aCapture);
 
-#ifdef MOZ_WIDGET_GONK
-  void RegisterSpeakerManager(SpeakerManagerService* aSpeakerManager)
-  {
-    if (!mSpeakerManager.Contains(aSpeakerManager)) {
-      mSpeakerManager.AppendElement(aSpeakerManager);
-    }
-  }
-
-  void UnregisterSpeakerManager(SpeakerManagerService* aSpeakerManager)
-  {
-    mSpeakerManager.RemoveElement(aSpeakerManager);
-  }
-#endif
-
   static const nsAttrValue::EnumTable* GetAudioChannelTable();
   static AudioChannel GetAudioChannel(const nsAString& aString);
   static AudioChannel GetDefaultAudioChannel();
   static void GetAudioChannelString(AudioChannel aChannel, nsAString& aString);
   static void GetDefaultAudioChannelString(nsAString& aString);
 
   void Notify(uint64_t aWindowID);
 
@@ -337,20 +319,16 @@ private:
 
   void
   RemoveChildStatus(uint64_t aChildID);
 
   nsTObserverArray<nsAutoPtr<AudioChannelWindow>> mWindows;
 
   nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>> mPlayingChildren;
 
-#ifdef MOZ_WIDGET_GONK
-  nsTArray<SpeakerManagerService*>  mSpeakerManager;
-#endif
-
   // Raw pointers because TabParents must unregister themselves.
   nsTArray<TabParent*> mTabParents;
 
   nsCOMPtr<nsIRunnable> mRunnable;
 
   uint64_t mDefChannelChildID;
 
   // These boolean are used to know if we have to send an status update to the
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -583,21 +583,16 @@ DOMInterfaces = {
     'nativeType': 'mozilla::dom::HTMLCanvasPrintState',
 },
 
 'MozChannel': {
     'nativeType': 'nsIChannel',
     'notflattened': True
 },
 
-'MozSpeakerManager': {
-    'nativeType': 'mozilla::dom::SpeakerManager',
-    'headerFile': 'SpeakerManager.h'
-},
-
 'MozPowerManager': {
     'nativeType': 'mozilla::dom::PowerManager',
 },
 
 'MozWakeLock': {
     'nativeType': 'mozilla::dom::WakeLock',
 },
 
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -746,21 +746,16 @@ NON_IDL_EVENT(stop,
               EventNameType_None,
               eBasicEventClass)
 
 NON_IDL_EVENT(warning,
               eMediaRecorderWarning,
               EventNameType_None,
               eBasicEventClass)
 
-NON_IDL_EVENT(speakerforcedchange,
-              eSpeakerForcedChange,
-              EventNameType_None,
-              eBasicEventClass)
-
 // Events that only have on* attributes on XUL elements
 
  // "text" event is legacy event for modifying composition string in EditorBase.
  // This shouldn't be used by web/xul apps.  "compositionupdate" should be
  // used instead.
 NON_IDL_EVENT(text,
               eCompositionChange,
               EventNameType_XUL,
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -149,17 +149,16 @@
 
 #if defined(MOZ_WIDGET_ANDROID)
 #include "APKOpen.h"
 #endif
 
 #if defined(MOZ_WIDGET_GONK)
 #include "nsVolume.h"
 #include "nsVolumeService.h"
-#include "SpeakerManagerService.h"
 #endif
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #include "mozilla/widget/AudioSession.h"
 #endif
 
@@ -1458,31 +1457,16 @@ ContentChild::RecvNotifyLayerAllocated(c
   // Note: sending the constructor could fail, but we do not propagate the
   // error back since the GPU process is fallible.
   APZChild* apz = ContentProcessController::Create(aTabId);
   CompositorBridgeChild::Get()->SendPAPZConstructor(apz, aLayersId);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-ContentChild::RecvSpeakerManagerNotify()
-{
-#ifdef MOZ_WIDGET_GONK
-  // Only notify the process which has the SpeakerManager instance.
-  RefPtr<SpeakerManagerService> service =
-    SpeakerManagerService::GetSpeakerManagerService();
-  if (service) {
-    service->Notify();
-  }
-  return true;
-#endif
-  return IPC_FAIL_NO_REASON(this);
-}
-
-mozilla::ipc::IPCResult
 ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL,
                                      const bool& aHaveBidiKeyboards)
 {
   // bidi is always of type PuppetBidiKeyboard* (because in the child, the only
   // possible implementation of nsIBidiKeyboard is PuppetBidiKeyboard).
   PuppetBidiKeyboard* bidi = static_cast<PuppetBidiKeyboard*>(nsContentUtils::GetBidiKeyboard());
   if (bidi) {
     bidi->SetBidiKeyboardInfo(aIsLangRTL, aHaveBidiKeyboards);
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -370,18 +370,16 @@ public:
   virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override;
 
   virtual mozilla::ipc::IPCResult RecvSetOffline(const bool& offline) override;
 
   virtual mozilla::ipc::IPCResult RecvSetConnectivity(const bool& connectivity) override;
 
   virtual mozilla::ipc::IPCResult RecvNotifyLayerAllocated(const dom::TabId& aTabId, const uint64_t& aLayersId) override;
 
-  virtual mozilla::ipc::IPCResult RecvSpeakerManagerNotify() override;
-
   virtual mozilla::ipc::IPCResult RecvBidiKeyboardNotify(const bool& isLangRTL,
                                                          const bool& haveBidiKeyboards) override;
 
   virtual mozilla::ipc::IPCResult RecvNotifyVisited(const URIParams& aURI) override;
 
   // auto remove when alertfinished is received.
   nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -204,24 +204,16 @@
 #ifdef MOZ_PERMISSIONS
 # include "nsPermissionManager.h"
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 # include "AndroidBridge.h"
 #endif
 
-#ifdef MOZ_WIDGET_GONK
-#include "nsIVolume.h"
-#include "nsVolumeService.h"
-#include "nsIVolumeService.h"
-#include "SpeakerManagerService.h"
-using namespace mozilla::system;
-#endif
-
 #ifdef MOZ_WIDGET_GTK
 #include <gdk/gdk.h>
 #endif
 
 #include "mozilla/RemoteSpellCheckEngineParent.h"
 
 #include "Crypto.h"
 
@@ -3515,45 +3507,16 @@ ContentParent::RecvPSpeechSynthesisConst
 #ifdef MOZ_WEBSPEECH
   return IPC_OK();
 #else
   return false;
 #endif
 }
 
 mozilla::ipc::IPCResult
-ContentParent::RecvSpeakerManagerGetSpeakerStatus(bool* aValue)
-{
-#ifdef MOZ_WIDGET_GONK
-  *aValue = false;
-  RefPtr<SpeakerManagerService> service =
-  SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-
-  *aValue = service->GetSpeakerStatus();
-  return IPC_OK();
-#endif
-  return IPC_FAIL_NO_REASON(this);
-}
-
-mozilla::ipc::IPCResult
-ContentParent::RecvSpeakerManagerForceSpeaker(const bool& aEnable)
-{
-#ifdef MOZ_WIDGET_GONK
-  RefPtr<SpeakerManagerService> service =
-  SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-  service->ForceSpeaker(aEnable, mChildID);
-
-  return IPC_OK();
-#endif
-  return IPC_FAIL_NO_REASON(this);
-}
-
-mozilla::ipc::IPCResult
 ContentParent::RecvStartVisitedQuery(const URIParams& aURI)
 {
   nsCOMPtr<nsIURI> newURI = DeserializeURI(aURI);
   if (!newURI) {
   return IPC_FAIL_NO_REASON(this);
   }
   nsCOMPtr<IHistory> history = services::GetHistoryService();
   if (history) {
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -958,20 +958,16 @@ private:
                                                                       const bool& aHidden) override;
 
   virtual mozilla::ipc::IPCResult RecvAudioChannelServiceStatus(const bool& aTelephonyChannel,
                                                                 const bool& aContentOrNormalChannel,
                                                                 const bool& aAnyChannel) override;
 
   virtual mozilla::ipc::IPCResult RecvGetLookAndFeelCache(nsTArray<LookAndFeelInt>* aLookAndFeelIntCache) override;
 
-  virtual mozilla::ipc::IPCResult RecvSpeakerManagerGetSpeakerStatus(bool* aValue) override;
-
-  virtual mozilla::ipc::IPCResult RecvSpeakerManagerForceSpeaker(const bool& aEnable) override;
-
   virtual mozilla::ipc::IPCResult RecvCreateFakeVolume(const nsString& aFsName,
                                                        const nsString& aMountPoint) override;
 
   virtual mozilla::ipc::IPCResult RecvSetFakeVolumeState(const nsString& aFsName,
                                                          const int32_t& aFsState) override;
 
   virtual mozilla::ipc::IPCResult RecvRemoveFakeVolume(const nsString& fsName) override;
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -451,18 +451,16 @@ child:
     async PMemoryReportRequest(uint32_t generation, bool anonymize,
                                bool minimizeMemoryUsage, MaybeFileDesc DMDFile);
 
     /**
      * Sent to notify that aTabId has been allocated aLayersId
      */
     async NotifyLayerAllocated(TabId aTabId, uint64_t aLayersId);
 
-    async SpeakerManagerNotify();
-
     /**
      * Communication between the PuppetBidiKeyboard and the actual
      * BidiKeyboard hosted by the parent
      */
     async BidiKeyboardNotify(bool isLangRTL, bool haveBidiKeyboards);
 
     /**
      * Dump this process's GC and CC logs to the provided files.
@@ -939,21 +937,16 @@ parent:
 
     async CopyFavicon(URIParams oldURI, URIParams newURI, Principal aLoadingPrincipal, bool isPrivate);
 
     // Tell the compositor to allocate a layer tree id for nested remote mozbrowsers.
     sync AllocateLayerTreeId(ContentParentId cpId, TabId tabId)
         returns (uint64_t id);
     async DeallocateLayerTreeId(uint64_t id);
 
-    sync SpeakerManagerForceSpeaker(bool aEnable);
-
-    sync SpeakerManagerGetSpeakerStatus()
-        returns (bool value);
-
     /**
      * Notifies the parent about a recording device is starting or shutdown.
      * @param recordingStatus starting or shutdown
      * @param pageURL URL that request that changing the recording status
      * @param isAudio recording start with microphone
      * @param isVideo recording start with camera
      */
     async RecordingDeviceEvents(nsString recordingStatus,
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -101,22 +101,16 @@ DIRS += [
     'performance',
     'xhr',
     'worklet',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['plugins/ipc/hangui']
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DIRS += [
-        'speakermanager',
-        'tethering',
-    ]
-
 if CONFIG['MOZ_SECUREELEMENT']:
     DIRS += ['secureelement']
 
 if CONFIG['MOZ_B2G']:
     DIRS += [
         'downloads',
     ]
 
deleted file mode 100644
--- a/dom/speakermanager/SpeakerManager.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "SpeakerManager.h"
-
-#include "mozilla/Services.h"
-
-#include "mozilla/dom/Event.h"
-
-#include "AudioChannelService.h"
-#include "nsIDocShell.h"
-#include "nsIDOMClassInfo.h"
-#include "nsIDOMEventListener.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsIPermissionManager.h"
-#include "SpeakerManagerService.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_QUERY_INTERFACE_INHERITED(SpeakerManager, DOMEventTargetHelper,
-                                  nsIDOMEventListener)
-NS_IMPL_ADDREF_INHERITED(SpeakerManager, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(SpeakerManager, DOMEventTargetHelper)
-
-SpeakerManager::SpeakerManager()
-  : mForcespeaker(false)
-  , mVisible(false)
-{
-  SpeakerManagerService *service =
-    SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-  service->RegisterSpeakerManager(this);
-}
-
-SpeakerManager::~SpeakerManager()
-{
-  SpeakerManagerService *service = SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-
-  service->UnRegisterSpeakerManager(this);
-  nsCOMPtr<EventTarget> target = do_QueryInterface(GetOwner());
-  NS_ENSURE_TRUE_VOID(target);
-
-  target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
-                                    this,
-                                    /* useCapture = */ true);
-}
-
-bool
-SpeakerManager::Speakerforced()
-{
-  // If a background app calls forcespeaker=true that doesn't change anything.
-  // 'speakerforced' remains false everywhere.
-  if (mForcespeaker && !mVisible) {
-    return false;
-  }
-  SpeakerManagerService *service = SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-  return service->GetSpeakerStatus();
-
-}
-
-bool
-SpeakerManager::Forcespeaker()
-{
-  return mForcespeaker;
-}
-
-void
-SpeakerManager::SetForcespeaker(bool aEnable)
-{
-  SpeakerManagerService *service = SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-
-  service->ForceSpeaker(aEnable, mVisible);
-  mForcespeaker = aEnable;
-}
-
-void
-SpeakerManager::DispatchSimpleEvent(const nsAString& aStr)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread");
-  nsresult rv = CheckInnerWindowCorrectness();
-  if (NS_FAILED(rv)) {
-    return;
-  }
-
-  RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
-  event->InitEvent(aStr, false, false);
-  event->SetTrusted(true);
-
-  rv = DispatchDOMEvent(nullptr, event, nullptr, nullptr);
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Failed to dispatch the event!!!");
-    return;
-  }
-}
-
-void
-SpeakerManager::Init(nsPIDOMWindowInner* aWindow)
-{
-  BindToOwner(aWindow);
-
-  nsCOMPtr<nsIDocShell> docshell = GetOwner()->GetDocShell();
-  NS_ENSURE_TRUE_VOID(docshell);
-  docshell->GetIsActive(&mVisible);
-
-  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
-  NS_ENSURE_TRUE_VOID(target);
-
-  target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
-                                 this,
-                                 /* useCapture = */ true,
-                                 /* wantsUntrusted = */ false);
-}
-
-nsPIDOMWindowInner*
-SpeakerManager::GetParentObject() const
-{
-  return GetOwner();
-}
-
-/* static */ already_AddRefed<SpeakerManager>
-SpeakerManager::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
-{
-  nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aGlobal.GetAsSupports());
-  if (!sgo) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsCOMPtr<nsPIDOMWindowInner> ownerWindow = do_QueryInterface(aGlobal.GetAsSupports());
-  if (!ownerWindow) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return nullptr;
-  }
-
-  nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
-  NS_ENSURE_TRUE(permMgr, nullptr);
-
-  uint32_t permission = nsIPermissionManager::DENY_ACTION;
-  nsresult rv =
-    permMgr->TestPermissionFromWindow(ownerWindow, "speaker-control",
-                                      &permission);
-  NS_ENSURE_SUCCESS(rv, nullptr);
-
-  if (permission != nsIPermissionManager::ALLOW_ACTION) {
-    aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
-    return nullptr;
-  }
-
-  RefPtr<SpeakerManager> object = new SpeakerManager();
-  object->Init(ownerWindow);
-  return object.forget();
-}
-
-JSObject*
-SpeakerManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return MozSpeakerManagerBinding::Wrap(aCx, this, aGivenProto);
-}
-
-NS_IMETHODIMP
-SpeakerManager::HandleEvent(nsIDOMEvent* aEvent)
-{
-  nsAutoString type;
-  aEvent->GetType(type);
-
-  if (!type.EqualsLiteral("visibilitychange")) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
-  NS_ENSURE_TRUE(docshell, NS_ERROR_FAILURE);
-  docshell->GetIsActive(&mVisible);
-
-  // If an app that has called forcespeaker=true is switched
-  // from the background to the foreground 'speakerforced'
-  // switches to true in all apps. I.e. the app doesn't have to
-  // call forcespeaker=true again when it comes into foreground.
-  SpeakerManagerService *service =
-    SpeakerManagerService::GetOrCreateSpeakerManagerService();
-  MOZ_ASSERT(service);
-
-  if (mVisible && mForcespeaker) {
-    service->ForceSpeaker(mForcespeaker, mVisible);
-  }
-  // If an application that has called forcespeaker=true, but no audio is
-  // currently playing in the app itself, if application switch to
-  // the background, we switch 'speakerforced' to false.
-  if (!mVisible && mForcespeaker) {
-    RefPtr<AudioChannelService> audioChannelService =
-      AudioChannelService::GetOrCreate();
-    if (audioChannelService && !audioChannelService->AnyAudioChannelIsActive()) {
-      service->ForceSpeaker(false, mVisible);
-    }
-  }
-  return NS_OK;
-}
-
-void
-SpeakerManager::SetAudioChannelActive(bool isActive)
-{
-  if (mForcespeaker) {
-    SpeakerManagerService *service =
-      SpeakerManagerService::GetOrCreateSpeakerManagerService();
-    MOZ_ASSERT(service);
-    service->ForceSpeaker(isActive, mVisible);
-  }
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/speakermanager/SpeakerManager.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 mozilla_dom_SpeakerManager_h
-#define mozilla_dom_SpeakerManager_h
-
-#include "mozilla/DOMEventTargetHelper.h"
-#include "mozilla/dom/MozSpeakerManagerBinding.h"
-
-namespace mozilla {
-namespace dom {
-/* This class is used for UA to control devices's speaker status.
- * After UA set the speaker status, the UA should handle the
- * forcespeakerchange event and change the speaker status in UI.
- * The device's speaker status would set back to normal when UA close the application.
- */
-class SpeakerManager final
-  : public DOMEventTargetHelper
-  , public nsIDOMEventListener
-{
-  friend class SpeakerManagerService;
-  friend class SpeakerManagerServiceChild;
-
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIDOMEVENTLISTENER
-
-public:
-  void Init(nsPIDOMWindowInner* aWindow);
-
-  nsPIDOMWindowInner* GetParentObject() const;
-
-  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-  /**
-   * WebIDL Interface
-   */
-  // Get this api's force speaker setting.
-  bool Forcespeaker();
-  // Force acoustic sound go through speaker. Don't force to speaker if application
-  // stay in the background and re-force when application
-  // go to foreground
-  void SetForcespeaker(bool aEnable);
-  // Get the device's speaker forced setting.
-  bool Speakerforced();
-
-  void SetAudioChannelActive(bool aIsActive);
-  IMPL_EVENT_HANDLER(speakerforcedchange)
-
-  static already_AddRefed<SpeakerManager>
-  Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
-
-protected:
-  SpeakerManager();
-  ~SpeakerManager();
-  void DispatchSimpleEvent(const nsAString& aStr);
-  // This api's force speaker setting
-  bool mForcespeaker;
-  bool mVisible;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_SpeakerManager_h
deleted file mode 100644
--- a/dom/speakermanager/SpeakerManagerService.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "SpeakerManagerService.h"
-#include "SpeakerManagerServiceChild.h"
-#include "mozilla/Services.h"
-#include "mozilla/StaticPtr.h"
-#include "mozilla/Unused.h"
-#include "mozilla/dom/ContentParent.h"
-#include "nsIPropertyBag2.h"
-#include "nsThreadUtils.h"
-#include "nsServiceManagerUtils.h"
-#include "AudioChannelService.h"
-#include <cutils/properties.h>
-
-#define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
-#include "nsIAudioManager.h"
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-StaticRefPtr<SpeakerManagerService> gSpeakerManagerService;
-
-// static
-SpeakerManagerService*
-SpeakerManagerService::GetOrCreateSpeakerManagerService()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!XRE_IsParentProcess()) {
-    return SpeakerManagerServiceChild::GetOrCreateSpeakerManagerService();
-  }
-
-  // If we already exist, exit early
-  if (gSpeakerManagerService) {
-    return gSpeakerManagerService;
-  }
-
-  // Create new instance, register, return
-  RefPtr<SpeakerManagerService> service = new SpeakerManagerService();
-
-  gSpeakerManagerService = service;
-
-  return gSpeakerManagerService;
-}
-
-SpeakerManagerService*
-SpeakerManagerService::GetSpeakerManagerService()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!XRE_IsParentProcess()) {
-    return SpeakerManagerServiceChild::GetSpeakerManagerService();
-  }
-
-  return gSpeakerManagerService;
-}
-
-void
-SpeakerManagerService::Shutdown()
-{
-  if (!XRE_IsParentProcess()) {
-    return SpeakerManagerServiceChild::Shutdown();
-  }
-
-  if (gSpeakerManagerService) {
-    gSpeakerManagerService = nullptr;
-  }
-}
-
-NS_IMPL_ISUPPORTS(SpeakerManagerService, nsIObserver)
-
-void
-SpeakerManagerService::ForceSpeaker(bool aEnable, uint64_t aChildId)
-{
-  TurnOnSpeaker(aEnable);
-  if (aEnable) {
-    mSpeakerStatusSet.Put(aChildId);
-  }
-  Notify();
-  return;
-}
-
-void
-SpeakerManagerService::ForceSpeaker(bool aEnable, bool aVisible)
-{
-  // b2g main process without oop
-  TurnOnSpeaker(aEnable && aVisible);
-  mVisible = aVisible;
-  mOrgSpeakerStatus = aEnable;
-  Notify();
-}
-
-void
-SpeakerManagerService::TurnOnSpeaker(bool aOn)
-{
-  nsCOMPtr<nsIAudioManager> audioManager = do_GetService(NS_AUDIOMANAGER_CONTRACTID);
-  NS_ENSURE_TRUE_VOID(audioManager);
-  int32_t phoneState;
-  audioManager->GetPhoneState(&phoneState);
-  int32_t forceuse = (phoneState == nsIAudioManager::PHONE_STATE_IN_CALL ||
-                      phoneState == nsIAudioManager::PHONE_STATE_IN_COMMUNICATION)
-                        ? nsIAudioManager::USE_COMMUNICATION : nsIAudioManager::USE_MEDIA;
-  if (aOn) {
-    audioManager->SetForceForUse(forceuse, nsIAudioManager::FORCE_SPEAKER);
-  } else {
-    audioManager->SetForceForUse(forceuse, nsIAudioManager::FORCE_NONE);
-  }
-}
-
-bool
-SpeakerManagerService::GetSpeakerStatus()
-{
-  char propQemu[PROPERTY_VALUE_MAX];
-  property_get("ro.kernel.qemu", propQemu, "");
-  if (!strncmp(propQemu, "1", 1)) {
-    return mOrgSpeakerStatus;
-  }
-  nsCOMPtr<nsIAudioManager> audioManager = do_GetService(NS_AUDIOMANAGER_CONTRACTID);
-  NS_ENSURE_TRUE(audioManager, false);
-  int32_t usage;
-  audioManager->GetForceForUse(nsIAudioManager::USE_MEDIA, &usage);
-  return usage == nsIAudioManager::FORCE_SPEAKER;
-}
-
-void
-SpeakerManagerService::Notify()
-{
-  // Parent Notify to all the child processes.
-  nsTArray<ContentParent*> children;
-  ContentParent::GetAll(children);
-  for (uint32_t i = 0; i < children.Length(); i++) {
-    Unused << children[i]->SendSpeakerManagerNotify();
-  }
-
-  for (uint32_t i = 0; i < mRegisteredSpeakerManagers.Length(); i++) {
-    mRegisteredSpeakerManagers[i]->
-      DispatchSimpleEvent(NS_LITERAL_STRING("speakerforcedchange"));
-  }
-}
-
-void
-SpeakerManagerService::SetAudioChannelActive(bool aIsActive)
-{
-  if (!aIsActive && !mVisible) {
-    ForceSpeaker(!mOrgSpeakerStatus, mVisible);
-  }
-}
-
-NS_IMETHODIMP
-SpeakerManagerService::Observe(nsISupports* aSubject,
-                               const char* aTopic,
-                               const char16_t* aData)
-{
-  if (!strcmp(aTopic, "ipc:content-shutdown")) {
-    nsCOMPtr<nsIPropertyBag2> props = do_QueryInterface(aSubject);
-    if (!props) {
-      NS_WARNING("ipc:content-shutdown message without property bag as subject");
-      return NS_OK;
-    }
-
-    uint64_t childID = 0;
-    nsresult rv = props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"),
-                                             &childID);
-    if (NS_SUCCEEDED(rv)) {
-        // If the audio has paused by audiochannel,
-        // the enable flag should be false and don't need to handle.
-        if (mSpeakerStatusSet.Contains(childID)) {
-          TurnOnSpeaker(false);
-          mSpeakerStatusSet.Remove(childID);
-        }
-        if (mOrgSpeakerStatus) {
-          TurnOnSpeaker(!mOrgSpeakerStatus);
-          mOrgSpeakerStatus = false;
-        }
-    } else {
-      NS_WARNING("ipc:content-shutdown message without childID property");
-    }
-  } else if (!strcmp(aTopic, "xpcom-will-shutdown")) {
-    // Note that we need to do this before xpcom-shutdown, since the
-    // AudioChannelService cannot be used past that point.
-    RefPtr<AudioChannelService> audioChannelService =
-      AudioChannelService::GetOrCreate();
-    if (audioChannelService) {
-      audioChannelService->UnregisterSpeakerManager(this);
-    }
-
-    nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-    if (obs) {
-      obs->RemoveObserver(this, "ipc:content-shutdown");
-      obs->RemoveObserver(this, "xpcom-will-shutdown");
-    }
-
-    Shutdown();
-  }
-  return NS_OK;
-}
-
-SpeakerManagerService::SpeakerManagerService()
-  : mOrgSpeakerStatus(false),
-    mVisible(false)
-{
-  MOZ_COUNT_CTOR(SpeakerManagerService);
-  if (XRE_IsParentProcess()) {
-    nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-    if (obs) {
-      obs->AddObserver(this, "ipc:content-shutdown", false);
-      obs->AddObserver(this, "xpcom-will-shutdown", false);
-    }
-  }
-  RefPtr<AudioChannelService> audioChannelService =
-    AudioChannelService::GetOrCreate();
-  if (audioChannelService) {
-    audioChannelService->RegisterSpeakerManager(this);
-  }
-}
-
-SpeakerManagerService::~SpeakerManagerService()
-{
-  MOZ_COUNT_DTOR(SpeakerManagerService);
-}
deleted file mode 100644
--- a/dom/speakermanager/SpeakerManagerService.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 mozilla_dom_SpeakerManagerService_h__
-#define mozilla_dom_SpeakerManagerService_h__
-
-#include "nsIObserver.h"
-#include "nsTArray.h"
-#include "SpeakerManager.h"
-#include "nsIAudioManager.h"
-#include "nsCheapSets.h"
-#include "nsHashKeys.h"
-
-namespace mozilla {
-namespace dom {
-
-class SpeakerManagerService : public nsIObserver
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOBSERVER
-  /*
-   * Return null or instance which has been created.
-   */
-  static SpeakerManagerService* GetSpeakerManagerService();
-  /*
-   * Return SpeakerManagerService instance.
-   * If SpeakerManagerService is not exist, create and return new one.
-   */
-  static SpeakerManagerService* GetOrCreateSpeakerManagerService();
-  virtual void ForceSpeaker(bool aEnable, bool aVisible);
-  virtual bool GetSpeakerStatus();
-  virtual void SetAudioChannelActive(bool aIsActive);
-  // Called by child
-  void ForceSpeaker(bool enable, uint64_t aChildid);
-  // Register the SpeakerManager to service for notify the speakerforcedchange event
-  void RegisterSpeakerManager(SpeakerManager* aSpeakerManager)
-  {
-    mRegisteredSpeakerManagers.AppendElement(aSpeakerManager);
-  }
-  void UnRegisterSpeakerManager(SpeakerManager* aSpeakerManager)
-  {
-    mRegisteredSpeakerManagers.RemoveElement(aSpeakerManager);
-  }
-
-protected:
-  SpeakerManagerService();
-
-  virtual ~SpeakerManagerService();
-  // Notify to UA if device speaker status changed
-  virtual void Notify();
-
-  void TurnOnSpeaker(bool aEnable);
-
-  /**
-   * Shutdown the singleton.
-   */
-  static void Shutdown();
-
-  nsTArray<RefPtr<SpeakerManager> > mRegisteredSpeakerManagers;
-  // Set for remember all the child speaker status
-  nsCheapSet<nsUint64HashKey> mSpeakerStatusSet;
-  // The Speaker status assign by UA
-  bool mOrgSpeakerStatus;
-
-  bool mVisible;
-  // This is needed for IPC communication between
-  // SpeakerManagerServiceChild and this class.
-  friend class ContentParent;
-  friend class ContentChild;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif
deleted file mode 100644
--- a/dom/speakermanager/SpeakerManagerServiceChild.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "SpeakerManagerServiceChild.h"
-#include "mozilla/Services.h"
-#include "mozilla/StaticPtr.h"
-#include "mozilla/Unused.h"
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/ContentParent.h"
-#include "nsIObserverService.h"
-#include "nsThreadUtils.h"
-#include "AudioChannelService.h"
-#include <cutils/properties.h>
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-StaticRefPtr<SpeakerManagerServiceChild> gSpeakerManagerServiceChild;
-
-// static
-SpeakerManagerService*
-SpeakerManagerServiceChild::GetOrCreateSpeakerManagerService()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  // If we already exist, exit early
-  if (gSpeakerManagerServiceChild) {
-    return gSpeakerManagerServiceChild;
-  }
-
-  // Create new instance, register, return
-  RefPtr<SpeakerManagerServiceChild> service = new SpeakerManagerServiceChild();
-
-  gSpeakerManagerServiceChild = service;
-
-  return gSpeakerManagerServiceChild;
-}
-
-// static
-SpeakerManagerService*
-SpeakerManagerServiceChild::GetSpeakerManagerService()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  return gSpeakerManagerServiceChild;
-}
-
-void
-SpeakerManagerServiceChild::ForceSpeaker(bool aEnable, bool aVisible)
-{
-  mVisible = aVisible;
-  mOrgSpeakerStatus = aEnable;
-  ContentChild *cc = ContentChild::GetSingleton();
-  if (cc) {
-    cc->SendSpeakerManagerForceSpeaker(aEnable && aVisible);
-  }
-}
-
-bool
-SpeakerManagerServiceChild::GetSpeakerStatus()
-{
-  ContentChild *cc = ContentChild::GetSingleton();
-  bool status = false;
-  if (cc) {
-    cc->SendSpeakerManagerGetSpeakerStatus(&status);
-  }
-  char propQemu[PROPERTY_VALUE_MAX];
-  property_get("ro.kernel.qemu", propQemu, "");
-  if (!strncmp(propQemu, "1", 1)) {
-    return mOrgSpeakerStatus;
-  }
-  return status;
-}
-
-void
-SpeakerManagerServiceChild::Shutdown()
-{
-  if (gSpeakerManagerServiceChild) {
-    gSpeakerManagerServiceChild = nullptr;
-  }
-}
-
-void
-SpeakerManagerServiceChild::SetAudioChannelActive(bool aIsActive)
-{
-  // Content process and switch to background with no audio and speaker forced.
-  // Then disable speaker
-  for (uint32_t i = 0; i < mRegisteredSpeakerManagers.Length(); i++) {
-    mRegisteredSpeakerManagers[i]->SetAudioChannelActive(aIsActive);
-  }
-}
-
-SpeakerManagerServiceChild::SpeakerManagerServiceChild()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  RefPtr<AudioChannelService> audioChannelService = AudioChannelService::GetOrCreate();
-  if (audioChannelService) {
-    audioChannelService->RegisterSpeakerManager(this);
-  }
-  MOZ_COUNT_CTOR(SpeakerManagerServiceChild);
-}
-
-SpeakerManagerServiceChild::~SpeakerManagerServiceChild()
-{
-  RefPtr<AudioChannelService> audioChannelService = AudioChannelService::GetOrCreate();
-  if (audioChannelService) {
-    audioChannelService->UnregisterSpeakerManager(this);
-  }
-  MOZ_COUNT_DTOR(SpeakerManagerServiceChild);
-}
-
-void
-SpeakerManagerServiceChild::Notify()
-{
-  for (uint32_t i = 0; i < mRegisteredSpeakerManagers.Length(); i++) {
-    mRegisteredSpeakerManagers[i]->DispatchSimpleEvent(NS_LITERAL_STRING("speakerforcedchange"));
-  }
-}
deleted file mode 100644
--- a/dom/speakermanager/SpeakerManagerServiceChild.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 mozilla_dom_SpeakerManagerServicechild_h__
-#define mozilla_dom_SpeakerManagerServicechild_h__
-
-#include "nsISupports.h"
-#include "SpeakerManagerService.h"
-
-namespace mozilla {
-namespace dom {
-/* This class is used to do the IPC to enable/disable speaker status
-   Also handle the application speaker competition problem
-*/
-class SpeakerManagerServiceChild : public SpeakerManagerService
-{
-public:
-  /*
-   * Return null or instance which has been created.
-   */
-  static SpeakerManagerService* GetSpeakerManagerService();
-  /*
-   * Return SpeakerManagerServiceChild instance.
-   * If SpeakerManagerServiceChild is not exist, create and return new one.
-   */
-  static SpeakerManagerService* GetOrCreateSpeakerManagerService();
-  static void Shutdown();
-  virtual void ForceSpeaker(bool aEnable, bool aVisible) override;
-  virtual bool GetSpeakerStatus() override;
-  virtual void SetAudioChannelActive(bool aIsActive) override;
-  virtual void Notify() override;
-protected:
-  SpeakerManagerServiceChild();
-  virtual ~SpeakerManagerServiceChild();
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif
-
deleted file mode 100644
--- a/dom/speakermanager/moz.build
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
-
-EXPORTS += [
-    'SpeakerManager.h',
-    'SpeakerManagerService.h',
-    'SpeakerManagerServiceChild.h',
-]
-
-UNIFIED_SOURCES += [
-    'SpeakerManager.cpp',
-    'SpeakerManagerService.cpp',
-    'SpeakerManagerServiceChild.cpp',
-]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/dom/speakermanager/tests/mochitest.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[DEFAULT]
-
-[test_speakermanager.html]
deleted file mode 100644
--- a/dom/speakermanager/tests/test_speakermanager.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test MozSpeakerManager API</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-  <script type="application/javascript">
-
-  "use strict";
-
-  function testObject() {
-    var mgr = new MozSpeakerManager();
-    var spkforced = false;
-    mgr.onspeakerforcedchange = function() {
-      if (spkforced) {
-        is(mgr.speakerforced, true, 'speaker should be true');
-        spkforced = false;
-        mgr.forcespeaker = false;
-      } else {
-        is(mgr.speakerforced, false, 'speaker should be false');
-        SimpleTest.finish();
-      }
-    }
-    spkforced = true;
-    mgr.forcespeaker = true;
-  }
-
-  function startTests() {
-    // Currently applicable only on FxOS
-    if (navigator.userAgent.indexOf("Mobile") != -1 &&
-        navigator.appVersion.indexOf("Android") == -1) {
-      testObject();
-    } else {
-      ok(true, "MozSpeakerManager on Firefox OS only.");
-      SimpleTest.finish();
-    }
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPermissions(
-    [{ "type": "speaker-control", "allow": 1, "context": document }],
-    startTests);
-
-  </script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/webidl/MozSpeakerManager.webidl
+++ /dev/null
@@ -1,18 +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/.
- */
-
-/*
- * Allow application can control acoustic sound output through speaker.
- * Reference https://wiki.mozilla.org/WebAPI/SpeakerManager
- */
-[Constructor()]
-interface MozSpeakerManager : EventTarget {
-  /* query the speaker status */
-  readonly attribute boolean speakerforced;
-  /* force device device's acoustic sound output through speaker */
-  attribute boolean forcespeaker;
-  /* this event will be fired when device's speaker forced status change */
-  attribute EventHandler onspeakerforcedchange;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -679,17 +679,16 @@ if CONFIG['MOZ_SECUREELEMENT']:
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     WEBIDL_FILES += [
         'MozNetworkStats.webidl',
         'MozNetworkStatsAlarm.webidl',
         'MozNetworkStatsData.webidl',
         'MozNetworkStatsInterface.webidl',
         'MozNetworkStatsManager.webidl',
-        'MozSpeakerManager.webidl',
     ]
 else:
     WEBIDL_FILES += [
         'InstallTrigger.webidl',
     ]
 
 GENERATED_EVENTS_WEBIDL_FILES = [
     'AddonEvent.webidl',
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -34,17 +34,16 @@ LOCAL_INCLUDES += [
     '/dom/canvas',
     '/dom/filesystem',
     '/dom/geolocation',
     '/dom/html',
     '/dom/json',
     '/dom/jsurl',
     '/dom/media',
     '/dom/offline',
-    '/dom/speakermanager',
     '/dom/storage',
     '/dom/svg',
     '/dom/xbl',
     '/dom/xslt/base',
     '/dom/xslt/xml',
     '/dom/xslt/xpath',
     '/dom/xslt/xslt',
     '/dom/xul',
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -421,19 +421,16 @@ NS_EVENT_MESSAGE(eTimeChange)
 NS_EVENT_MESSAGE(eNetworkUpload)
 NS_EVENT_MESSAGE(eNetworkDownload)
 
 // MediaRecorder events.
 NS_EVENT_MESSAGE(eMediaRecorderDataAvailable)
 NS_EVENT_MESSAGE(eMediaRecorderWarning)
 NS_EVENT_MESSAGE(eMediaRecorderStop)
 
-// SpeakerManager events
-NS_EVENT_MESSAGE(eSpeakerForcedChange)
-
 #ifdef MOZ_GAMEPAD
 // Gamepad input events
 NS_EVENT_MESSAGE(eGamepadButtonDown)
 NS_EVENT_MESSAGE(eGamepadButtonUp)
 NS_EVENT_MESSAGE(eGamepadAxisMove)
 NS_EVENT_MESSAGE(eGamepadConnected)
 NS_EVENT_MESSAGE(eGamepadDisconnected)
 NS_EVENT_MESSAGE_FIRST_LAST(eGamepadEvent,