Backed out changeset 1f3643b7de2d
authorBen Turner <bent.mozilla@gmail.com>
Thu, 23 Feb 2012 07:09:11 -0800
changeset 87534 324ad5b90d7d2822fbf1e533e7676358ff4584ce
parent 87531 1f3643b7de2d2325eda769e1520dcef0892f5f53
child 87535 459b3ccb4e47f481eaf06dcc1de9bb2eb8207582
push id22130
push userrnewman@mozilla.com
push dateFri, 24 Feb 2012 02:35:54 +0000
treeherdermozilla-central@d23600a1d4a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone13.0a1
backs out1f3643b7de2d2325eda769e1520dcef0892f5f53
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 1f3643b7de2d
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/interfaces/base/Makefile.in
dom/interfaces/base/nsIDOMTelephonyCallArray.idl
dom/telephony/CallEvent.cpp
dom/telephony/Makefile.in
dom/telephony/Telephony.cpp
dom/telephony/Telephony.h
dom/telephony/TelephonyCall.cpp
dom/telephony/TelephonyCallArray.cpp
dom/telephony/TelephonyCallArray.h
dom/telephony/TelephonyCommon.h
dom/telephony/nsIDOMTelephony.idl
js/xpconnect/src/Makefile.in
js/xpconnect/src/dombindings.conf
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -524,17 +524,16 @@ using mozilla::dom::indexedDB::IDBWrappe
 #include "nsIDOMSmsCursor.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMConnection.h"
 #include "mozilla/dom/network/Utils.h"
 
 #ifdef MOZ_B2G_RIL
 #include "Telephony.h"
 #include "TelephonyCall.h"
-#include "TelephonyCallArray.h"
 #include "CallEvent.h"
 #endif
 
 #ifdef MOZ_B2G_BT
 #include "BluetoothAdapter.h"
 #endif
 
 #include "DOMError.h"
