mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 11:28:38 +00:00
Backed out changeset 7c0ace2560c4 (bug 866450)
This commit is contained in:
parent
b957907d9a
commit
55c0577379
@ -56,7 +56,7 @@ ConvertCloneReadInfosToArrayInternal(
|
||||
nsTArray<StructuredCloneReadInfo>& aReadInfos,
|
||||
jsval* aResult)
|
||||
{
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
|
||||
JSObject* array = JS_NewArrayObject(aCx, 0, nullptr);
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
@ -72,13 +72,13 @@ ConvertCloneReadInfosToArrayInternal(
|
||||
index++) {
|
||||
StructuredCloneReadInfo& readInfo = aReadInfos[index];
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!IDBObjectStore::DeserializeValue(aCx, readInfo, val.address())) {
|
||||
jsval val;
|
||||
if (!IDBObjectStore::DeserializeValue(aCx, readInfo, &val)) {
|
||||
NS_WARNING("Failed to decode!");
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, index, val.address())) {
|
||||
if (!JS_SetElement(aCx, array, index, &val)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
@ -608,8 +608,8 @@ IDBCursor::GetValue(JSContext* aCx,
|
||||
mRooted = true;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, val.address())) {
|
||||
jsval val;
|
||||
if (!IDBObjectStore::DeserializeValue(aCx, mCloneReadInfo, &val)) {
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
}
|
||||
|
||||
@ -740,8 +740,8 @@ IDBCursor::Update(const jsval& aValue,
|
||||
}
|
||||
}
|
||||
else {
|
||||
JS::Rooted<JS::Value> keyVal(aCx);
|
||||
rv = objectKey.ToJSVal(aCx, keyVal.address());
|
||||
jsval keyVal;
|
||||
rv = objectKey.ToJSVal(aCx, &keyVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mObjectStore->Put(aValue, keyVal, aCx, 1, getter_AddRefs(request));
|
||||
@ -811,8 +811,8 @@ IDBCursor::Delete(JSContext* aCx,
|
||||
|
||||
Key& objectKey = (mType == OBJECTSTORE) ? mKey : mObjectKey;
|
||||
|
||||
JS::Rooted<JS::Value> key(aCx);
|
||||
nsresult rv = objectKey.ToJSVal(aCx, key.address());
|
||||
jsval key;
|
||||
nsresult rv = objectKey.ToJSVal(aCx, &key);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIIDBRequest> request;
|
||||
|
@ -658,7 +658,7 @@ IDBDatabase::Transaction(const jsval& aStoreNames,
|
||||
nsTArray<nsString> storesToOpen;
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(aStoreNames)) {
|
||||
JS::Rooted<JSObject*> obj(aCx, JSVAL_TO_OBJECT(aStoreNames));
|
||||
JSObject* obj = JSVAL_TO_OBJECT(aStoreNames);
|
||||
|
||||
// See if this is a JS array.
|
||||
if (JS_IsArrayObject(aCx, obj)) {
|
||||
@ -674,10 +674,10 @@ IDBDatabase::Transaction(const jsval& aStoreNames,
|
||||
storesToOpen.SetCapacity(length);
|
||||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
jsval val;
|
||||
JSString* jsstr;
|
||||
nsDependentJSString str;
|
||||
if (!JS_GetElement(aCx, obj, index, val.address()) ||
|
||||
if (!JS_GetElement(aCx, obj, index, &val) ||
|
||||
!(jsstr = JS_ValueToString(aCx, val)) ||
|
||||
!str.init(aCx, jsstr)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
|
@ -218,8 +218,8 @@ IDBFactory::Create(ContentParent* aContentParent,
|
||||
nsresult rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JSObject*> global(cx);
|
||||
rv = globalHolder->GetJSObject(global.address());
|
||||
JSObject* global;
|
||||
rv = globalHolder->GetJSObject(&global);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The CreateSandbox call returns a proxy to the actual sandbox object. We
|
||||
|
@ -1493,7 +1493,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
||||
|
||||
JSAutoRequest ar(aCx);
|
||||
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, NULL));
|
||||
JSObject* array = JS_NewArrayObject(aCx, 0, NULL);
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
@ -1509,14 +1509,14 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
||||
const Key& key = keys[index];
|
||||
NS_ASSERTION(!key.IsUnset(), "Bad key!");
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
nsresult rv = key.ToJSVal(aCx, value.address());
|
||||
jsval value;
|
||||
nsresult rv = key.ToJSVal(aCx, &value);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to get jsval for key!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, index, value.address())) {
|
||||
if (!JS_SetElement(aCx, array, index, &value)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ ReturnKeyRange(JSContext* aCx,
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> result(aCx);
|
||||
if (NS_FAILED(holder->GetJSObject(result.address()))) {
|
||||
JSObject* result;
|
||||
if (NS_FAILED(holder->GetJSObject(&result))) {
|
||||
JS_ReportError(aCx, "Couldn't get JSObject from wrapper.");
|
||||
return false;
|
||||
}
|
||||
@ -113,8 +113,8 @@ MakeOnlyKeyRange(JSContext* aCx,
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v", val.address())) {
|
||||
jsval val;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v", &val)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -134,9 +134,9 @@ MakeLowerBoundKeyRange(JSContext* aCx,
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
jsval val;
|
||||
JSBool open = false;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/b", val.address(), &open)) {
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/b", &val, &open)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -156,9 +156,9 @@ MakeUpperBoundKeyRange(JSContext* aCx,
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
jsval val;
|
||||
JSBool open = false;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/b", val.address(), &open)) {
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "v/b", &val, &open)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -178,10 +178,10 @@ MakeBoundKeyRange(JSContext* aCx,
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
JS::Rooted<JS::Value> lowerVal(aCx), upperVal(aCx);
|
||||
jsval lowerVal, upperVal;
|
||||
JSBool lowerOpen = false, upperOpen = false;
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "vv/bb", lowerVal.address(),
|
||||
upperVal.address(), &lowerOpen, &upperOpen)) {
|
||||
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "vv/bb", &lowerVal,
|
||||
&upperVal, &lowerOpen, &upperOpen)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -726,11 +726,11 @@ public:
|
||||
fileInfo);
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> wrappedBlob(aCx);
|
||||
jsval wrappedBlob;
|
||||
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForScopeChain(aCx));
|
||||
rv =
|
||||
nsContentUtils::WrapNative(aCx, global, domBlob,
|
||||
&NS_GET_IID(nsIDOMBlob), wrappedBlob.address());
|
||||
&NS_GET_IID(nsIDOMBlob), &wrappedBlob);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to wrap native!");
|
||||
return nullptr;
|
||||
@ -753,11 +753,11 @@ public:
|
||||
nativeFile, fileInfo);
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> wrappedFile(aCx);
|
||||
jsval wrappedFile;
|
||||
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForScopeChain(aCx));
|
||||
rv =
|
||||
nsContentUtils::WrapNative(aCx, global, domFile,
|
||||
&NS_GET_IID(nsIDOMFile), wrappedFile.address());
|
||||
&NS_GET_IID(nsIDOMFile), &wrappedFile);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to wrap native!");
|
||||
return nullptr;
|
||||
@ -795,7 +795,7 @@ public:
|
||||
// File.name
|
||||
// File.lastModifiedDate
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, nullptr, nullptr, nullptr));
|
||||
JSObject* obj = JS_NewObject(aCx, nullptr, nullptr, nullptr);
|
||||
if (!obj) {
|
||||
NS_WARNING("Failed to create object!");
|
||||
return nullptr;
|
||||
@ -804,8 +804,8 @@ public:
|
||||
// Technically these props go on the proto, but this detail won't change
|
||||
// the results of index creation.
|
||||
|
||||
JS::RootedString type(aCx,
|
||||
JS_NewUCStringCopyN(aCx, aData.type.get(), aData.type.Length()));
|
||||
JSString* type =
|
||||
JS_NewUCStringCopyN(aCx, aData.type.get(), aData.type.Length());
|
||||
if (!type ||
|
||||
!JS_DefineProperty(aCx, obj, "size",
|
||||
JS_NumberValue((double)aData.size),
|
||||
@ -930,15 +930,15 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(val) &&
|
||||
JS_IsArrayObject(aCx, JSVAL_TO_OBJECT(val))) {
|
||||
JS::Rooted<JSObject*> array(aCx, JSVAL_TO_OBJECT(val));
|
||||
JSObject* array = JSVAL_TO_OBJECT(val);
|
||||
uint32_t arrayLength;
|
||||
if (!JS_GetArrayLength(aCx, array, &arrayLength)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
for (uint32_t arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
|
||||
JS::Rooted<JS::Value> arrayItem(aCx);
|
||||
if (!JS_GetElement(aCx, array, arrayIndex, arrayItem.address())) {
|
||||
jsval arrayItem;
|
||||
if (!JS_GetElement(aCx, array, arrayIndex, &arrayItem)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
@ -1818,7 +1818,7 @@ IDBObjectStore::AddOrPut(const jsval& aValue,
|
||||
return NS_ERROR_DOM_INDEXEDDB_READ_ONLY_ERR;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> keyval(aCx, (aOptionalArgCount >= 1) ? aKey : JSVAL_VOID);
|
||||
jsval keyval = (aOptionalArgCount >= 1) ? aKey : JSVAL_VOID;
|
||||
|
||||
StructuredCloneWriteInfo cloneWriteInfo;
|
||||
Key key;
|
||||
@ -4028,8 +4028,8 @@ CreateIndexHelper::InsertDataFromObjectStore(mozIStorageConnection* aConnection)
|
||||
nullptr
|
||||
};
|
||||
|
||||
JS::Rooted<JS::Value> clone(cx);
|
||||
if (!buffer.read(cx, clone.address(), &callbacks, &cloneReadInfo)) {
|
||||
jsval clone;
|
||||
if (!buffer.read(cx, &clone, &callbacks, &cloneReadInfo)) {
|
||||
NS_WARNING("Failed to deserialize structured clone data!");
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
|
||||
return rv;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> global(cx, GetParentObject());
|
||||
JSObject* global = GetParentObject();
|
||||
NS_ASSERTION(global, "This should never be null!");
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
@ -419,7 +419,7 @@ IndexedDatabaseManager::InitWindowless(const jsval& aObj, JSContext* aCx)
|
||||
// exceptions.
|
||||
nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID));
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, obj));
|
||||
JSObject* global = JS_GetGlobalForObject(aCx, obj);
|
||||
NS_ASSERTION(global, "What?! No global!");
|
||||
|
||||
nsRefPtr<IDBFactory> factory;
|
||||
@ -429,8 +429,8 @@ IndexedDatabaseManager::InitWindowless(const jsval& aObj, JSContext* aCx)
|
||||
|
||||
NS_ASSERTION(factory, "This should never fail for chrome!");
|
||||
|
||||
JS::Rooted<JS::Value> indexedDBVal(aCx);
|
||||
rv = nsContentUtils::WrapNative(aCx, obj, factory, indexedDBVal.address());
|
||||
jsval indexedDBVal;
|
||||
rv = nsContentUtils::WrapNative(aCx, obj, factory, &indexedDBVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!JS_DefineProperty(aCx, obj, "indexedDB", indexedDBVal, nullptr,
|
||||
@ -438,7 +438,7 @@ IndexedDatabaseManager::InitWindowless(const jsval& aObj, JSContext* aCx)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> keyrangeObj(aCx, JS_NewObject(aCx, nullptr, nullptr, nullptr));
|
||||
JSObject* keyrangeObj = JS_NewObject(aCx, nullptr, nullptr, nullptr);
|
||||
NS_ENSURE_TRUE(keyrangeObj, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (!IDBKeyRange::DefineConstructors(aCx, keyrangeObj)) {
|
||||
|
@ -133,7 +133,7 @@ Key::EncodeJSValInternal(JSContext* aCx, const jsval aVal,
|
||||
}
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(aVal)) {
|
||||
JS::Rooted<JSObject*> obj(aCx, JSVAL_TO_OBJECT(aVal));
|
||||
JSObject* obj = JSVAL_TO_OBJECT(aVal);
|
||||
if (JS_IsArrayObject(aCx, obj)) {
|
||||
aTypeOffset += eMaxType;
|
||||
|
||||
@ -151,8 +151,8 @@ Key::EncodeJSValInternal(JSContext* aCx, const jsval aVal,
|
||||
}
|
||||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
if (!JS_GetElement(aCx, obj, index, val.address())) {
|
||||
jsval val;
|
||||
if (!JS_GetElement(aCx, obj, index, &val)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
||||
NS_ENSURE_TRUE(aRecursionDepth < MaxRecursionDepth, NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
|
||||
|
||||
if (*aPos - aTypeOffset >= eArray) {
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, 0, nullptr));
|
||||
JSObject* array = JS_NewArrayObject(aCx, 0, nullptr);
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
@ -206,14 +206,14 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
||||
|
||||
uint32_t index = 0;
|
||||
while (aPos < aEnd && *aPos - aTypeOffset != eTerminator) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
jsval val;
|
||||
nsresult rv = DecodeJSValInternal(aPos, aEnd, aCx, aTypeOffset,
|
||||
val.address(), aRecursionDepth + 1);
|
||||
&val, aRecursionDepth + 1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aTypeOffset = 0;
|
||||
|
||||
if (!JS_SetElement(aCx, array, index++, val.address())) {
|
||||
if (!JS_SetElement(aCx, array, index++, &val)) {
|
||||
NS_WARNING("Failed to set array element!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
||||
KeyPathTokenizer tokenizer(aKeyPathString, '.');
|
||||
|
||||
nsString targetObjectPropName;
|
||||
JS::Rooted<JSObject*> targetObject(aCx, nullptr);
|
||||
JS::Rooted<JSObject*> obj(aCx, JSVAL_IS_PRIMITIVE(aValue) ? nullptr :
|
||||
JSVAL_TO_OBJECT(aValue));
|
||||
JSObject* targetObject = nullptr;
|
||||
JSObject* obj = JSVAL_IS_PRIMITIVE(aValue) ? nullptr :
|
||||
JSVAL_TO_OBJECT(aValue);
|
||||
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
const nsDependentSubstring& token = tokenizer.nextToken();
|
||||
@ -116,9 +116,9 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
||||
|
||||
if (hasProp) {
|
||||
// Get if the property exists...
|
||||
JS::Rooted<JS::Value> intermediate(aCx);
|
||||
jsval intermediate;
|
||||
JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen,
|
||||
intermediate.address());
|
||||
&intermediate);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Treat explicitly undefined as an error.
|
||||
@ -203,10 +203,10 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
||||
if (targetObject) {
|
||||
// If this fails, we lose, and the web page sees a magical property
|
||||
// appear on the object :-(
|
||||
JS::Rooted<JS::Value> succeeded(aCx);
|
||||
jsval succeeded;
|
||||
if (!JS_DeleteUCProperty2(aCx, targetObject,
|
||||
targetObjectPropName.get(),
|
||||
targetObjectPropName.Length(), succeeded.address())) {
|
||||
targetObjectPropName.Length(), &succeeded)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
NS_ASSERTION(JSVAL_IS_BOOLEAN(succeeded), "Wtf?");
|
||||
@ -232,7 +232,7 @@ KeyPath::Parse(JSContext* aCx, const JS::Value& aValue, KeyPath* aKeyPath)
|
||||
if (!JSVAL_IS_PRIMITIVE(aValue) &&
|
||||
JS_IsArrayObject(aCx, JSVAL_TO_OBJECT(aValue))) {
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, JSVAL_TO_OBJECT(aValue));
|
||||
JSObject* obj = JSVAL_TO_OBJECT(aValue);
|
||||
|
||||
uint32_t length;
|
||||
if (!JS_GetArrayLength(aCx, obj, &length)) {
|
||||
@ -246,10 +246,10 @@ KeyPath::Parse(JSContext* aCx, const JS::Value& aValue, KeyPath* aKeyPath)
|
||||
keyPath.SetType(ARRAY);
|
||||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
jsval val;
|
||||
JSString* jsstr;
|
||||
nsDependentJSString str;
|
||||
if (!JS_GetElement(aCx, obj, index, val.address()) ||
|
||||
if (!JS_GetElement(aCx, obj, index, &val) ||
|
||||
!(jsstr = JS_ValueToString(aCx, val)) ||
|
||||
!str.init(aCx, jsstr)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -313,12 +313,12 @@ nsresult
|
||||
KeyPath::ExtractKey(JSContext* aCx, const JS::Value& aValue, Key& aKey) const
|
||||
{
|
||||
uint32_t len = mStrings.Length();
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
JS::Value value;
|
||||
|
||||
aKey.Unset();
|
||||
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[i], value.address(),
|
||||
nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[i], &value,
|
||||
DoNotCreateProperties, nullptr,
|
||||
nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -353,16 +353,16 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
JS::Value value;
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[i], value.address(),
|
||||
nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[i], &value,
|
||||
DoNotCreateProperties, nullptr,
|
||||
nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!JS_SetElement(aCx, arrayObj, i, value.address())) {
|
||||
if (!JS_SetElement(aCx, arrayObj, i, &value)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
@ -378,11 +378,11 @@ KeyPath::ExtractOrCreateKey(JSContext* aCx, const JS::Value& aValue,
|
||||
{
|
||||
NS_ASSERTION(IsString(), "This doesn't make sense!");
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
JS::Value value;
|
||||
|
||||
aKey.Unset();
|
||||
|
||||
nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[0], value.address(),
|
||||
nsresult rv = GetJSValFromKeyPathString(aCx, aValue, mStrings[0], &value,
|
||||
CreateProperties, aCallback,
|
||||
aClosure);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -457,20 +457,20 @@ KeyPath::ToJSVal(JSContext* aCx, JS::Value* aValue) const
|
||||
{
|
||||
if (IsArray()) {
|
||||
uint32_t len = mStrings.Length();
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, len, nullptr));
|
||||
JSObject* array = JS_NewArrayObject(aCx, len, nullptr);
|
||||
if (!array) {
|
||||
NS_WARNING("Failed to make array!");
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
jsval val;
|
||||
nsString tmp(mStrings[i]);
|
||||
if (!xpc::StringToJsval(aCx, tmp, val.address())) {
|
||||
if (!xpc::StringToJsval(aCx, tmp, &val)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (!JS_SetElement(aCx, array, i, val.address())) {
|
||||
if (!JS_SetElement(aCx, array, i, &val)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -384,17 +384,17 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
jsval result;
|
||||
rv = mOpenRequest->GetResult(&result);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result));
|
||||
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
MOZ_ASSERT(xpc);
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
|
||||
JS::Rooted<JS::Value> result(cx);
|
||||
rv = mOpenRequest->GetResult(result.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result));
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||
rv = xpc->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(result),
|
||||
getter_AddRefs(wrapper));
|
||||
@ -536,8 +536,8 @@ IndexedDBDatabaseParent::HandleDatabaseEvent(nsIDOMEvent* aEvent,
|
||||
rv = changeEvent->GetOldVersion(&oldVersion);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JS::Rooted<JS::Value> newVersionVal(cx);
|
||||
rv = changeEvent->GetNewVersion(cx, newVersionVal.address());
|
||||
JS::Value newVersionVal;
|
||||
rv = changeEvent->GetNewVersion(cx, &newVersionVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint64_t newVersion;
|
||||
|
Loading…
Reference in New Issue
Block a user