Bug 1401710 - Remove unused unsafe code from nsDOMClassInfo. r=bz
Also, the XPConnect() method is unused.
MozReview-Commit-ID: JycZIa9TbC8
--- 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)
{