@@ -1625,18 +1624,16 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(CustomEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
 #ifdef MOZ_B2G_RIL
   NS_DEFINE_CLASSINFO_DATA(Telephony, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(TelephonyCall, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(TelephonyCallArray, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(CallEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
 #ifdef MOZ_B2G_BT
   NS_DEFINE_CLASSINFO_DATA(BluetoothAdapter, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 #endif
@@ -4369,20 +4366,16 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(TelephonyCall, nsIDOMTelephonyCall)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMTelephonyCall)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(TelephonyCallArray, nsIDOMTelephonyCallArray)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMTelephonyCallArray)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(CallEvent, nsIDOMCallEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCallEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
   DOM_CLASSINFO_MAP_END
 #endif
 
 #ifdef MOZ_B2G_BT
   DOM_CLASSINFO_MAP_BEGIN(BluetoothAdapter, nsIDOMBluetoothAdapter)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -533,17 +533,16 @@ DOMCI_CLASS(MozCSSKeyframeRule)
 DOMCI_CLASS(MozCSSKeyframesRule)
 
 DOMCI_CLASS(MediaQueryList)
 DOMCI_CLASS(CustomEvent)
 
 #ifdef MOZ_B2G_RIL
 DOMCI_CLASS(Telephony)
 DOMCI_CLASS(TelephonyCall)
-DOMCI_CLASS(TelephonyCallArray)
 DOMCI_CLASS(CallEvent)
 #endif
 
 #ifdef MOZ_B2G_BT
 DOMCI_CLASS(BluetoothAdapter)
 #endif
 
 DOMCI_CLASS(DOMError)
--- a/dom/interfaces/base/Makefile.in
+++ b/dom/interfaces/base/Makefile.in
@@ -83,12 +83,11 @@ XPIDLSRCS =					\
 	nsIQueryContentEventResult.idl		\
 	nsITabChild.idl				\
 	nsITabParent.idl			\
 	nsIDOMGlobalPropertyInitializer.idl	\
 	nsIStructuredCloneContainer.idl		\
 	nsIDOMPerformance.idl			\
 	nsIDOMPerformanceTiming.idl		\
 	nsIDOMPerformanceNavigation.idl		\
-	nsIDOMTelephonyCallArray.idl		\
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/dom/interfaces/base/nsIDOMTelephonyCallArray.idl
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=40: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Telephony.
- *
- * The Initial Developer of the Original Code is
- *   The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2012
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-
-interface nsIDOMTelephonyCall;
-
-[scriptable, builtinclass, uuid(5a0dfc8f-1bca-4922-82b2-f86721edf72a)]
-interface nsIDOMTelephonyCallArray : nsISupports
-{
-  readonly attribute unsigned long length;
-
-  [getter, noscript, notxpcom, nostdcall]
-  nsIDOMTelephonyCall getCallAt(in unsigned long index);
-};
--- a/dom/telephony/CallEvent.cpp
+++ b/dom/telephony/CallEvent.cpp
@@ -38,17 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "CallEvent.h"
 
 #include "nsDOMClassInfo.h"
 
 #include "Telephony.h"
 #include "TelephonyCall.h"
-#include "TelephonyCallArray.h"
 
 USING_TELEPHONY_NAMESPACE
 
 // static
 already_AddRefed<CallEvent>
 CallEvent::Create(TelephonyCall* aCall)
 {
   NS_ASSERTION(aCall, "Null pointer!");
--- a/dom/telephony/Makefile.in
+++ b/dom/telephony/Makefile.in
@@ -48,23 +48,25 @@ XPIDL_MODULE     = dom_telephony
 LIBXUL_LIBRARY   = 1
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/dom/dom-config.mk
 
 CPPSRCS = \
   Telephony.cpp \
   TelephonyCall.cpp \
-  TelephonyCallArray.cpp \
   CallEvent.cpp \
   $(NULL)
 
 XPIDLSRCS = \
   nsIDOMNavigatorTelephony.idl \
   nsIDOMTelephony.idl \
   nsIDOMTelephonyCall.idl \
   nsIDOMCallEvent.idl \
   $(NULL)
 
-# Needed for dombindings.h
-LOCAL_INCLUDES += -I$(topsrcdir)/js/xpconnect/src
+#LOCAL_INCLUDES = \
+#  -I$(topsrcdir)/dom/base \
+#  -I$(topsrcdir)/dom/system/b2g \
+#  -I$(topsrcdir)/content/events/src \
+#  $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/telephony/Telephony.cpp
+++ b/dom/telephony/Telephony.cpp
@@ -48,28 +48,82 @@
 #include "nsContentUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "SystemWorkerManager.h"
 
 #include "CallEvent.h"
 #include "TelephonyCall.h"
-#include "TelephonyCallArray.h"
 
 USING_TELEPHONY_NAMESPACE
 using mozilla::Preferences;
 
 #define DOM_TELEPHONY_APP_PHONE_URL_PREF "dom.telephony.app.phone.url"
 
+namespace {
+
+template <class T>
+inline nsresult
+nsTArrayToJSArray(JSContext* aCx, JSObject* aGlobal,
+                  const nsTArray<nsRefPtr<T> >& aSourceArray,
+                  JSObject** aResultArray)
+{
+  NS_ASSERTION(aCx, "Null context!");
+  NS_ASSERTION(aGlobal, "Null global!");
+
+  JSAutoRequest ar(aCx);
+  JSAutoEnterCompartment ac;
+  if (!ac.enter(aCx, aGlobal)) {
+    NS_WARNING("Failed to enter compartment!");
+    return NS_ERROR_FAILURE;
+  }
+
+  JSObject* arrayObj;
+
+  if (aSourceArray.IsEmpty()) {
+    arrayObj = JS_NewArrayObject(aCx, 0, nsnull);
+  } else {
+    nsTArray<jsval> valArray;
+    valArray.SetLength(aSourceArray.Length());
+
+    for (PRUint32 index = 0; index < valArray.Length(); index++) {
+      nsISupports* obj = aSourceArray[index]->ToISupports();
+      nsresult rv =
+        nsContentUtils::WrapNative(aCx, aGlobal, obj, &valArray[index]);
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
+
+    arrayObj = JS_NewArrayObject(aCx, valArray.Length(), valArray.Elements());
+  }
+
+  if (!arrayObj) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+
+  // XXX This is not what Jonas wants. He wants it to be live.
+  if (!JS_FreezeObject(aCx, arrayObj)) {
+    return NS_ERROR_FAILURE;
+  }
+
+  *aResultArray = arrayObj;
+  return NS_OK;
+}
+
+} // anonymous namespace
+
 Telephony::~Telephony()
 {
   if (mRIL && mRILTelephonyCallback) {
     mRIL->UnregisterCallback(mRILTelephonyCallback);
   }
+
+  if (mRooted) {
+    NS_DROP_JS_OBJECTS(this, Telephony);
+  }
 }
 
 // static
 already_AddRefed<Telephony>
 Telephony::Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL)
 {
   NS_ASSERTION(aOwner, "Null owner!");
   NS_ASSERTION(aRIL, "Null RIL!");
@@ -105,32 +159,35 @@ Telephony::SwitchActiveCall(TelephonyCal
   }
   mActiveCall = aCall;
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(Telephony)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Telephony,
                                                   nsDOMEventTargetHelper)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
   NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(incoming)
   for (PRUint32 index = 0; index < tmp->mCalls.Length(); index++) {
     NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCalls[i]");
     cb.NoteXPCOMChild(tmp->mCalls[index]->ToISupports());
   }
-  if (tmp->mCallsArray) {
-    NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCallsArray);
-  }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(Telephony,
+                                               nsDOMEventTargetHelper)
+  NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(tmp->mCallsArray, "mCallsArray")
+NS_IMPL_CYCLE_COLLECTION_TRACE_END
+
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Telephony,
                                                 nsDOMEventTargetHelper)
   NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(incoming)
   tmp->mCalls.Clear();
   tmp->mActiveCall = nsnull;
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCallsArray)
+  tmp->mCallsArray = nsnull;
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Telephony)
   NS_INTERFACE_MAP_ENTRY(nsIDOMTelephony)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Telephony)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(Telephony, nsDOMEventTargetHelper)
@@ -244,27 +301,34 @@ Telephony::SetActive(const jsval& aActiv
       }
     }
   }
 
   return NS_ERROR_INVALID_ARG;
 }
 
 NS_IMETHODIMP
