Bug 1255800 - Remove JS_THIS_OBJECT from mozStorageStatementJSHelper. r=mrbkap

--HG--
extra : rebase_source : 626469757176f8843cbbb343d1b9f85e1b44a1c3
This commit is contained in:
Tom Schuster 2018-03-22 16:42:03 +01:00
parent 6eddb18596
commit d55955aaf6

View File

@ -31,17 +31,19 @@ namespace storage {
static
bool
stepFunc(JSContext *aCtx,
uint32_t,
JS::Value *_vp)
stepFunc(JSContext *aCtx, uint32_t argc, JS::Value *_vp)
{
JS::CallArgs args = CallArgsFromVp(argc, _vp);
nsCOMPtr<nsIXPConnect> xpc(mozilla::services::GetXPConnect());
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
JSObject *obj = JS_THIS_OBJECT(aCtx, _vp);
if (!obj) {
if (!args.thisv().isObject()) {
::JS_ReportErrorASCII(aCtx, "mozIStorageStatement::step() requires object");
return false;
}
JSObject *obj = &args.thisv().toObject();
nsresult rv =
xpc->GetWrappedNativeOfJSObject(aCtx, obj, getter_AddRefs(wrapper));
if (NS_FAILED(rv)) {
@ -65,7 +67,7 @@ stepFunc(JSContext *aCtx,
bool hasMore = false;
rv = stmt->ExecuteStep(&hasMore);
if (NS_SUCCEEDED(rv) && !hasMore) {
_vp->setBoolean(false);
args.rval().setBoolean(false);
(void)stmt->Reset();
return true;
}
@ -75,7 +77,7 @@ stepFunc(JSContext *aCtx,
return false;
}
_vp->setBoolean(hasMore);
args.rval().setBoolean(hasMore);
return true;
}