Backed out changeset 5f709b46eebc (bug 864485)
authorEd Morley <emorley@mozilla.com>
Thu, 05 Sep 2013 11:52:35 +0100
changeset 158574 e273e39089cb81480e6a28c959151c645131012b
parent 158573 c1ea56013ce9fc179cc53a0fc09be591ade1b4e7
child 158575 d545f426a57f3e45b7ac20802497c84ab1e1cca3
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs864485
milestone26.0a1
backs out5f709b46eebcd921ee07c8eeb9183a21ac985d1e
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 5f709b46eebc (bug 864485)
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
dom/base/Navigator.cpp
dom/bindings/Bindings.conf
dom/bluetooth/BluetoothHfpManager.cpp
dom/bluetooth/BluetoothTelephonyListener.cpp
dom/dom-config.mk
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/mobilemessage/src/Makefile.in
dom/moz.build
dom/system/gonk/Makefile.in
dom/telephony/CallEvent.cpp
dom/telephony/Makefile.in
dom/telephony/Telephony.cpp
dom/telephony/TelephonyCall.cpp
dom/telephony/TelephonyCallGroup.cpp
dom/telephony/TelephonyFactory.cpp
dom/telephony/TelephonyFactory.h
dom/telephony/ipc/TelephonyChild.cpp
dom/telephony/ipc/TelephonyChild.h
dom/telephony/ipc/TelephonyIPCProvider.cpp
dom/telephony/ipc/TelephonyIPCProvider.h
dom/telephony/ipc/TelephonyParent.cpp
dom/telephony/ipc/TelephonyParent.h
dom/telephony/moz.build
dom/tests/mochitest/general/test_interfaces.html
dom/webidl/WebIDL.mk
layout/build/Makefile.in
layout/build/nsLayoutModule.cpp
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -159,16 +159,17 @@
 @BINPATH@/components/docshell.xpt
 @BINPATH@/components/dom.xpt
 @BINPATH@/components/dom_activities.xpt
 @BINPATH@/components/dom_apps.xpt
 @BINPATH@/components/dom_audiochannel.xpt
 @BINPATH@/components/dom_base.xpt
 @BINPATH@/components/dom_system.xpt
 #ifdef MOZ_B2G_RIL
+@BINPATH@/components/dom_telephony.xpt
 @BINPATH@/components/dom_voicemail.xpt
 @BINPATH@/components/dom_wifi.xpt
 @BINPATH@/components/dom_system_gonk.xpt
 @BINPATH@/components/dom_icc.xpt
 @BINPATH@/components/dom_cellbroadcast.xpt
 @BINPATH@/components/dom_wappush.xpt
 #endif
 #ifdef MOZ_B2G_BT
@@ -197,17 +198,16 @@
 @BINPATH@/components/dom_quota.xpt
 @BINPATH@/components/dom_range.xpt
 @BINPATH@/components/dom_settings.xpt
 @BINPATH@/components/dom_permissionsettings.xpt
 @BINPATH@/components/dom_sidebar.xpt
 @BINPATH@/components/dom_mobilemessage.xpt
 @BINPATH@/components/dom_storage.xpt
 @BINPATH@/components/dom_stylesheets.xpt
-@BINPATH@/components/dom_telephony.xpt
 @BINPATH@/components/dom_threads.xpt
 @BINPATH@/components/dom_traversal.xpt
 @BINPATH@/components/dom_views.xpt
 #ifdef MOZ_WEBSPEECH
 @BINPATH@/components/dom_webspeechrecognition.xpt
 #endif
 @BINPATH@/components/dom_xbl.xpt
 @BINPATH@/components/dom_xpath.xpt
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -171,16 +171,17 @@
 @BINPATH@/components/cookie.xpt
 @BINPATH@/components/directory.xpt
 @BINPATH@/components/docshell.xpt
 @BINPATH@/components/dom.xpt
 @BINPATH@/components/dom_apps.xpt
 @BINPATH@/components/dom_base.xpt
 @BINPATH@/components/dom_system.xpt
 #ifdef MOZ_B2G_RIL
+@BINPATH@/components/dom_telephony.xpt
 @BINPATH@/components/dom_voicemail.xpt
 @BINPATH@/components/dom_wifi.xpt
 @BINPATH@/components/dom_system_gonk.xpt
 @BINPATH@/components/dom_icc.xpt
 @BINPATH@/components/dom_wappush.xpt
 #endif
 #ifdef MOZ_B2G_BT
 @BINPATH@/components/dom_bluetooth.xpt
@@ -206,17 +207,16 @@
 @BINPATH@/components/dom_quota.xpt
 @BINPATH@/components/dom_range.xpt
 @BINPATH@/components/dom_settings.xpt
 @BINPATH@/components/dom_permissionsettings.xpt
 @BINPATH@/components/dom_sidebar.xpt
 @BINPATH@/components/dom_mobilemessage.xpt
 @BINPATH@/components/dom_storage.xpt
 @BINPATH@/components/dom_stylesheets.xpt
-@BINPATH@/components/dom_telephony.xpt
 @BINPATH@/components/dom_traversal.xpt
 #ifdef MOZ_WEBSPEECH
 @BINPATH@/components/dom_webspeechrecognition.xpt
 #endif
 @BINPATH@/components/dom_xbl.xpt
 @BINPATH@/components/dom_xpath.xpt
 @BINPATH@/components/dom_xul.xpt
 #ifdef MOZ_GAMEPAD
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -49,17 +49,17 @@
 #include "TimeManager.h"
 #include "DeviceStorage.h"
 #include "nsIDOMNavigatorSystemMessages.h"
 
 #ifdef MOZ_MEDIA_NAVIGATOR
 #include "MediaManager.h"
 #endif
 #ifdef MOZ_B2G_RIL
