Bug 1019191 part 13. Remove the now-unused castNativeArgFromWrapper and castNativeFromWrapper functions. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 22 Oct 2014 11:40:49 -0400
changeset 211769 63d3d488d188de36a4e66cf8db8c8c5b502b0f02
parent 211768 28abe750b8ef6a3d2f5f1643554045ecd8a18a01
child 211770 593ede2c00382a5bbbf5981cda18184093df771b
push id2
push usergszorc@mozilla.com
push dateWed, 29 Oct 2014 00:55:10 +0000
reviewerspeterv
bugs1019191
milestone36.0a1
Bug 1019191 part 13. Remove the now-unused castNativeArgFromWrapper and castNativeFromWrapper functions. r=peterv
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCQuickStubs.h
--- a/js/xpconnect/src/XPCQuickStubs.cpp
+++ b/js/xpconnect/src/XPCQuickStubs.cpp
@@ -144,70 +144,16 @@ castNative(JSContext *cx,
             return NS_OK;
         }
     }
 
     *pThisRef = nullptr;
     return NS_ERROR_XPC_BAD_OP_ON_WN_PROTO;
 }
 
-nsISupports*
-castNativeFromWrapper(JSContext *cx,
-                      JSObject *obj,
-                      uint32_t interfaceBit,
-                      uint32_t protoID,
-                      int32_t protoDepth,
-                      nsISupports **pRef,
-                      MutableHandleValue pVal,
-                      nsresult *rv)
-{
-    XPCWrappedNative *wrapper;
-    XPCWrappedNativeTearOff *tearoff;
-    JSObject *cur;
-
-    if (IS_WN_REFLECTOR(obj)) {
-        cur = obj;
-        wrapper = XPCWrappedNative::Get(obj);
-        tearoff = nullptr;
-    } else {
-        *rv = getWrapper(cx, obj, &wrapper, &cur, &tearoff);
-        if (NS_FAILED(*rv))
-            return nullptr;
-    }
-
-    nsISupports *native;
-    if (wrapper) {
-        native = wrapper->GetIdentityObject();
-        cur = wrapper->GetFlatJSObject();
-        if (!native || !HasBitInInterfacesBitmap(cur, interfaceBit)) {
-            native = nullptr;
-        }
-    } else if (cur && protoDepth >= 0) {
-        const mozilla::dom::DOMJSClass* domClass =
-            mozilla::dom::GetDOMClass(cur);
-        native = mozilla::dom::UnwrapDOMObject<nsISupports>(cur);
-        if (native &&
-            (uint32_t)domClass->mInterfaceChain[protoDepth] != protoID) {
-            native = nullptr;
-        }
-    } else {
-        native = nullptr;
-    }
-
-    if (native) {
-        *pRef = nullptr;
-        pVal.setObjectOrNull(cur);
-        *rv = NS_OK;
-    } else {
-        *rv = NS_ERROR_XPC_BAD_CONVERT_JS;
-    }
-
-    return native;
-}
-
 nsresult
 xpc_qsUnwrapArgImpl(JSContext *cx,
                     HandleValue v,
                     const nsIID &iid,
                     void **ppArg,
                     nsISupports **ppArgRef,
                     MutableHandleValue vp)
 {
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -23,26 +23,16 @@ castNative(JSContext *cx,
            XPCWrappedNative *wrapper,
            JSObject *cur,
            XPCWrappedNativeTearOff *tearoff,
            const nsIID &iid,
            void **ppThis,
            nsISupports **ppThisRef,
            JS::MutableHandleValue vp);
 
-nsISupports*
-castNativeFromWrapper(JSContext *cx,
-                      JSObject *obj,
-                      uint32_t interfaceBit,
-                      uint32_t protoID,
-                      int32_t protoDepth,
-                      nsISupports **pRef,
-                      JS::MutableHandleValue pVal,
-                      nsresult *rv);
-
 MOZ_ALWAYS_INLINE JSObject*
 xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv)
 {
     *rv = NS_OK;
     if (v.isObject()) {
         return &v.toObject();
     }
 
@@ -55,26 +45,9 @@ xpc_qsUnwrapObj(jsval v, nsISupports **p
     *ppArgRef = nullptr;
     return nullptr;
 }
 
 nsresult
 xpc_qsUnwrapArgImpl(JSContext *cx, JS::HandleValue v, const nsIID &iid, void **ppArg,
                     nsISupports **ppArgRef, JS::MutableHandleValue vp);
 
-MOZ_ALWAYS_INLINE nsISupports*
-castNativeArgFromWrapper(JSContext *cx,
-                         jsval v,
-                         uint32_t bit,
-                         uint32_t protoID,
-                         int32_t protoDepth,
-                         nsISupports **pArgRef,
-                         JS::MutableHandleValue vp,
-                         nsresult *rv)
-{
-    JSObject *src = xpc_qsUnwrapObj(v, pArgRef, rv);
-    if (!src)
-        return nullptr;
-
-    return castNativeFromWrapper(cx, src, bit, protoID, protoDepth, pArgRef, vp, rv);
-}
-
 #endif /* xpcquickstubs_h___ */