-Telephony::GetCalls(nsIDOMTelephonyCallArray** aCalls)
+Telephony::GetCalls(jsval* aCalls)
 {
-  nsRefPtr<TelephonyCallArray> calls = mCallsArray;
+  JSObject* calls = mCallsArray;
   if (!calls) {
-    calls = TelephonyCallArray::Create(this);
-    NS_ASSERTION(calls, "This should never fail!");
+    nsresult rv =
+      nsTArrayToJSArray(mScriptContext->GetNativeContext(),
+                        mScriptContext->GetNativeGlobal(), mCalls, &calls);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    if (!mRooted) {
+      NS_HOLD_JS_OBJECTS(this, Telephony);
+      mRooted = true;
+    }
 
     mCallsArray = calls;
   }
 
-  calls.forget(aCalls);
+  aCalls->setObject(*calls);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::StartTone(const nsAString& aDTMFChar)
 {
   if (aDTMFChar.IsEmpty()) {
     NS_WARNING("Empty tone string will be ignored");
--- a/dom/telephony/Telephony.h
+++ b/dom/telephony/Telephony.h
@@ -57,24 +57,30 @@ class Telephony : public nsDOMEventTarge
   nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
   nsCOMPtr<nsIRILTelephonyCallback> mRILTelephonyCallback;
 
   NS_DECL_EVENT_HANDLER(incoming)
 
   TelephonyCall* mActiveCall;
   nsTArray<nsRefPtr<TelephonyCall> > mCalls;
 
-  nsRefPtr<TelephonyCallArray> mCallsArray;
+  // Cached calls array object. Cleared whenever mCalls changes and then rebuilt
+  // once a page looks for the liveCalls attribute.
+  JSObject* mCallsArray;
+
+  bool mRooted;
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMTELEPHONY
   NS_DECL_NSIRILTELEPHONYCALLBACK
   NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Telephony, nsDOMEventTargetHelper)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
+                                                   Telephony,
+                                                   nsDOMEventTargetHelper)
 
   static already_AddRefed<Telephony>
   Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL);
 
   nsIDOMEventTarget*
   ToIDOMEventTarget() const
   {
     return static_cast<nsDOMEventTargetHelper*>(
@@ -87,23 +93,25 @@ public:
     return ToIDOMEventTarget();
   }
 
   void
   AddCall(TelephonyCall* aCall)
   {
     NS_ASSERTION(!mCalls.Contains(aCall), "Already know about this one!");
     mCalls.AppendElement(aCall);
+    mCallsArray = nsnull;
   }
 
   void
   RemoveCall(TelephonyCall* aCall)
   {
     NS_ASSERTION(mCalls.Contains(aCall), "Didn't know about this one!");
     mCalls.RemoveElement(aCall);
+    mCallsArray = nsnull;
   }
 
   nsIRadioInterfaceLayer*
   RIL() const
   {
     return mRIL;
   }
 
@@ -114,25 +122,19 @@ public:
   }
 
   nsIScriptContext*
   ScriptContext() const
   {
     return mScriptContext;
   }
 
