Bug 1017752 - Remove nsDOMClassInfo::GetArrayIndexFromId; r=jst
authorMs2ger <ms2ger@gmail.com>
Fri, 06 Jun 2014 10:06:26 +0200
changeset 207365 5c269811a53e21686b158e6bda35c56c1b75685f
parent 207364 bf4000a8fce635ac0950dfaefef09757f954a368
child 207366 a84bd62d0b55923920e97285f7fa7b20f99e368a
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1017752
milestone32.0a1
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
Bug 1017752 - Remove nsDOMClassInfo::GetArrayIndexFromId; r=jst
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1114,44 +1114,16 @@ nsDOMClassInfo::Init()
   // Register new DOM bindings
   mozilla::dom::Register(nameSpaceManager);
 
   sIsInitialized = true;
 
   return NS_OK;
 }
 
-// static
-int32_t
-nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id, bool *aIsNumber)
-{
-  if (aIsNumber) {
-    *aIsNumber = false;
-  }
-
-  int i;
-  if (JSID_IS_INT(id)) {
-      i = JSID_TO_INT(id);
-  } else {
-      JS::Rooted<JS::Value> idval(cx);
-      double array_index;
-      if (!::JS_IdToValue(cx, id, &idval) ||
-          !JS::ToNumber(cx, idval, &array_index) ||
-          !::JS_DoubleIsInt32(array_index, &i)) {
-        return -1;
-      }
-  }
-
-  if (aIsNumber) {
-    *aIsNumber = true;
-  }
-
-  return i;
-}
-
 NS_IMETHODIMP
 nsDOMClassInfo::GetInterfaces(uint32_t *aCount, nsIID ***aArray)
 {
   uint32_t count = 0;
 
   while (mData->mInterfaces[count]) {
     count++;
   }
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -144,22 +144,16 @@ protected:
   }
 
   static nsresult Init();
   static nsresult RegisterClassProtos(int32_t aDOMClassInfoID);
   static nsresult RegisterExternalClasses();
   nsresult ResolveConstructor(JSContext *cx, JSObject *obj,
                               JSObject **objp);
 
-  // Checks if id is a number and returns the number, if aIsNumber is
-  // non-null it's set to true if the id is a number and false if it's
-  // not a number. If id is not a number this method returns -1
-  static int32_t GetArrayIndexFromId(JSContext *cx, JS::Handle<jsid> id,
-                                     bool *aIsNumber = nullptr);
-
   static nsIXPConnect *sXPConnect;
   static nsIScriptSecurityManager *sSecMan;
 
   // nsIXPCScriptable code
   static nsresult DefineStaticJSVals(JSContext *cx);
 
   static bool sIsInitialized;