Bug 613457 - use *ById JSAPIs in storage (r=sdwilsh)

--HG--
extra : rebase_source : bc2548573f500f664b37b24e95bdc3b9502ba28f
This commit is contained in:
Luke Wagner 2011-03-21 11:37:47 -07:00
Родитель 2c5916ee4c
Коммит 2f574701ec
2 изменённых файлов: 5 добавлений и 10 удалений

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

@ -140,15 +140,11 @@ AsyncStatementParams::NewResolve(
resolved = true;
}
else if (JSID_IS_STRING(aId)) {
JSString *str = JSID_TO_STRING(aId);
size_t nameLength;
const jschar *nameChars = ::JS_GetInternedStringCharsAndLength(str, &nameLength);
// 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_DefineUCProperty(aCtx, aScopeObj, nameChars, nameLength,
JSVAL_VOID, nsnull, nsnull, 0);
ok = ::JS_DefinePropertyById(aCtx, aScopeObj, aId, JSVAL_VOID, nsnull,
nsnull, 0);
resolved = true;
}

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

@ -218,13 +218,12 @@ StatementParams::NewResolve(nsIXPConnectWrappedNative *aWrapper,
// Check to see if there's a parameter with this name, and if not, let
// the rest of the prototype chain be checked.
NS_ConvertUTF16toUTF8 name(reinterpret_cast<const PRUnichar *>(nameChars),
nameLength);
NS_ConvertUTF16toUTF8 name(nameChars, nameLength);
PRUint32 idx;
nsresult rv = mStatement->GetParameterIndex(name, &idx);
if (NS_SUCCEEDED(rv)) {
ok = ::JS_DefineUCProperty(aCtx, aScopeObj, nameChars, nameLength,
JSVAL_VOID, nsnull, nsnull, JSPROP_ENUMERATE);
ok = ::JS_DefinePropertyById(aCtx, aScopeObj, aId, JSVAL_VOID, nsnull,
nsnull, JSPROP_ENUMERATE);
resolved = true;
}
}