-#include "mozilla/dom/telephony/Telephony.h"
+#include "Telephony.h"
 #endif
 #ifdef MOZ_B2G_BT
 #include "BluetoothManager.h"
 #endif
 #include "DOMCameraManager.h"
 
 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
 #include "AudioChannelManager.h"
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -163,22 +163,22 @@ DOMInterfaces = {
 
 'BluetoothManager': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothManager',
     'headerFile': 'BluetoothManager.h'
 },
 
 'CallEvent': {
     'nativeType': 'mozilla::dom::telephony::CallEvent',
-    'headerFile': 'mozilla/dom/telephony/CallEvent.h',
+    'headerFile': 'CallEvent.h',
 },
 
 'CallsList': {
     'nativeType': 'mozilla::dom::telephony::CallsList',
-    'headerFile': 'mozilla/dom/telephony/CallsList.h',
+    'headerFile': 'CallsList.h',
 },
 
 'CameraControl': {
     'nativeType': 'mozilla::nsDOMCameraControl',
     'headerFile': 'DOMCameraControl.h',
     'binaryNames': {
         "release": "ReleaseHardware"
     }
@@ -1157,27 +1157,27 @@ DOMInterfaces = {
 },
 
 'SVGZoomAndPan' : {
     'concrete': False,
 },
 
 'Telephony' : {
     'nativeType': 'mozilla::dom::telephony::Telephony',
-    'headerFile': 'mozilla/dom/telephony/Telephony.h',
+    'headerFile': 'Telephony.h',
 },
 
 'TelephonyCall' : {
     'nativeType': 'mozilla::dom::telephony::TelephonyCall',
-    'headerFile': 'mozilla/dom/telephony/TelephonyCall.h',
+    'headerFile': 'TelephonyCall.h',
 },
 
 'TelephonyCallGroup' : {
     'nativeType': 'mozilla::dom::telephony::TelephonyCallGroup',
-    'headerFile': 'mozilla/dom/telephony/TelephonyCallGroup.h',
+    'headerFile': 'TelephonyCallGroup.h',
 },
 
 'Text': {
     # Total hack to allow binding code to realize that nsTextNode can
     # in fact be cast to Text.
     'headerFile': 'nsTextNode.h',
 },
 
--- a/dom/bluetooth/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/BluetoothHfpManager.cpp
@@ -1477,17 +1477,17 @@ BluetoothHfpManager::OnConnectSuccess(Bl
     MOZ_ASSERT(!mSocket);
     mHeadsetSocket.swap(mSocket);
 
     mHandsfreeSocket->Disconnect();
     mHandsfreeSocket = nullptr;
   }
 
   nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
+    do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
   NS_ENSURE_TRUE_VOID(provider);
   provider->EnumerateCalls(mListener->GetListener());
 
   // For active connection request, we need to reply the DOMRequest
   if (mRunnable) {
     BluetoothValue v = true;
     nsString errorStr;
     DispatchBluetoothReply(mRunnable, v, errorStr);
--- a/dom/bluetooth/BluetoothTelephonyListener.cpp
+++ b/dom/bluetooth/BluetoothTelephonyListener.cpp
@@ -56,21 +56,23 @@ TelephonyListener::EnumerateCallStateCom
 
 NS_IMETHODIMP
 TelephonyListener::EnumerateCallState(uint32_t aCallIndex,
                                       uint16_t aCallState,
                                       const nsAString_internal& aNumber,
                                       bool aIsActive,
                                       bool aIsOutgoing,
                                       bool aIsEmergency,
-                                      bool aIsConference)
+                                      bool aIsConference,
+                                      bool* aResult)
 {
   BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
   hfp->HandleCallStateChanged(aCallIndex, aCallState, EmptyString(), aNumber,
                               aIsOutgoing, false);
+  *aResult = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyListener::SupplementaryServiceNotification(int32_t aCallIndex,
                                                     uint16_t aNotification)
 {
   return NS_OK;
@@ -110,33 +112,33 @@ BluetoothTelephonyListener::BluetoothTel
 {
   mTelephonyListener = new TelephonyListener();
 }
 
 bool
 BluetoothTelephonyListener::StartListening()
 {
   nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
+    do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
   NS_ENSURE_TRUE(provider, false);
 
-  nsresult rv = provider->RegisterListener(mTelephonyListener);
+  nsresult rv = provider->RegisterTelephonyMsg(mTelephonyListener);
   NS_ENSURE_SUCCESS(rv, false);
 
   return true;
 }
 
 bool
 BluetoothTelephonyListener::StopListening()
 {
   nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
+    do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
   NS_ENSURE_TRUE(provider, false);
 
-  nsresult rv = provider->UnregisterListener(mTelephonyListener);
+  nsresult rv = provider->UnregisterTelephonyMsg(mTelephonyListener);
 
   return NS_FAILED(rv) ? false : true;
 }
 
 nsITelephonyListener*
 BluetoothTelephonyListener::GetListener()
 {
   return mTelephonyListener;
--- a/dom/dom-config.mk
+++ b/dom/dom-config.mk
@@ -35,16 +35,17 @@ DOM_SRCDIRS = \
   layout/xul/base/src \
   layout/xul/tree \
   dom/camera \
   $(NULL)
 
 ifdef MOZ_B2G_RIL
 DOM_SRCDIRS += \
   dom/system/gonk \
+  dom/telephony \
   dom/wifi \
   dom/icc/src \
   $(NULL)
 endif
 
 ifdef MOZ_B2G_FM
 DOM_SRCDIRS += \
   dom/fmradio \
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -91,17 +91,16 @@
 #endif
 
 #ifdef ACCESSIBILITY
 #include "nsIAccessibilityService.h"
 #endif
 
 #include "mozilla/dom/indexedDB/PIndexedDBChild.h"
 #include "mozilla/dom/mobilemessage/SmsChild.h"
-#include "mozilla/dom/telephony/TelephonyChild.h"
 #include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
 #include "mozilla/dom/bluetooth/PBluetoothChild.h"
 #include "mozilla/dom/PFMRadioChild.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 
 #ifdef MOZ_WEBSPEECH
 #include "mozilla/dom/PSpeechSynthesisChild.h"
 #endif
@@ -122,17 +121,16 @@
 using namespace base;
 using namespace mozilla;
 using namespace mozilla::docshell;
 using namespace mozilla::dom::bluetooth;
 using namespace mozilla::dom::devicestorage;
 using namespace mozilla::dom::ipc;
 using namespace mozilla::dom::mobilemessage;
 using namespace mozilla::dom::indexedDB;
-using namespace mozilla::dom::telephony;
 using namespace mozilla::hal_sandbox;
 using namespace mozilla::ipc;
 using namespace mozilla::layers;
 using namespace mozilla::net;
 using namespace mozilla::jsipc;
 #if defined(MOZ_WIDGET_GONK)
 using namespace mozilla::system;
 #endif
@@ -916,29 +914,16 @@ ContentChild::AllocPSmsChild()
 
 bool
 ContentChild::DeallocPSmsChild(PSmsChild* aSms)
 {
     delete aSms;
     return true;
 }
 
-PTelephonyChild*
-ContentChild::AllocPTelephonyChild()
-{
-    MOZ_CRASH("No one should be allocating PTelephonyChild actors");
-}
-
-bool
-ContentChild::DeallocPTelephonyChild(PTelephonyChild* aActor)
-{
-    delete aActor;
-    return true;
-}
-
 PStorageChild*
 ContentChild::AllocPStorageChild()
 {
     NS_NOTREACHED("We should never be manually allocating PStorageChild actors");
     return nullptr;
 }
 
 bool
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -147,19 +147,16 @@ public:
             const bool& aForceSave,
             const int64_t& aContentLength,
             const OptionalURIParams& aReferrer);
     virtual bool DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService);
 
     virtual PSmsChild* AllocPSmsChild();
     virtual bool DeallocPSmsChild(PSmsChild*);
 
-    virtual PTelephonyChild* AllocPTelephonyChild();
-    virtual bool DeallocPTelephonyChild(PTelephonyChild*);
-
     virtual PStorageChild* AllocPStorageChild();
     virtual bool DeallocPStorageChild(PStorageChild* aActor);
 
     virtual PBluetoothChild* AllocPBluetoothChild();
     virtual bool DeallocPBluetoothChild(PBluetoothChild* aActor);
 
     virtual PFMRadioChild* AllocPFMRadioChild();
     virtual bool DeallocPFMRadioChild(PFMRadioChild* aActor);
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -29,17 +29,16 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ExternalHelperAppParent.h"
 #include "mozilla/dom/PMemoryReportRequestParent.h"
 #include "mozilla/dom/power/PowerManagerService.h"
 #include "mozilla/dom/DOMStorageIPC.h"
 #include "mozilla/dom/bluetooth/PBluetoothParent.h"
 #include "mozilla/dom/PFMRadioParent.h"
 #include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
-#include "mozilla/dom/telephony/TelephonyParent.h"
 #include "SmsParent.h"
 #include "mozilla/Hal.h"
 #include "mozilla/hal_sandbox/PHalParent.h"
 #include "mozilla/ipc/TestShellParent.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/layers/CompositorParent.h"
 #include "mozilla/layers/ImageBridgeParent.h"
 #include "mozilla/net/NeckoParent.h"
@@ -143,17 +142,16 @@ static const char* sClipboardTextFlavors
 
 using base::ChildPrivileges;
 using base::KillProcess;
 using namespace mozilla::dom::bluetooth;
 using namespace mozilla::dom::devicestorage;
 using namespace mozilla::dom::indexedDB;
 using namespace mozilla::dom::power;
 using namespace mozilla::dom::mobilemessage;
-using namespace mozilla::dom::telephony;
 using namespace mozilla::hal;
 using namespace mozilla::idl;
 using namespace mozilla::ipc;
 using namespace mozilla::layers;
 using namespace mozilla::net;
 using namespace mozilla::jsipc;
 
 namespace mozilla {
@@ -2243,35 +2241,16 @@ ContentParent::AllocPSmsParent()
 
 bool
 ContentParent::DeallocPSmsParent(PSmsParent* aSms)
 {
     static_cast<SmsParent*>(aSms)->Release();
     return true;
 }
 
-PTelephonyParent*
-ContentParent::AllocPTelephonyParent()
-{
-    if (!AssertAppProcessPermission(this, "telephony")) {
-        return nullptr;
-    }
-
-    TelephonyParent* actor = new TelephonyParent();
-    NS_ADDREF(actor);
-    return actor;
-}
-
-bool
-ContentParent::DeallocPTelephonyParent(PTelephonyParent* aActor)
-{
-    static_cast<TelephonyParent*>(aActor)->Release();
-    return true;
-}
-
 PStorageParent*
 ContentParent::AllocPStorageParent()
 {
     return new DOMStorageDBParent();
 }
 
 bool
 ContentParent::DeallocPStorageParent(PStorageParent* aActor)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -316,19 +316,16 @@ private:
             const bool& aForceSave,
             const int64_t& aContentLength,
             const OptionalURIParams& aReferrer);
     virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService);
 
     virtual PSmsParent* AllocPSmsParent();
     virtual bool DeallocPSmsParent(PSmsParent*);
 
-    virtual PTelephonyParent* AllocPTelephonyParent();
-    virtual bool DeallocPTelephonyParent(PTelephonyParent*);
-
     virtual PStorageParent* AllocPStorageParent();
     virtual bool DeallocPStorageParent(PStorageParent* aActor);
 
     virtual PBluetoothParent* AllocPBluetoothParent();
     virtual bool DeallocPBluetoothParent(PBluetoothParent* aActor);
     virtual bool RecvPBluetoothConstructor(PBluetoothParent* aActor);
 
     virtual PFMRadioParent* AllocPFMRadioParent();
--- a/dom/mobilemessage/src/Makefile.in
+++ b/dom/mobilemessage/src/Makefile.in
@@ -28,14 +28,15 @@ LOCAL_INCLUDES = \
   $(NULL)
 
 # Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
 # subdirectory (and the ipc one).
 LOCAL_INCLUDES += $(VPATH:%=-I%)
 
 ifdef MOZ_B2G_RIL
 LOCAL_INCLUDES += \
+  -I$(topsrcdir)/dom/telephony \
   -I$(topsrcdir)/dom/system/gonk \
   $(NULL)
 endif
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -67,25 +67,25 @@ PARALLEL_DIRS += [
     'indexedDB',
     'system',
     'ipc',
     'identity',
     'workers',
     'camera',
     'audiochannel',
     'promise',
-    'wappush',
-    'telephony',
+    'wappush'
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     PARALLEL_DIRS += ['plugins/ipc/hangui']
 
 if CONFIG['MOZ_B2G_RIL']:
     PARALLEL_DIRS += [
+        'telephony',
         'wifi',
         'icc',
         'cellbroadcast',
         'voicemail',
     ]
 
 if CONFIG['MOZ_PAY']:
     PARALLEL_DIRS += ['payment']
--- a/dom/system/gonk/Makefile.in
+++ b/dom/system/gonk/Makefile.in
@@ -21,16 +21,17 @@ relativesrcdir   = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/dom/dom-config.mk
 
 LOCAL_INCLUDES = \
   -I$(topsrcdir)/dom/base \
   -I$(topsrcdir)/dom/src/geolocation \
+  -I$(topsrcdir)/dom/telephony \
   -I$(topsrcdir)/dom/wifi \
   -I$(topsrcdir)/dom/bluetooth \
   -I$(topsrcdir)/content/events/src \
   $(NULL)
 
 # TODO: Bug 908038, move this to moz.build
 WORKER_FILES := worker_buf.js \
   $(NULL)
--- a/dom/telephony/CallEvent.cpp
+++ b/dom/telephony/CallEvent.cpp
@@ -6,17 +6,16 @@
 
 #include "CallEvent.h"
 #include "mozilla/dom/CallEventBinding.h"
 
 #include "TelephonyCall.h"
 
 USING_TELEPHONY_NAMESPACE
 using namespace mozilla::dom;
-using mozilla::ErrorResult;
 
 /* static */
 already_AddRefed<CallEvent>
 CallEvent::Create(EventTarget* aOwner, const nsAString& aType,
                   TelephonyCall* aCall, bool aCanBubble,
                   bool aCancelable)
 {
   nsRefPtr<CallEvent> event = new CallEvent(aOwner, nullptr, nullptr);
--- a/dom/telephony/Makefile.in
+++ b/dom/telephony/Makefile.in
@@ -1,22 +1,15 @@
 # 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/.
 
 DEPTH            = @DEPTH@
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
-VPATH            = \
-  $(srcdir) \
-  $(srcdir)/ipc \
-  $(NULL)
+VPATH            = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/dom/dom-config.mk
 
-# Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
-# subdirectory (and the ipc one).
-LOCAL_INCLUDES = $(VPATH:%=-I%)
+include $(topsrcdir)/config/rules.mk
 
-include $(topsrcdir)/config/rules.mk
-include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/dom/telephony/Telephony.cpp
+++ b/dom/telephony/Telephony.cpp
@@ -19,19 +19,20 @@
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 
 #include "CallEvent.h"
 #include "CallsList.h"
 #include "TelephonyCall.h"
 #include "TelephonyCallGroup.h"
 
+#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
+
 USING_TELEPHONY_NAMESPACE
 using namespace mozilla::dom;
-using mozilla::ErrorResult;
 
 namespace {
 
 typedef nsAutoTArray<Telephony*, 2> TelephonyList;
 
 TelephonyList* gTelephonyList;
 
 } // anonymous namespace
@@ -45,18 +46,16 @@ public:
   NS_FORWARD_SAFE_NSITELEPHONYLISTENER(mTelephony)
 
   Listener(Telephony* aTelephony)
     : mTelephony(aTelephony)
   {
     MOZ_ASSERT(mTelephony);
   }
 
-  virtual ~Listener() {}
-
   void
   Disconnect()
   {
     MOZ_ASSERT(mTelephony);
     mTelephony = nullptr;
   }
 };
 
@@ -107,17 +106,17 @@ Telephony::~Telephony()
 
 void
 Telephony::Shutdown()
 {
   if (mListener) {
     mListener->Disconnect();
 
     if (mProvider) {
-      mProvider->UnregisterListener(mListener);
+      mProvider->UnregisterTelephonyMsg(mListener);
       mProvider = nullptr;
     }
 
     mListener = nullptr;
   }
 }
 
 JSObject*
@@ -128,17 +127,17 @@ Telephony::WrapObject(JSContext* aCx, JS
 
 // static
 already_AddRefed<Telephony>
 Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv)
 {
   NS_ASSERTION(aOwner, "Null owner!");
 
   nsCOMPtr<nsITelephonyProvider> ril =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
+    do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
   if (!ril) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
   nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
   if (!sgo) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
@@ -161,17 +160,17 @@ Telephony::Create(nsPIDOMWindow* aOwner,
   telephony->mGroup = TelephonyCallGroup::Create(telephony);
 
   nsresult rv = ril->EnumerateCalls(telephony->mListener);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
-  rv = ril->RegisterListener(telephony->mListener);
+  rv = ril->RegisterTelephonyMsg(telephony->mListener);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   return telephony.forget();
 }
 
@@ -218,17 +217,22 @@ Telephony::DialInternal(bool isEmergency
       // One call has been dialed already and we only support one outgoing call
       // at a time.
       NS_WARNING("Only permitted to dial one call at a time!");
       aRv.Throw(NS_ERROR_NOT_AVAILABLE);
       return nullptr;
     }
   }
 
-  nsresult rv = mProvider->Dial(aNumber, isEmergency);
+  nsresult rv;
+  if (isEmergency) {
+    rv = mProvider->DialEmergency(aNumber);
+  } else {
+    rv = mProvider->Dial(aNumber);
+  }
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   nsRefPtr<TelephonyCall> call = CreateNewDialingCall(aNumber);
 
   // Notify other telephony objects that we just dialed.
@@ -582,45 +586,48 @@ Telephony::EnumerateCallStateComplete()
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState,
                               const nsAString& aNumber, bool aIsActive,
                               bool aIsOutgoing, bool aIsEmergency,
-                              bool aIsConference)
+                              bool aIsConference, bool* aContinue)
 {
   nsRefPtr<TelephonyCall> call;
 
   // We request calls enumeration in constructor, and the asynchronous result
   // will be sent back through the callback function EnumerateCallState().
   // However, it is likely to have call state changes, i.e. CallStateChanged()
   // being called, before the enumeration result comes back. We'd make sure
   // we don't somehow add duplicates due to the race condition.
   call = aIsConference ? mGroup->GetCall(aCallIndex) : GetCall(aCallIndex);
   if (call) {
     // We have the call either in mCalls or in mGroup. Skip it.
+    *aContinue = true;
     return NS_OK;
   }
 
   if (MoveCall(aCallIndex, aIsConference)) {
+    *aContinue = true;
     return NS_OK;
   }
 
   // Didn't know anything about this call before now.
 
   call = TelephonyCall::Create(this, aNumber, aCallState, aCallIndex,
                                aIsEmergency, aIsConference);
   NS_ASSERTION(call, "This should never fail!");
 
   NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
                                mCalls.Contains(call),
                "Should have auto-added new call!");
 
+  *aContinue = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::SupplementaryServiceNotification(int32_t aCallIndex,
                                             uint16_t aNotification)
 {
   nsRefPtr<TelephonyCall> associatedCall;
--- a/dom/telephony/TelephonyCall.cpp
+++ b/dom/telephony/TelephonyCall.cpp
@@ -10,17 +10,16 @@
 #include "mozilla/dom/DOMError.h"
 
 #include "CallEvent.h"
 #include "Telephony.h"
 #include "TelephonyCallGroup.h"
 
 USING_TELEPHONY_NAMESPACE
 using namespace mozilla::dom;
-using mozilla::ErrorResult;
 
 // static
 already_AddRefed<TelephonyCall>
 TelephonyCall::Create(Telephony* aTelephony, const nsAString& aNumber,
                       uint16_t aCallState, uint32_t aCallIndex,
                       bool aEmergency, bool aIsConference)
 {
   NS_ASSERTION(aTelephony, "Null pointer!");
--- a/dom/telephony/TelephonyCallGroup.cpp
+++ b/dom/telephony/TelephonyCallGroup.cpp
@@ -8,17 +8,16 @@
 #include "mozilla/dom/TelephonyCallGroupBinding.h"
 
 #include "CallEvent.h"
 #include "CallsList.h"
 #include "Telephony.h"
 
 USING_TELEPHONY_NAMESPACE
 using namespace mozilla::dom;
-using mozilla::ErrorResult;
 
 TelephonyCallGroup::TelephonyCallGroup()
 : mCallState(nsITelephonyProvider::CALL_STATE_UNKNOWN)
 {
   SetIsDOMBinding();
 }
 
 TelephonyCallGroup::~TelephonyCallGroup()
deleted file mode 100644
--- a/dom/telephony/TelephonyFactory.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/telephony/TelephonyFactory.h"
-#include "nsServiceManagerUtils.h"
-#include "nsXULAppAPI.h"
-#include "TelephonyIPCProvider.h"
-
-USING_TELEPHONY_NAMESPACE
-
-/* static */ already_AddRefed<nsITelephonyProvider>
-TelephonyFactory::CreateTelephonyProvider()
-{
-  nsCOMPtr<nsITelephonyProvider> provider;
-
-  if (XRE_GetProcessType() == GeckoProcessType_Content) {
-    provider = new TelephonyIPCProvider();
-  }
-
-  return provider.forget();
-}
deleted file mode 100644
--- a/dom/telephony/TelephonyFactory.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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_telephony_TelephonyFactory_h
-#define mozilla_dom_telephony_TelephonyFactory_h
-
-#include "nsCOMPtr.h"
-#include "mozilla/dom/telephony/TelephonyCommon.h"
-
-class nsITelephonyProvider;
-
-BEGIN_TELEPHONY_NAMESPACE
-
-class TelephonyFactory
-{
-public:
-  static already_AddRefed<nsITelephonyProvider> CreateTelephonyProvider();
-};
-
-END_TELEPHONY_NAMESPACE
-
-#endif // mozilla_dom_telephony_TelephonyFactory_h
deleted file mode 100644
--- a/dom/telephony/ipc/TelephonyChild.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "TelephonyChild.h"
-
-USING_TELEPHONY_NAMESPACE
-
-/*******************************************************************************
- * TelephonyChild
- ******************************************************************************/
-
-TelephonyChild::TelephonyChild(nsITelephonyListener* aListener)
-  : mListener(aListener)
-{
-  MOZ_ASSERT(aListener);
-}
-
-void
-TelephonyChild::ActorDestroy(ActorDestroyReason aWhy)
-{
-  mListener = nullptr;
-}
-
-PTelephonyRequestChild*
-TelephonyChild::AllocPTelephonyRequestChild()
-{
-  MOZ_CRASH("Caller is supposed to manually construct a request!");
-}
-
-bool
-TelephonyChild::DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor)
-{
-  delete aActor;
-  return true;
-}
-
-bool
-TelephonyChild::RecvNotifyCallError(const int32_t& aCallIndex,
-                                    const nsString& aError)
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->NotifyError(aCallIndex, aError);
-  return true;
-}
-
-bool
-TelephonyChild::RecvNotifyCallStateChanged(const IPCCallStateData& aData)
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->CallStateChanged(aData.callIndex(),
-                              aData.callState(),
-                              aData.number(),
-                              aData.isActive(),
-                              aData.isOutGoing(),
-                              aData.isEmergency(),
-                              aData.isConference());
-  return true;
-}
-
-bool
-TelephonyChild::RecvNotifyCdmaCallWaiting(const nsString& aNumber)
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->NotifyCdmaCallWaiting(aNumber);
-  return true;
-}
-
-bool
-TelephonyChild::RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState)
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->ConferenceCallStateChanged(aCallState);
-  return true;
-}
-
-bool
-TelephonyChild::RecvNotifySupplementaryService(const int32_t& aCallIndex,
-                                               const uint16_t& aNotification)
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->SupplementaryServiceNotification(aCallIndex, aNotification);
-  return true;
-}
-
-/*******************************************************************************
- * TelephonyRequestChild
- ******************************************************************************/
-
-TelephonyRequestChild::TelephonyRequestChild(nsITelephonyListener* aListener)
-  : mListener(aListener)
-{
-  MOZ_ASSERT(aListener);
-}
-
-void
-TelephonyRequestChild::ActorDestroy(ActorDestroyReason aWhy)
-{
-  mListener = nullptr;
-}
-
-bool
-TelephonyRequestChild::Recv__delete__()
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->EnumerateCallStateComplete();
-  return true;
-}
-
-bool
-TelephonyRequestChild::RecvNotifyEnumerateCallState(const IPCCallStateData& aData)
-{
-  MOZ_ASSERT(mListener);
-
-  mListener->EnumerateCallState(aData.callIndex(),
-                                aData.callState(),
-                                aData.number(),
-                                aData.isActive(),
-                                aData.isOutGoing(),
-                                aData.isEmergency(),
-                                aData.isConference());
-  return true;
-}
deleted file mode 100644
--- a/dom/telephony/ipc/TelephonyChild.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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_telephony_TelephonyChild_h
-#define mozilla_dom_telephony_TelephonyChild_h
-
-#include "mozilla/dom/telephony/TelephonyCommon.h"
-#include "mozilla/dom/telephony/PTelephonyChild.h"
-#include "mozilla/dom/telephony/PTelephonyRequestChild.h"
-#include "nsITelephonyProvider.h"
-
-BEGIN_TELEPHONY_NAMESPACE
-
-class TelephonyChild : public PTelephonyChild
-{
-public:
-  TelephonyChild(nsITelephonyListener* aListener);
-
-protected:
-  virtual ~TelephonyChild() {}
-
-  virtual void
-  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
-
-  virtual PTelephonyRequestChild*
-  AllocPTelephonyRequestChild() MOZ_OVERRIDE;
-
-  virtual bool
-  DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvNotifyCallError(const int32_t& aCallIndex,
-                      const nsString& aError) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvNotifyCallStateChanged(const IPCCallStateData& aData) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvNotifyCdmaCallWaiting(const nsString& aNumber) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvNotifySupplementaryService(const int32_t& aCallIndex,
-                                 const uint16_t& aNotification) MOZ_OVERRIDE;
-
-private:
-  nsCOMPtr<nsITelephonyListener> mListener;
-};
-
-class TelephonyRequestChild : public PTelephonyRequestChild
-{
-public:
-  TelephonyRequestChild(nsITelephonyListener* aListener);
-
-protected:
-  virtual ~TelephonyRequestChild() {}
-
-  virtual void
-  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
-
-  virtual bool
-  Recv__delete__() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvNotifyEnumerateCallState(const IPCCallStateData& aData) MOZ_OVERRIDE;
-
-private:
-  nsCOMPtr<nsITelephonyListener> mListener;
-};
-
-END_TELEPHONY_NAMESPACE
-
-#endif // mozilla_dom_telephony_TelephonyChild_h
deleted file mode 100644
--- a/dom/telephony/ipc/TelephonyIPCProvider.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "TelephonyChild.h"
-#include "TelephonyIPCProvider.h"
-
-USING_TELEPHONY_NAMESPACE
-using namespace mozilla::dom;
-
-NS_IMPL_ISUPPORTS2(TelephonyIPCProvider,
-                   nsITelephonyProvider,
-                   nsITelephonyListener)
-
-TelephonyIPCProvider::TelephonyIPCProvider()
-{
-  // Deallocated in ContentChild::DeallocPTelephonyChild().
-  mPTelephonyChild = new TelephonyChild(this);
-  ContentChild::GetSingleton()->SendPTelephonyConstructor(mPTelephonyChild);
-}
-
-TelephonyIPCProvider::~TelephonyIPCProvider()
-{
-  mPTelephonyChild->Send__delete__(mPTelephonyChild);
-  mPTelephonyChild = nullptr;
-}
-
-/*
- * Implementation of nsITelephonyProvider.
- */
-
-NS_IMETHODIMP
-TelephonyIPCProvider::RegisterListener(nsITelephonyListener *aListener)
-{
-  MOZ_ASSERT(!mListeners.Contains(aListener));
-
-  // nsTArray doesn't fail.
-  mListeners.AppendElement(aListener);
-
-  if (mListeners.Length() == 1) {
-    mPTelephonyChild->SendRegisterListener();
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::UnregisterListener(nsITelephonyListener *aListener)
-{
-  MOZ_ASSERT(mListeners.Contains(aListener));
-
-  // We always have the element here, so it can't fail.
-  mListeners.RemoveElement(aListener);
-
-  if (!mListeners.Length()) {
-    mPTelephonyChild->SendUnregisterListener();
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::EnumerateCalls(nsITelephonyListener *aListener)
-{
-  // Life time of newly allocated TelephonyRequestChild instance is managed by
-  // IPDL itself.
-  TelephonyRequestChild* actor = new TelephonyRequestChild(aListener);
-  mPTelephonyChild->SendPTelephonyRequestConstructor(actor);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::Dial(const nsAString& aNumber,
-                          bool aIsEmergency)
-{
-  mPTelephonyChild->SendDialCall(nsString(aNumber), aIsEmergency);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::HangUp(uint32_t aCallIndex)
-{
-  mPTelephonyChild->SendHangUpCall(aCallIndex);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::AnswerCall(uint32_t aCallIndex)
-{
-  mPTelephonyChild->SendAnswerCall(aCallIndex);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::RejectCall(uint32_t aCallIndex)
-{
-  mPTelephonyChild->SendRejectCall(aCallIndex);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::HoldCall(uint32_t aCallIndex)
-{
-  mPTelephonyChild->SendHoldCall(aCallIndex);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::ResumeCall(uint32_t aCallIndex)
-{
-  mPTelephonyChild->SendResumeCall(aCallIndex);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::ConferenceCall()
-{
-  mPTelephonyChild->SendConferenceCall();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::SeparateCall(uint32_t aCallIndex)
-{
-  mPTelephonyChild->SendSeparateCall(aCallIndex);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::HoldConference()
-{
-  mPTelephonyChild->SendHoldConference();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::ResumeConference()
-{
-  mPTelephonyChild->SendResumeConference();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::StartTone(const nsAString& aDtmfChar)
-{
-  mPTelephonyChild->SendStartTone(nsString(aDtmfChar));
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::StopTone()
-{
-  mPTelephonyChild->SendStopTone();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::GetMicrophoneMuted(bool* aMuted)
-{
-  mPTelephonyChild->SendGetMicrophoneMuted(aMuted);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::SetMicrophoneMuted(bool aMuted)
-{
-  mPTelephonyChild->SendSetMicrophoneMuted(aMuted);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::GetSpeakerEnabled(bool* aEnabled)
-{
-  mPTelephonyChild->SendGetSpeakerEnabled(aEnabled);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::SetSpeakerEnabled(bool aEnabled)
-{
-  mPTelephonyChild->SendSetSpeakerEnabled(aEnabled);
-  return NS_OK;
-}
-
-// nsITelephonyListener
-
-NS_IMETHODIMP
-TelephonyIPCProvider::CallStateChanged(uint32_t aCallIndex,
-                                      uint16_t aCallState,
-                                      const nsAString& aNumber,
-                                      bool aIsActive,
-                                      bool aIsOutgoing,
-                                      bool aIsEmergency,
-                                      bool aIsConference)
-{
-  for (uint32_t i = 0; i < mListeners.Length(); i++) {
-    mListeners[i]->CallStateChanged(aCallIndex, aCallState, aNumber,
-                                    aIsActive, aIsOutgoing, aIsEmergency,
-                                    aIsConference);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::ConferenceCallStateChanged(uint16_t aCallState)
-{
-  for (uint32_t i = 0; i < mListeners.Length(); i++) {
-    mListeners[i]->ConferenceCallStateChanged(aCallState);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::EnumerateCallStateComplete()
-{
-  MOZ_CRASH("Not a EnumerateCalls request!");
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::EnumerateCallState(uint32_t aCallIndex,
-                                        uint16_t aCallState,
-                                        const nsAString& aNumber,
-                                        bool aIsActive,
-                                        bool aIsOutgoing,
-                                        bool aIsEmergency,
-                                        bool aIsConference)
-{
-  MOZ_CRASH("Not a EnumerateCalls request!");
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::NotifyCdmaCallWaiting(const nsAString& aNumber)
-{
-  for (uint32_t i = 0; i < mListeners.Length(); i++) {
-    mListeners[i]->NotifyCdmaCallWaiting(aNumber);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::NotifyError(int32_t aCallIndex,
-                                 const nsAString& aError)
-{
-  for (uint32_t i = 0; i < mListeners.Length(); i++) {
-    mListeners[i]->NotifyError(aCallIndex, aError);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-TelephonyIPCProvider::SupplementaryServiceNotification(int32_t aCallIndex,
-                                                      uint16_t aNotification)
-{
-  for (uint32_t i = 0; i < mListeners.Length(); i++) {
-    mListeners[i]->SupplementaryServiceNotification(aCallIndex, aNotification);
-  }
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/telephony/ipc/TelephonyIPCProvider.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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_telephony_TelephonyIPCProvider_h
-#define mozilla_dom_telephony_TelephonyIPCProvider_h
-
-#include "mozilla/dom/telephony/TelephonyCommon.h"
-#include "mozilla/Attributes.h"
-#include "nsITelephonyProvider.h"
-
-BEGIN_TELEPHONY_NAMESPACE
-
-class PTelephonyChild;
-
-class TelephonyIPCProvider MOZ_FINAL : public nsITelephonyProvider
-                                     , public nsITelephonyListener
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSITELEPHONYPROVIDER
-  NS_DECL_NSITELEPHONYLISTENER
-
-  TelephonyIPCProvider();
-
-protected:
-  virtual ~TelephonyIPCProvider();
-
-private:
-  nsTArray<nsCOMPtr<nsITelephonyListener> > mListeners;
-  PTelephonyChild* mPTelephonyChild;
-};
-
-END_TELEPHONY_NAMESPACE
-
-#endif // mozilla_dom_telephony_TelephonyIPCProvider_h
deleted file mode 100644
--- a/dom/telephony/ipc/TelephonyParent.cpp
+++ /dev/null
@@ -1,448 +0,0 @@
-/* -*- Mode: C++ tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "TelephonyParent.h"
-
-USING_TELEPHONY_NAMESPACE
-
-/*******************************************************************************
- * TelephonyParent
- ******************************************************************************/
-
-NS_IMPL_ISUPPORTS1(TelephonyParent, nsITelephonyListener)
-
-TelephonyParent::TelephonyParent()
-  : mActorDestroyed(false)
-  , mRegistered(false)
-{
-}
-
-void
-TelephonyParent::ActorDestroy(ActorDestroyReason why)
-{
-  // The child process could die before this asynchronous notification, in which
-  // case ActorDestroy() was called and mActorDestroyed is set to true. Return
-  // an error here to avoid sending a message to the dead process.
-  mActorDestroyed = true;
-
-  // Try to unregister listener if we're still registered.
-  RecvUnregisterListener();
-}
-
-bool
-TelephonyParent::RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActor)
-{
-  TelephonyRequestParent* actor = static_cast<TelephonyRequestParent*>(aActor);
-
-  return actor->DoRequest();
-}
-
-PTelephonyRequestParent*
-TelephonyParent::AllocPTelephonyRequestParent()
-{
-  TelephonyRequestParent* actor = new TelephonyRequestParent();
-  // Add an extra ref for IPDL. Will be released in
-  // TelephonyParent::DeallocPTelephonyRequestParent().
-  NS_ADDREF(actor);
-
-  return actor;
-}
-
-bool
-TelephonyParent::DeallocPTelephonyRequestParent(PTelephonyRequestParent* aActor)
-{
-  // TelephonyRequestParent is refcounted, must not be freed manually.
-  static_cast<TelephonyRequestParent*>(aActor)->Release();
-  return true;
-}
-
-bool
-TelephonyParent::Recv__delete__()
-{
-  return true; // Unregister listener in TelephonyParent::ActorDestroy().
-}
-
-bool
-TelephonyParent::RecvRegisterListener()
-{
-  NS_ENSURE_TRUE(!mRegistered, true);
-
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  mRegistered = NS_SUCCEEDED(provider->RegisterListener(this));
-  return true;
-}
-
-bool
-TelephonyParent::RecvUnregisterListener()
-{
-  NS_ENSURE_TRUE(mRegistered, true);
-
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  mRegistered = !NS_SUCCEEDED(provider->UnregisterListener(this));
-  return true;
-}
-
-bool
-TelephonyParent::RecvDialCall(const nsString& aNumber,
-                              const bool& aIsEmergency)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->Dial(aNumber, aIsEmergency);
-  return true;
-}
-
-bool
-TelephonyParent::RecvHangUpCall(const uint32_t& aCallIndex)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->HangUp(aCallIndex);
-  return true;
-}
-
-bool
-TelephonyParent::RecvAnswerCall(const uint32_t& aCallIndex)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->AnswerCall(aCallIndex);
-  return true;
-}
-
-bool
-TelephonyParent::RecvRejectCall(const uint32_t& aCallIndex)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->RejectCall(aCallIndex);
-  return true;
-}
-
-bool
-TelephonyParent::RecvHoldCall(const uint32_t& aCallIndex)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->HoldCall(aCallIndex);
-  return true;
-}
-
-bool
-TelephonyParent::RecvResumeCall(const uint32_t& aCallIndex)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->ResumeCall(aCallIndex);
-  return true;
-}
-
-bool
-TelephonyParent::RecvConferenceCall()
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->ConferenceCall();
-  return true;
-}
-
-bool
-TelephonyParent::RecvSeparateCall(const uint32_t& aCallState)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->SeparateCall(aCallState);
-  return true;
-}
-
-bool
-TelephonyParent::RecvHoldConference()
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->HoldConference();
-  return true;
-}
-
-bool
-TelephonyParent::RecvResumeConference()
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->ResumeConference();
-  return true;
-}
-
-bool
-TelephonyParent::RecvStartTone(const nsString& aTone)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->StartTone(aTone);
-  return true;
-}
-
-bool
-TelephonyParent::RecvStopTone()
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->StopTone();
-  return true;
-}
-
-bool
-TelephonyParent::RecvGetMicrophoneMuted(bool* aMuted)
-{
-  *aMuted = false;
-
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->GetMicrophoneMuted(aMuted);
-  return true;
-}
-
-bool
-TelephonyParent::RecvSetMicrophoneMuted(const bool& aMuted)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->SetMicrophoneMuted(aMuted);
-  return true;
-}
-
-bool
-TelephonyParent::RecvGetSpeakerEnabled(bool* aEnabled)
-{
-  *aEnabled = false;
-
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->GetSpeakerEnabled(aEnabled);
-  return true;
-}
-
-bool
-TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled)
-{
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  NS_ENSURE_TRUE(provider, true);
-
-  provider->SetSpeakerEnabled(aEnabled);
-  return true;
-}
-
-// nsITelephonyListener
-
-NS_IMETHODIMP
-TelephonyParent::CallStateChanged(uint32_t aCallIndex,
-                                  uint16_t aCallState,
-                                  const nsAString& aNumber,
-                                  bool aIsActive,
-                                  bool aIsOutgoing,
-                                  bool aIsEmergency,
-                                  bool aIsConference)
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), aIsActive,
-                        aIsOutgoing, aIsEmergency, aIsConference);
-  return SendNotifyCallStateChanged(data) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-TelephonyParent::ConferenceCallStateChanged(uint16_t aCallState)
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  return SendNotifyConferenceCallStateChanged(aCallState) ? NS_OK
-                                                          : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-TelephonyParent::EnumerateCallStateComplete()
-{
-  MOZ_CRASH("Not a EnumerateCalls request!");
-}
-
-NS_IMETHODIMP
-TelephonyParent::EnumerateCallState(uint32_t aCallIndex,
-                                    uint16_t aCallState,
-                                    const nsAString& aNumber,
-                                    bool aIsActive,
-                                    bool aIsOutgoing,
-                                    bool aIsEmergency,
-                                    bool aIsConference)
-{
-  MOZ_CRASH("Not a EnumerateCalls request!");
-}
-
-NS_IMETHODIMP
-TelephonyParent::NotifyCdmaCallWaiting(const nsAString& aNumber)
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  return SendNotifyCdmaCallWaiting(nsString(aNumber)) ? NS_OK
-                                                      : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-TelephonyParent::NotifyError(int32_t aCallIndex,
-                             const nsAString& aError)
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  return SendNotifyCallError(aCallIndex, nsString(aError)) ? NS_OK
-                                                           : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-TelephonyParent::SupplementaryServiceNotification(int32_t aCallIndex,
-                                                  uint16_t aNotification)
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  return SendNotifySupplementaryService(aCallIndex, aNotification)
-    ? NS_OK : NS_ERROR_FAILURE;
-}
-
-/*******************************************************************************
- * TelephonyRequestParent
- ******************************************************************************/
-
-NS_IMPL_ISUPPORTS1(TelephonyRequestParent, nsITelephonyListener)
-
-TelephonyRequestParent::TelephonyRequestParent()
-  : mActorDestroyed(false)
-{
-}
-
-void
-TelephonyRequestParent::ActorDestroy(ActorDestroyReason why)
-{
-  // The child process could die before this asynchronous notification, in which
-  // case ActorDestroy() was called and mActorDestroyed is set to true. Return
-  // an error here to avoid sending a message to the dead process.
-  mActorDestroyed = true;
-}
-
-bool
-TelephonyRequestParent::DoRequest()
-{
-  nsresult rv = NS_ERROR_FAILURE;
-
-  nsCOMPtr<nsITelephonyProvider> provider =
-    do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
-  if (provider) {
-    rv = provider->EnumerateCalls(this);
-  }
-
-  if (NS_FAILED(rv)) {
-    return NS_SUCCEEDED(EnumerateCallStateComplete());
-  }
-
-  return true;
-}
-
-// nsITelephonyListener
-
-NS_IMETHODIMP
-TelephonyRequestParent::CallStateChanged(uint32_t aCallIndex,
-                                         uint16_t aCallState,
-                                         const nsAString& aNumber,
-                                         bool aIsActive,
-                                         bool aIsOutgoing,
-                                         bool aIsEmergency,
-                                         bool aIsConference)
-{
-  MOZ_CRASH("Not a TelephonyParent!");
-}
-
-NS_IMETHODIMP
-TelephonyRequestParent::ConferenceCallStateChanged(uint16_t aCallState)
-{
-  MOZ_CRASH("Not a TelephonyParent!");
-}
-
-NS_IMETHODIMP
-TelephonyRequestParent::EnumerateCallStateComplete()
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  return Send__delete__(this) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-TelephonyRequestParent::EnumerateCallState(uint32_t aCallIndex,
-                                           uint16_t aCallState,
-                                           const nsAString& aNumber,
-                                           bool aIsActive,
-                                           bool aIsOutgoing,
-                                           bool aIsEmergency,
-                                           bool aIsConference)
-{
-  NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
-
-  IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), aIsActive,
-                        aIsOutgoing, aIsEmergency, aIsConference);
-  return SendNotifyEnumerateCallState(data) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-TelephonyRequestParent::NotifyCdmaCallWaiting(const nsAString& aNumber)
-{
-  MOZ_CRASH("Not a TelephonyParent!");
-}
-
-NS_IMETHODIMP
-TelephonyRequestParent::NotifyError(int32_t aCallIndex,
-                                    const nsAString& aError)
-{
-  MOZ_CRASH("Not a TelephonyParent!");
-}
-
-NS_IMETHODIMP
-TelephonyRequestParent::SupplementaryServiceNotification(int32_t aCallIndex,
-                                                         uint16_t aNotification)
-{
-  MOZ_CRASH("Not a TelephonyParent!");
-}
deleted file mode 100644
--- a/dom/telephony/ipc/TelephonyParent.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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_telephony_TelephonyParent_h
-#define mozilla_dom_telephony_TelephonyParent_h
-
-#include "mozilla/dom/telephony/TelephonyCommon.h"
-#include "mozilla/dom/telephony/PTelephonyParent.h"
-#include "mozilla/dom/telephony/PTelephonyRequestParent.h"
-#include "nsITelephonyProvider.h"
-
-BEGIN_TELEPHONY_NAMESPACE
-
-class TelephonyParent : public PTelephonyParent
-                      , public nsITelephonyListener
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSITELEPHONYLISTENER
-
-  TelephonyParent();
-
-protected:
-  virtual ~TelephonyParent() {}
-
-  virtual void
-  ActorDestroy(ActorDestroyReason why);
-
-  virtual bool
-  RecvPTelephonyRequestConstructor(PTelephonyRequestParent* aActor) MOZ_OVERRIDE;
-
-  virtual PTelephonyRequestParent*
-  AllocPTelephonyRequestParent() MOZ_OVERRIDE;
-
-  virtual bool
-  DeallocPTelephonyRequestParent(PTelephonyRequestParent* aActor) MOZ_OVERRIDE;
-
-  virtual bool
-  Recv__delete__() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvRegisterListener() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvUnregisterListener() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvDialCall(const nsString& aNumber,
-               const bool& aIsEmergency) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvHangUpCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvAnswerCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvRejectCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvHoldCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvResumeCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvConferenceCall() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvSeparateCall(const uint32_t& callIndex) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvHoldConference() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvResumeConference() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvStartTone(const nsString& aTone) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvStopTone() MOZ_OVERRIDE;
-
-  virtual bool
-  RecvGetMicrophoneMuted(bool* aMuted) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvSetMicrophoneMuted(const bool& aMuted) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvGetSpeakerEnabled(bool* aEnabled) MOZ_OVERRIDE;
-
-  virtual bool
-  RecvSetSpeakerEnabled(const bool& aEnabled) MOZ_OVERRIDE;
-
-private:
-  bool mActorDestroyed;
-  bool mRegistered;
-};
-
-class TelephonyRequestParent : public PTelephonyRequestParent
-                             , public nsITelephonyListener
-{
-  friend class TelephonyParent;
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSITELEPHONYLISTENER
-
-protected:
-  TelephonyRequestParent();
-  virtual ~TelephonyRequestParent() {}
-
-  virtual void
-  ActorDestroy(ActorDestroyReason why);
-
-private:
-  bool mActorDestroyed;
-
-  bool
-  DoRequest();
-};
-
-END_TELEPHONY_NAMESPACE
-
-#endif /* mozilla_dom_telephony_TelephonyParent_h */
--- a/dom/telephony/moz.build
+++ b/dom/telephony/moz.build
@@ -7,43 +7,22 @@
 XPIDL_SOURCES += [
     'nsITelephonyProvider.idl',
 ]
 
 XPIDL_MODULE = 'dom_telephony'
 
 MODULE = 'dom'
 
-EXPORTS.mozilla.dom.telephony += [
-    'CallEvent.h',
-    'CallsList.h',
-    'Telephony.h',
-    'TelephonyCall.h',
-    'TelephonyCallGroup.h',
-    'TelephonyCommon.h',
-    'TelephonyFactory.h',
-    'ipc/TelephonyChild.h',
-    'ipc/TelephonyParent.h',
-]
-
 CPP_SOURCES += [
     'CallEvent.cpp',
     'CallsList.cpp',
     'Telephony.cpp',
     'TelephonyCall.cpp',
     'TelephonyCallGroup.cpp',
-    'TelephonyChild.cpp',
-    'TelephonyFactory.cpp',
-    'TelephonyIPCProvider.cpp',
-    'TelephonyParent.cpp',
-]
-
-IPDL_SOURCES += [
-    'ipc/PTelephony.ipdl',
-    'ipc/PTelephonyRequest.ipdl',
-    'ipc/TelephonyTypes.ipdlh'
 ]
 
 FAIL_ON_WARNINGS = True
 
 LIBXUL_LIBRARY = True
 
 LIBRARY_NAME = 'domtelephony_s'
+
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -97,17 +97,17 @@ var interfaceNamesInGlobalScope =
     "BlobEvent",
     {name: "BluetoothAdapter", b2g: true},
     {name: "BluetoothDevice", b2g: true},
     {name: "BluetoothDeviceEvent", b2g: true},
     {name: "BluetoothManager", b2g: true},
     {name: "BluetoothStatusChangedEvent", b2g: true},
     {name: "BoxObject", xbl: true},
     {name: "BrowserFeedWriter", desktop: true},
-    "CallEvent",
+    {name: "CallEvent", b2g: true},
     "CameraCapabilities",
     "CameraControl",
     "CameraManager",
     "CanvasGradient",
     "CanvasPattern",
     "CanvasRenderingContext2D",
     "CaretPosition",
     "CDATASection",
@@ -526,19 +526,19 @@ var interfaceNamesInGlobalScope =
     "SVGTransform",
     "SVGTransformList",
     "SVGTSpanElement",
     "SVGUnitTypes",
     "SVGUseElement",
     "SVGViewElement",
     "SVGZoomAndPan",
     "SVGZoomEvent",
-    "Telephony",
-    "TelephonyCall",
-    "TelephonyCallGroup",
+    {name: "Telephony", b2g: true},
+    {name: "TelephonyCall", b2g: true},
+    {name: "TelephonyCallGroup", b2g: true},
     "Text",
     "TextDecoder",
     "TextEncoder",
     "TextMetrics",
     "TimeEvent",
     "TimeRanges",
     "Touch",
     "TouchEvent",
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -29,18 +29,16 @@ webidl_files = \
   AudioProcessingEvent.webidl \
   AudioStreamTrack.webidl \
   BarProp.webidl \
   BatteryManager.webidl \
   BeforeUnloadEvent.webidl \
   BiquadFilterNode.webidl \
   Blob.webidl \
   BrowserElementDictionaries.webidl \
-  CallEvent.webidl \
-  CallsList.webidl \
   CameraControl.webidl \
   CameraManager.webidl \
   CanvasRenderingContext2D.webidl \
   CaretPosition.webidl \
   CDATASection.webidl \
   ChannelMergerNode.webidl \
   ChannelSplitterNode.webidl \
   CharacterData.webidl \
@@ -356,19 +354,16 @@ webidl_files = \
   SVGTransformList.webidl \
   SVGTSpanElement.webidl \
   SVGUnitTypes.webidl \
   SVGURIReference.webidl \
   SVGUseElement.webidl \
   SVGViewElement.webidl \
   SVGZoomAndPan.webidl \
   SVGZoomEvent.webidl \
-  Telephony.webidl \
-  TelephonyCall.webidl \
-  TelephonyCallGroup.webidl \
   Text.webidl \
   TextDecoder.webidl \
   TextEncoder.webidl \
   TextTrack.webidl \
   TextTrackCueList.webidl \
   TextTrackList.webidl \
   TimeEvent.webidl \
   TimeRanges.webidl \
@@ -445,18 +440,22 @@ endif
 ifdef MOZ_GAMEPAD
 webidl_files += \
   Gamepad.webidl \
   $(NULL)
 endif
 
 ifdef MOZ_B2G_RIL
 webidl_files += \
+  CallsList.webidl \
   MozStkCommandEvent.webidl \
   MozVoicemail.webidl \
+  Telephony.webidl \
+  TelephonyCall.webidl \
+  TelephonyCallGroup.webidl \
   $(NULL)
 endif
 
 webidl_files += \
   BlobEvent.webidl \
   CloseEvent.webidl \
   CustomEvent.webidl \
   DeviceLightEvent.webidl \
@@ -491,16 +490,17 @@ webidl_files += \
   BluetoothDeviceEvent.webidl \
   BluetoothManager.webidl \
   BluetoothStatusChangedEvent.webidl \
   $(NULL)
 endif
 
 ifdef MOZ_B2G_RIL
 webidl_files += \
+  CallEvent.webidl \
   CFStateChangeEvent.webidl \
   DataErrorEvent.webidl \
   IccCardLockErrorEvent.webidl \
   MozCellBroadcast.webidl \
   MozCellBroadcastEvent.webidl \
   MozEmergencyCbModeEvent.webidl \
   MozOtaStatusEvent.webidl \
   MozVoicemailEvent.webidl \
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -61,17 +61,16 @@ SHARED_LIBRARY_LIBS = \
 	$(DEPTH)/dom/src/jsurl/$(LIB_PREFIX)jsurl_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/storage/$(LIB_PREFIX)jsdomstorage_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/offline/$(LIB_PREFIX)jsdomoffline_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/geolocation/$(LIB_PREFIX)jsdomgeolocation_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/audiochannel/$(LIB_PREFIX)domaudiochannel_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/promise/$(LIB_PREFIX)dompromise_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/src/notification/$(LIB_PREFIX)jsdomnotification_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/system/$(LIB_PREFIX)domsystem_s.$(LIB_SUFFIX) \
-	$(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/workers/$(LIB_PREFIX)domworkers_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/indexedDB/$(LIB_PREFIX)dom_indexeddb_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/indexedDB/ipc/$(LIB_PREFIX)dom_indexeddb_ipc_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/browser-element/$(LIB_PREFIX)dom_browserelement_s.$(LIB_SUFFIX) \
 	$(DEPTH)/dom/time/$(LIB_PREFIX)dom_time_s.$(LIB_SUFFIX) \
 	$(DEPTH)/editor/libeditor/text/$(LIB_PREFIX)texteditor_s.$(LIB_SUFFIX) \
 	$(DEPTH)/editor/libeditor/base/$(LIB_PREFIX)editorbase_s.$(LIB_SUFFIX) \
 	$(DEPTH)/parser/html/$(LIB_PREFIX)html5p_s.$(LIB_SUFFIX) \
@@ -132,16 +131,17 @@ ifdef MOZ_B2G_BT #{
 SHARED_LIBRARY_LIBS += $(DEPTH)/dom/bluetooth/$(LIB_PREFIX)dombluetooth_s.$(LIB_SUFFIX)
 endif #}
 
 SHARED_LIBRARY_LIBS	+= $(DEPTH)/dom/camera/$(LIB_PREFIX)domcamera_s.$(LIB_SUFFIX)
 
 ifdef MOZ_B2G_RIL #{
 SHARED_LIBRARY_LIBS	+= \
   $(DEPTH)/dom/system/gonk/$(LIB_PREFIX)domsystemgonk_s.$(LIB_SUFFIX) \
+  $(DEPTH)/dom/telephony/$(LIB_PREFIX)domtelephony_s.$(LIB_SUFFIX) \
   $(DEPTH)/dom/icc/src/$(LIB_PREFIX)dom_icc_s.$(LIB_SUFFIX) \
   $(DEPTH)/dom/cellbroadcast/src/$(LIB_PREFIX)dom_cellbroadcast_s.$(LIB_SUFFIX) \
   $(DEPTH)/dom/voicemail/$(LIB_PREFIX)domvoicemail_s.$(LIB_SUFFIX) \
   $(NULL)
 endif #}
 
 ifdef MOZ_OGG
 SHARED_LIBRARY_LIBS 	+= \
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -225,28 +225,24 @@ static void Shutdown();
 #include "nsMixedContentBlocker.h"
 
 #include "AudioChannelService.h"
 
 #include "mozilla/dom/power/PowerManagerService.h"
 #include "mozilla/dom/alarm/AlarmHalService.h"
 #include "mozilla/dom/time/TimeService.h"
 
-#include "mozilla/dom/telephony/TelephonyFactory.h"
-#include "nsITelephonyProvider.h"
-
 #ifdef MOZ_WIDGET_GONK
 #include "GonkGPSGeolocationProvider.h"
 #endif
 #include "MediaManager.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::mobilemessage;
-using namespace mozilla::dom::telephony;
 using mozilla::dom::alarm::AlarmHalService;
 using mozilla::dom::indexedDB::IndexedDatabaseManager;
 using mozilla::dom::power::PowerManagerService;
 using mozilla::dom::quota::QuotaManager;
 using mozilla::dom::TCPSocketChild;
 using mozilla::dom::TCPSocketParent;
 using mozilla::dom::TCPServerSocketChild;
 using mozilla::dom::time::TimeService;
@@ -337,18 +333,16 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR
                                          GonkGPSGeolocationProvider::GetSingleton)
 // Since the nsVolumeService constructor calls into nsIPowerManagerService,
 // we need it to be constructed sometime after nsIPowerManagerService.
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
                                          nsVolumeService::GetSingleton)
 #endif
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
                                          MediaManager::GetInstance)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyProvider,
-                                         TelephonyFactory::CreateTelephonyProvider)
 
 //-----------------------------------------------------------------------------
 
 // Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
 // perform shutdown of the layout modules at that time instead of waiting for
 // our module destructor to run.  If we do not do this, then we risk holding
 // references to objects in other component libraries that have already been
 // shutdown (and possibly unloaded if 60709 is ever fixed).
@@ -812,17 +806,16 @@ NS_DEFINE_NAMED_CID(NS_GAMEPAD_TEST_CID)
 #ifdef MOZ_WEBSPEECH
 NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID);
 #endif
 
 #ifdef ACCESSIBILITY
 NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
 #endif
-NS_DEFINE_NAMED_CID(TELEPHONY_PROVIDER_CID);
 
 static nsresult
 CreateWindowCommandTableConstructor(nsISupports *aOuter,
                                     REFNSIID aIID, void **aResult)
 {
   nsresult rv;
   nsCOMPtr<nsIControllerCommandTable> commandTable =
       do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
@@ -1095,17 +1088,16 @@ static const mozilla::Module::CIDEntry k
 #endif
   { &kNS_MEDIAMANAGERSERVICE_CID, false, NULL, nsIMediaManagerServiceConstructor },
 #ifdef MOZ_GAMEPAD
   { &kNS_GAMEPAD_TEST_CID, false, NULL, GamepadServiceTestConstructor },
 #endif
 #ifdef ACCESSIBILITY
   { &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, CreateA11yService },
 #endif
-  { &kTELEPHONY_PROVIDER_CID, false, NULL, nsITelephonyProviderConstructor },
   { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
   XPCONNECT_CONTRACTS
   { "@mozilla.org/layout/xul-boxobject;1", &kNS_BOXOBJECT_CID },
 #ifdef MOZ_XUL
   { "@mozilla.org/layout/xul-boxobject-listbox;1", &kNS_LISTBOXOBJECT_CID },
@@ -1251,17 +1243,16 @@ static const mozilla::Module::ContractID
 #ifdef MOZ_GAMEPAD
   { NS_GAMEPAD_TEST_CONTRACTID, &kNS_GAMEPAD_TEST_CID },
 #endif
   { MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID },
 #ifdef ACCESSIBILITY
   { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
   { "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
 #endif
-  { TELEPHONY_PROVIDER_CONTRACTID, &kTELEPHONY_PROVIDER_CID },
   { NULL }
 };
 
 static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
   XPCONNECT_CATEGORIES
   { "content-policy", NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID },
   { "content-policy", NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID },
   { "content-policy", "CSPService", CSPSERVICE_CONTRACTID },