зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
6c525b5027
Коммит
c26753b139
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче