Bug 952682 - New hazards in storage code, r=terrence

This commit is contained in:
Steve Fink 2013-12-20 15:58:36 -08:00
Родитель e60dface48
Коммит 6fd0c4d072
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -93,6 +93,8 @@ AsyncStatementParams::NewResolve(
bool *_retval
)
{
JS::Rooted<JSObject*> scopeObj(aCtx, aScopeObj);
NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
// We do not throw at any point after this because we want to allow the
// prototype chain to be checked for the property.
@ -103,7 +105,7 @@ AsyncStatementParams::NewResolve(
uint32_t idx = JSID_TO_INT(aId);
// All indexes are good because we don't know how many parameters there
// really are.
ok = ::JS_DefineElement(aCtx, aScopeObj, idx, JSVAL_VOID, nullptr,
ok = ::JS_DefineElement(aCtx, scopeObj, idx, JSVAL_VOID, nullptr,
nullptr, 0);
resolved = true;
}
@ -111,13 +113,13 @@ AsyncStatementParams::NewResolve(
// We are unable to tell if there's a parameter with this name and so
// we must assume that there is. This screws the rest of the prototype
// chain, but people really shouldn't be depending on this anyways.
ok = ::JS_DefinePropertyById(aCtx, aScopeObj, aId, JSVAL_VOID, nullptr,
ok = ::JS_DefinePropertyById(aCtx, scopeObj, aId, JSVAL_VOID, nullptr,
nullptr, 0);
resolved = true;
}
*_retval = ok;
*_objp = resolved && ok ? aScopeObj : nullptr;
*_objp = resolved && ok ? scopeObj.get() : nullptr;
return NS_OK;
}

Просмотреть файл

@ -123,6 +123,8 @@ StatementRow::NewResolve(nsIXPConnectWrappedNative *aWrapper,
JSObject **_objp,
bool *_retval)
{
JS::Rooted<JSObject*> scopeObj(aCtx, aScopeObj);
NS_ENSURE_TRUE(mStatement, NS_ERROR_NOT_INITIALIZED);
// We do not throw at any point after this because we want to allow the
// prototype chain to be checked for the property.
@ -142,9 +144,9 @@ StatementRow::NewResolve(nsIXPConnectWrappedNative *aWrapper,
return NS_OK;
}
*_retval = ::JS_DefinePropertyById(aCtx, aScopeObj, aId, JSVAL_VOID,
*_retval = ::JS_DefinePropertyById(aCtx, scopeObj, aId, JSVAL_VOID,
nullptr, nullptr, 0);
*_objp = aScopeObj;
*_objp = scopeObj;
return NS_OK;
}