-  const nsTArray<nsRefPtr<TelephonyCall> >&
-  Calls() const
-  {
-    return mCalls;
-  }
-
 private:
   Telephony()
-  : mActiveCall(nsnull)
+  : mActiveCall(nsnull), mCallsArray(nsnull), mRooted(false)
   { }
 
   ~Telephony();
 
   void
   SwitchActiveCall(TelephonyCall* aCall);
 
   class RILTelephonyCallback : public nsIRILTelephonyCallback
--- a/dom/telephony/TelephonyCall.cpp
+++ b/dom/telephony/TelephonyCall.cpp
@@ -38,17 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "TelephonyCall.h"
 
 #include "nsDOMClassInfo.h"
 
 #include "CallEvent.h"
 #include "Telephony.h"
-#include "TelephonyCallArray.h"
 
 USING_TELEPHONY_NAMESPACE
 
 // static
 already_AddRefed<TelephonyCall>
 TelephonyCall::Create(Telephony* aTelephony, const nsAString& aNumber,
                       PRUint16 aCallState, PRUint32 aCallIndex)
 {
deleted file mode 100644
--- a/dom/telephony/TelephonyCallArray.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=40: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Telephony.
- *
- * The Initial Developer of the Original Code is
- *   The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2012
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "TelephonyCallArray.h"
-
-// For NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER...
-#include "nsINode.h"
-
-#include "dombindings.h"
-#include "nsDOMClassInfo.h"
-
-#include "Telephony.h"
-#include "TelephonyCall.h"
-
-USING_TELEPHONY_NAMESPACE
-
-TelephonyCallArray::TelephonyCallArray(Telephony* aTelephony)
-: mTelephony(aTelephony)
-{
-  SetIsProxy();
-}
-
-TelephonyCallArray::~TelephonyCallArray()
-{ }
-
-// static
-already_AddRefed<TelephonyCallArray>
-TelephonyCallArray::Create(Telephony* aTelephony)
-{
-  nsRefPtr<TelephonyCallArray> array = new TelephonyCallArray(aTelephony);
-  return array.forget();
-}
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(TelephonyCallArray)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TelephonyCallArray)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
-  NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mTelephony");
-  cb.NoteXPCOMChild(tmp->mTelephony->ToISupports());
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(TelephonyCallArray)
-  NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
-NS_IMPL_CYCLE_COLLECTION_TRACE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TelephonyCallArray)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTelephony)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(TelephonyCallArray)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(TelephonyCallArray)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TelephonyCallArray)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TelephonyCallArray)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMTelephonyCallArray)
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-DOMCI_DATA(TelephonyCallArray, TelephonyCallArray)
-
-NS_IMETHODIMP
-TelephonyCallArray::GetLength(PRUint32* aLength)
-{
-  NS_ASSERTION(aLength, "Null pointer!");
-  *aLength = mTelephony->Calls().Length();
-  return NS_OK;
-}
-
-nsIDOMTelephonyCall*
-TelephonyCallArray::GetCallAt(PRUint32 aIndex)
-{
-  return mTelephony->Calls().SafeElementAt(aIndex);
-}
-
-nsISupports*
-TelephonyCallArray::GetParentObject() const
-{
-  return mTelephony->ToISupports();
-}
-
-JSObject*
-TelephonyCallArray::WrapObject(JSContext* aCx, XPCWrappedNativeScope* aScope,
-                               bool* aTriedToWrap)
-{
-  return mozilla::dom::binding::TelephonyCallArray::create(aCx, aScope, this,
-                                                           aTriedToWrap);
-}
deleted file mode 100644
--- a/dom/telephony/TelephonyCallArray.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=40: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Telephony.
- *
- * The Initial Developer of the Original Code is
- *   The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2012
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Ben Turner <bent.mozilla@gmail.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_dom_telephony_telephonycallarray_h__
-#define mozilla_dom_telephony_telephonycallarray_h__
-
-#include "TelephonyCommon.h"
-
-#include "nsIDOMTelephonyCallArray.h"
-
-BEGIN_TELEPHONY_NAMESPACE
-
-class TelephonyCallArray : public nsIDOMTelephonyCallArray,
-                           public nsWrapperCache
-{
-  nsRefPtr<Telephony> mTelephony;
-
-public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_NSIDOMTELEPHONYCALLARRAY
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TelephonyCallArray)
-
-  static already_AddRefed<TelephonyCallArray>
-  Create(Telephony* aTelephony);
-
-  nsISupports*
-  GetParentObject() const;
-
-  virtual JSObject*
-  WrapObject(JSContext* aCx, XPCWrappedNativeScope* aScope, bool* aTriedToWrap);
-
-private:
-  TelephonyCallArray(Telephony* aTelephony);
-  ~TelephonyCallArray();
-};
-
-END_TELEPHONY_NAMESPACE
-
-#endif // mozilla_dom_telephony_telephonycallarray_h__
--- a/dom/telephony/TelephonyCommon.h
+++ b/dom/telephony/TelephonyCommon.h
@@ -61,14 +61,12 @@ class nsIDOMTelephonyCall;
 BEGIN_TELEPHONY_NAMESPACE
 
 enum {
   kOutgoingPlaceholderCallIndex = PR_UINT32_MAX
 };
 
 class Telephony;
 class TelephonyCall;
