Bug 1401710 - Remove unused unsafe code from nsDOMClassInfo. r=bz draft
authorAndrew McCreight <continuation@gmail.com>
Wed, 20 Sep 2017 13:01:48 -0700
changeset 667835 2dea048f5f1cf4af6b4fc782ee167ecda52705c0
parent 667834 f5e56b8b2de3b804ea9446acf476f4cd0558e349
child 732530 f675fbdbd02a71b67394f294c1dfb4578ffd864c
push id80866
push userbmo:continuation@gmail.com
push dateWed, 20 Sep 2017 20:39:49 +0000
reviewersbz
bugs1401710
milestone57.0a1
Bug 1401710 - Remove unused unsafe code from nsDOMClassInfo. r=bz Also, the XPConnect() method is unused. MozReview-Commit-ID: JycZIa9TbC8
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -235,24 +235,16 @@ SetParentToWindow(nsGlobalWindow *win, J
   if (MOZ_UNLIKELY(!*parent)) {
     // The inner window has been torn down. The scope is dying, so don't create
     // any new wrappers.
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
-// static
-
-nsISupports *
-nsDOMClassInfo::GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
-{
-  return wrapper ? wrapper->Native() : static_cast<nsISupports*>(js::GetObjectPrivate(obj));
-}
-
 nsresult
 nsDOMClassInfo::DefineStaticJSVals()
 {
   AutoJSAPI jsapi;
   if (!jsapi.Init(xpc::UnprivilegedJunkScope())) {
     return NS_ERROR_UNEXPECTED;
   }
   JSContext* cx = jsapi.cx();
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -87,23 +87,16 @@ public:
    * helper with a wrapper, even though we should be treating the lookup as a
    * transparent one.
    *
    * Note: So ObjectIsNativeWrapper(cx, obj) check usually means "through xray
    * wrapper this part is not visible".
    */
   static bool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj);
 
-  static nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj);
-
-  static nsIXPConnect *XPConnect()
-  {
-    return sXPConnect;
-  }
-
 protected:
   friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
 
   const nsDOMClassInfoData* mData;
 
   virtual void PreserveWrapper(nsISupports *aNative) override
   {
   }
@@ -117,37 +110,16 @@ protected:
 
   static bool sIsInitialized;
 
 public:
   static jsid sConstructor_id;
   static jsid sWrappedJSObject_id;
 };
 
-// THIS ONE ISN'T SAFE!! It assumes that the private of the JSObject is
-// an nsISupports.
-inline
-const nsQueryInterface
-do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj)
-{
-  return nsQueryInterface(nsDOMClassInfo::GetNative(wrapper, obj));
-}
-
-// THIS ONE ISN'T SAFE!! It assumes that the private of the JSObject is
-// an nsISupports.
-inline
-const nsQueryInterfaceWithError
-do_QueryWrappedNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj,
-                      nsresult *aError)
-
-{
-  return nsQueryInterfaceWithError(nsDOMClassInfo::GetNative(wrapper, obj),
-                                   aError);
-}
-
 typedef nsDOMClassInfo nsDOMGenericSH;
 
 // Makes sure that the wrapper is preserved if new properties are added.
 class nsEventTargetSH : public nsDOMGenericSH
 {
 protected:
   explicit nsEventTargetSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
   {