mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1019191 part 17. Make some of the remaining quickstub unwrap methods static. r=peterv
Note that we know that we always call UnwrapArg with an object, so xpc_qsUnwrapArgImpl knows v is always an object.
This commit is contained in:
parent
4d6d33db4c
commit
96247f112b
@ -48,7 +48,7 @@ getNativeFromWrapper(JSContext *cx,
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
getWrapper(JSContext *cx,
|
||||
JSObject *obj,
|
||||
XPCWrappedNative **wrapper,
|
||||
@ -106,7 +106,7 @@ getWrapper(JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
static nsresult
|
||||
castNative(JSContext *cx,
|
||||
XPCWrappedNative *wrapper,
|
||||
JSObject *curArg,
|
||||
@ -147,18 +147,13 @@ xpc_qsUnwrapArgImpl(JSContext *cx,
|
||||
nsISupports **ppArgRef,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
nsresult rv;
|
||||
RootedObject src(cx, xpc_qsUnwrapObj(v, ppArgRef, &rv));
|
||||
if (!src) {
|
||||
*ppArg = nullptr;
|
||||
|
||||
return rv;
|
||||
}
|
||||
MOZ_ASSERT(v.isObject());
|
||||
RootedObject src(cx, &v.toObject());
|
||||
|
||||
XPCWrappedNative *wrapper;
|
||||
XPCWrappedNativeTearOff *tearoff;
|
||||
JSObject *obj2;
|
||||
rv = getWrapper(cx, src, &wrapper, &obj2, &tearoff);
|
||||
nsresult rv = getWrapper(cx, src, &wrapper, &obj2, &tearoff);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (wrapper || obj2) {
|
||||
|
@ -11,41 +11,6 @@
|
||||
|
||||
/* XPCQuickStubs.h - Support functions used only by Web IDL bindings, for now. */
|
||||
|
||||
nsresult
|
||||
getWrapper(JSContext *cx,
|
||||
JSObject *obj,
|
||||
XPCWrappedNative **wrapper,
|
||||
JSObject **cur,
|
||||
XPCWrappedNativeTearOff **tearoff);
|
||||
|
||||
nsresult
|
||||
castNative(JSContext *cx,
|
||||
XPCWrappedNative *wrapper,
|
||||
JSObject *cur,
|
||||
XPCWrappedNativeTearOff *tearoff,
|
||||
const nsIID &iid,
|
||||
void **ppThis,
|
||||
nsISupports **ppThisRef,
|
||||
JS::MutableHandleValue vp);
|
||||
|
||||
MOZ_ALWAYS_INLINE JSObject*
|
||||
xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv)
|
||||
{
|
||||
*rv = NS_OK;
|
||||
if (v.isObject()) {
|
||||
return &v.toObject();
|
||||
}
|
||||
|
||||
if (!v.isNullOrUndefined()) {
|
||||
*rv = ((v.isInt32() && v.toInt32() == 0)
|
||||
? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL
|
||||
: NS_ERROR_XPC_BAD_CONVERT_JS);
|
||||
}
|
||||
|
||||
*ppArgRef = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
xpc_qsUnwrapArgImpl(JSContext *cx, JS::HandleValue v, const nsIID &iid, void **ppArg,
|
||||
nsISupports **ppArgRef, JS::MutableHandleValue vp);
|
||||
|
Loading…
Reference in New Issue
Block a user