-class TelephonyCallArray;
-class CallEvent;
 
 END_TELEPHONY_NAMESPACE
 
 #endif // mozilla_dom_telephony_telephonycommon_h__
--- a/dom/telephony/nsIDOMTelephony.idl
+++ b/dom/telephony/nsIDOMTelephony.idl
@@ -37,32 +37,31 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMEventTarget.idl"
 
 interface nsIDOMEventListener;
 interface nsIDOMTelephonyCall;
-interface nsIDOMTelephonyCallArray;
 
 [scriptable, builtinclass, uuid(047be0d8-a9cd-49aa-8948-2f60ff3a7a18)]
 interface nsIDOMTelephony : nsIDOMEventTarget
 {
   nsIDOMTelephonyCall dial(in DOMString number);
 
   attribute boolean muted;
   attribute boolean speakerEnabled;
 
   // The call that is "active", i.e. receives microphone input and tones
   // generated via startTone.
   attribute jsval active;
 
   // Array of all calls that are currently connected.
-  readonly attribute nsIDOMTelephonyCallArray calls;
+  readonly attribute jsval calls;
 
   void startTone(in DOMString tone);
   void stopTone();
   void sendTones(in DOMString tones,
                  [optional] in unsigned long toneDuration,
                  [optional] in unsigned long intervalDuration);
 
   attribute nsIDOMEventListener onincoming;
--- a/js/xpconnect/src/Makefile.in
+++ b/js/xpconnect/src/Makefile.in
@@ -98,17 +98,16 @@ LOCAL_INCLUDES = \
 		-I$(topsrcdir)/caps/include \
 		-I$(topsrcdir)/content/base/src \
 		-I$(topsrcdir)/content/html/content/src \
 		-I$(topsrcdir)/content/html/document/src \
 		-I$(topsrcdir)/content/svg/content/src \
 		-I$(topsrcdir)/layout/style \
 		-I$(topsrcdir)/layout/base \
 		-I$(topsrcdir)/dom/base \
-		-I$(topsrcdir)/dom/telephony \
 		-I$(topsrcdir)/xpcom/ds \
 		$(NULL)
 
 SHARED_LIBRARY_LIBS = \
   ../loader/$(LIB_PREFIX)jsloader_s.$(LIB_SUFFIX) \
   ../wrappers/$(LIB_PREFIX)xpcwrappers_s.$(LIB_SUFFIX) \
   $(NULL)
 
--- a/js/xpconnect/src/dombindings.conf
+++ b/js/xpconnect/src/dombindings.conf
@@ -1,13 +1,12 @@
 classes = {
     'NodeList': 'nsINodeList',
     'HTMLCollection': 'nsIHTMLCollection',
     'HTMLOptionsCollection': 'nsHTMLOptionCollection',
-    'TelephonyCallArray': 'mozilla::dom::telephony::TelephonyCallArray',
     }
 
 irregularFilenames = {
     'nsHTMLOptionCollection': 'nsHTMLSelectElement',
     }
 
 customInheritance = {
     'nsIDOMHTMLOptionsCollection': 'nsIDOMHTMLCollection',