diff --git a/dom/indexedDB/AsyncConnectionHelper.cpp b/dom/indexedDB/AsyncConnectionHelper.cpp index 7d0219d94f51..ea72418384de 100644 --- a/dom/indexedDB/AsyncConnectionHelper.cpp +++ b/dom/indexedDB/AsyncConnectionHelper.cpp @@ -56,7 +56,7 @@ ConvertCloneReadInfosToArrayInternal( nsTArray& aReadInfos, jsval* aResult) { - JS::Rooted 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 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; } diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp index 1329be02eeb5..23438685aec9 100644 --- a/dom/indexedDB/IDBCursor.cpp +++ b/dom/indexedDB/IDBCursor.cpp @@ -608,8 +608,8 @@ IDBCursor::GetValue(JSContext* aCx, mRooted = true; } - JS::Rooted 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 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 key(aCx); - nsresult rv = objectKey.ToJSVal(aCx, key.address()); + jsval key; + nsresult rv = objectKey.ToJSVal(aCx, &key); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr request; diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index 96d0523908eb..a8f831d4c7b0 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -658,7 +658,7 @@ IDBDatabase::Transaction(const jsval& aStoreNames, nsTArray storesToOpen; if (!JSVAL_IS_PRIMITIVE(aStoreNames)) { - JS::Rooted 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 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; diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 596cd6f8eb30..a55cdb1c27af 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -218,8 +218,8 @@ IDBFactory::Create(ContentParent* aContentParent, nsresult rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(globalHolder)); NS_ENSURE_SUCCESS(rv, rv); - JS::Rooted 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 diff --git a/dom/indexedDB/IDBIndex.cpp b/dom/indexedDB/IDBIndex.cpp index deb65e98a668..b08e24fce5de 100644 --- a/dom/indexedDB/IDBIndex.cpp +++ b/dom/indexedDB/IDBIndex.cpp @@ -1493,7 +1493,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx, JSAutoRequest ar(aCx); - JS::Rooted 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 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; } diff --git a/dom/indexedDB/IDBKeyRange.cpp b/dom/indexedDB/IDBKeyRange.cpp index b4580aa3d2c6..cd1e487aabb8 100644 --- a/dom/indexedDB/IDBKeyRange.cpp +++ b/dom/indexedDB/IDBKeyRange.cpp @@ -52,8 +52,8 @@ ReturnKeyRange(JSContext* aCx, return false; } - JS::Rooted 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 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 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 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 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; } diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 7c8ee083ef09..05db955ac477 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -726,11 +726,11 @@ public: fileInfo); } - JS::Rooted wrappedBlob(aCx); + jsval wrappedBlob; JS::Rooted 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 wrappedFile(aCx); + jsval wrappedFile; JS::Rooted 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 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 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 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 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 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; } diff --git a/dom/indexedDB/IDBRequest.cpp b/dom/indexedDB/IDBRequest.cpp index 8ccefaf9ca8f..055914b1493b 100644 --- a/dom/indexedDB/IDBRequest.cpp +++ b/dom/indexedDB/IDBRequest.cpp @@ -114,7 +114,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper) return rv; } - JS::Rooted global(cx, GetParentObject()); + JSObject* global = GetParentObject(); NS_ASSERTION(global, "This should never be null!"); JSAutoRequest ar(cx); diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index d15e49bbcc82..528385bc39d5 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -419,7 +419,7 @@ IndexedDatabaseManager::InitWindowless(const jsval& aObj, JSContext* aCx) // exceptions. nsCOMPtr sof(do_GetService(kDOMSOF_CID)); - JS::Rooted global(aCx, JS_GetGlobalForObject(aCx, obj)); + JSObject* global = JS_GetGlobalForObject(aCx, obj); NS_ASSERTION(global, "What?! No global!"); nsRefPtr factory; @@ -429,8 +429,8 @@ IndexedDatabaseManager::InitWindowless(const jsval& aObj, JSContext* aCx) NS_ASSERTION(factory, "This should never fail for chrome!"); - JS::Rooted 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 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)) { diff --git a/dom/indexedDB/Key.cpp b/dom/indexedDB/Key.cpp index 5cf86ae09a59..2249e869d61e 100644 --- a/dom/indexedDB/Key.cpp +++ b/dom/indexedDB/Key.cpp @@ -133,7 +133,7 @@ Key::EncodeJSValInternal(JSContext* aCx, const jsval aVal, } if (!JSVAL_IS_PRIMITIVE(aVal)) { - JS::Rooted 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 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 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 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; } diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index 7df8af83812c..cc19156af856 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -91,9 +91,9 @@ GetJSValFromKeyPathString(JSContext* aCx, KeyPathTokenizer tokenizer(aKeyPathString, '.'); nsString targetObjectPropName; - JS::Rooted targetObject(aCx, nullptr); - JS::Rooted 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 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 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 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 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 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)) { @@ -346,23 +346,23 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue, return GetJSValFromKeyPathString(aCx, aValue, mStrings[0], aOutVal, DoNotCreateProperties, nullptr, nullptr); } - + const uint32_t len = mStrings.Length(); JS::RootedObject arrayObj(aCx, JS_NewArrayObject(aCx, len, nullptr)); if (!arrayObj) { return NS_ERROR_OUT_OF_MEMORY; } - JS::Rooted 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 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 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 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; } } diff --git a/dom/indexedDB/ipc/IndexedDBParent.cpp b/dom/indexedDB/ipc/IndexedDBParent.cpp index 3624db39c531..8c91c481d8c2 100644 --- a/dom/indexedDB/ipc/IndexedDBParent.cpp +++ b/dom/indexedDB/ipc/IndexedDBParent.cpp @@ -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 result(cx); - rv = mOpenRequest->GetResult(result.address()); - NS_ENSURE_SUCCESS(rv, rv); - - MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result)); - nsCOMPtr 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 newVersionVal(cx); - rv = changeEvent->GetNewVersion(cx, newVersionVal.address()); + JS::Value newVersionVal; + rv = changeEvent->GetNewVersion(cx, &newVersionVal); NS_ENSURE_SUCCESS(rv, rv); uint64_t newVersion;