зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900986 - Convert JS_*Element API to use MutableHandleValue for out params r=terrence r=bholley r=smaug
This commit is contained in:
Родитель
7e34a56fc6
Коммит
fb6671743e
|
@ -219,7 +219,7 @@ nsDOMMultipartFile::InitBlob(JSContext* aCx,
|
|||
JS_ALWAYS_TRUE(JS_GetArrayLength(aCx, obj, &length));
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> element(aCx);
|
||||
if (!JS_GetElement(aCx, obj, i, element.address()))
|
||||
if (!JS_GetElement(aCx, obj, i, &element))
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
|
||||
if (element.isObject()) {
|
||||
|
|
|
@ -401,7 +401,7 @@ nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
|
|||
retval[i].Length(), &ret)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, ret.address()),
|
||||
NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, &ret),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
|
|
|
@ -1232,7 +1232,7 @@ ObjectToMatrix(JSContext* cx, JS::Handle<JSObject*> obj, Matrix& matrix,
|
|||
for (uint32_t i = 0; i < 6; ++i) {
|
||||
JS::Rooted<JS::Value> elt(cx);
|
||||
double d;
|
||||
if (!JS_GetElement(cx, obj, i, elt.address())) {
|
||||
if (!JS_GetElement(cx, obj, i, &elt)) {
|
||||
error.Throw(NS_ERROR_FAILURE);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ JSValToDashArray(JSContext* cx, const JS::Value& patternArray,
|
|||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> elt(cx);
|
||||
double d;
|
||||
if (!JS_GetElement(cx, obj, i, elt.address())) {
|
||||
if (!JS_GetElement(cx, obj, i, &elt)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!(CoerceDouble(elt, &d) &&
|
||||
|
|
|
@ -259,7 +259,7 @@ nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx,
|
|||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> temp(aCx);
|
||||
if (!JS_GetElement(aCx, seq, i, temp.address())) {
|
||||
if (!JS_GetElement(aCx, seq, i, &temp)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2771,7 +2771,7 @@ if (!arr.SetCapacity(length)) {
|
|||
}
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> temp(cx);
|
||||
if (!JS_GetElement(cx, seq, i, temp.address())) {
|
||||
if (!JS_GetElement(cx, seq, i, &temp)) {
|
||||
%s
|
||||
}
|
||||
%s& slot = *arr.AppendElement();
|
||||
|
@ -7771,7 +7771,7 @@ class CGDOMJSProxyHandler_getElementIfPresent(ClassMethod):
|
|||
JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy));
|
||||
if (expando) {
|
||||
JSBool isPresent;
|
||||
if (!JS_GetElementIfPresent(cx, expando, index, expando, vp.address(), &isPresent)) {
|
||||
if (!JS_GetElementIfPresent(cx, expando, index, expando, vp, &isPresent)) {
|
||||
return false;
|
||||
}
|
||||
if (isPresent) {
|
||||
|
@ -7791,7 +7791,7 @@ if (!js::GetObjectProto(cx, proxy, &proto)) {
|
|||
}
|
||||
if (proto) {
|
||||
JSBool isPresent;
|
||||
if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp.address(), &isPresent)) {
|
||||
if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp, &isPresent)) {
|
||||
return false;
|
||||
}
|
||||
*present = isPresent;
|
||||
|
|
|
@ -104,7 +104,7 @@ CameraControlImpl::Set(JSContext* aCx, uint32_t aKey, const JS::Value& aValue, u
|
|||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> v(aCx);
|
||||
|
||||
if (!JS_GetElement(aCx, regions, i, v.address())) {
|
||||
if (!JS_GetElement(aCx, regions, i, &v)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ CameraControlImpl::Get(JSContext* aCx, uint32_t aKey, JS::Value* aValue)
|
|||
}
|
||||
|
||||
v = OBJECT_TO_JSVAL(o);
|
||||
if (!JS_SetElement(aCx, array, i, v.address())) {
|
||||
if (!JS_SetElement(aCx, array, i, &v)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ ParseZoomRatioItemAndAdd(JSContext* aCx, JS::Handle<JSObject*> aArray,
|
|||
|
||||
JS::Rooted<JS::Value> v(aCx, JS_NumberValue(d));
|
||||
|
||||
if (!JS_SetElement(aCx, aArray, aIndex, v.address())) {
|
||||
if (!JS_SetElement(aCx, aArray, aIndex, &v)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ ParseStringItemAndAdd(JSContext* aCx, JS::Handle<JSObject*> aArray,
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> v(aCx, STRING_TO_JSVAL(s));
|
||||
if (!JS_SetElement(aCx, aArray, aIndex, v.address())) {
|
||||
if (!JS_SetElement(aCx, aArray, aIndex, &v)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ ParseDimensionItemAndAdd(JSContext* aCx, JS::Handle<JSObject*> aArray,
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> v(aCx, OBJECT_TO_JSVAL(o));
|
||||
if (!JS_SetElement(aCx, aArray, aIndex, v.address())) {
|
||||
if (!JS_SetElement(aCx, aArray, aIndex, &v)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::Value* aVideoSizes)
|
|||
}
|
||||
|
||||
v = OBJECT_TO_JSVAL(o);
|
||||
if (!JS_SetElement(cx, array, i, v.address())) {
|
||||
if (!JS_SetElement(cx, array, i, &v)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ ArchiveRequest::GetFilenamesResult(JSContext* aCx,
|
|||
|
||||
JS::Rooted<JS::Value> item(aCx, STRING_TO_JSVAL(str));
|
||||
|
||||
if (NS_FAILED(rv) || !JS_SetElement(aCx, array, i, item.address())) {
|
||||
if (NS_FAILED(rv) || !JS_SetElement(aCx, array, i, &item)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ ArchiveRequest::GetFilesResult(JSContext* aCx,
|
|||
nsresult rv = nsContentUtils::WrapNative(aCx, global, file,
|
||||
&NS_GET_IID(nsIDOMFile),
|
||||
value.address());
|
||||
if (NS_FAILED(rv) || !JS_SetElement(aCx, array, i, value.address())) {
|
||||
if (NS_FAILED(rv) || !JS_SetElement(aCx, array, i, &value)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ ConvertCloneReadInfosToArrayInternal(
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -1462,7 +1462,7 @@ GetAllKeysHelper::GetSuccessResult(JSContext* aCx,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -953,7 +953,7 @@ IDBObjectStore::AppendIndexUpdateInfo(
|
|||
|
||||
for (uint32_t arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {
|
||||
JS::Rooted<JS::Value> arrayItem(aCx);
|
||||
if (!JS_GetElement(aCx, array, arrayIndex, arrayItem.address())) {
|
||||
if (!JS_GetElement(aCx, array, arrayIndex, &arrayItem)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ 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())) {
|
||||
if (!JS_GetElement(aCx, obj, index, &val)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
|
@ -205,15 +205,15 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
|||
}
|
||||
|
||||
uint32_t index = 0;
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
while (aPos < aEnd && *aPos - aTypeOffset != eTerminator) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
nsresult rv = DecodeJSValInternal(aPos, aEnd, aCx, aTypeOffset,
|
||||
&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;
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ KeyPath::Parse(JSContext* aCx, const JS::Value& aValue, KeyPath* aKeyPath)
|
|||
JS::Rooted<JS::Value> val(aCx);
|
||||
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;
|
||||
|
@ -397,7 +397,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (!JS_SetElement(aCx, arrayObj, i, value.address())) {
|
||||
if (!JS_SetElement(aCx, arrayObj, i, &value)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ KeyPath::ToJSVal(JSContext* aCx, JS::MutableHandle<JS::Value> aValue) const
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ MmsMessage::Create(int32_t aId,
|
|||
nsTArray<DeliveryStatus> deliveryStatus;
|
||||
JS::Rooted<JS::Value> statusJsVal(aCx);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (!JS_GetElement(aCx, deliveryStatusObj, i, statusJsVal.address()) ||
|
||||
if (!JS_GetElement(aCx, deliveryStatusObj, i, &statusJsVal) ||
|
||||
!statusJsVal.isString()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ MmsMessage::Create(int32_t aId,
|
|||
nsTArray<nsString> receivers;
|
||||
JS::Rooted<JS::Value> receiverJsVal(aCx);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (!JS_GetElement(aCx, receiversObj, i, receiverJsVal.address()) ||
|
||||
if (!JS_GetElement(aCx, receiversObj, i, &receiverJsVal) ||
|
||||
!receiverJsVal.isString()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ MmsMessage::Create(int32_t aId,
|
|||
|
||||
JS::Rooted<JS::Value> attachmentJsVal(aCx);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (!JS_GetElement(aCx, attachmentsObj, i, attachmentJsVal.address())) {
|
||||
if (!JS_GetElement(aCx, attachmentsObj, i, &attachmentJsVal)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::Value* aAttachments)
|
|||
}
|
||||
|
||||
tmpJsVal = OBJECT_TO_JSVAL(attachmentObj);
|
||||
if (!JS_SetElement(aCx, attachments, i, tmpJsVal.address())) {
|
||||
if (!JS_SetElement(aCx, attachments, i, &tmpJsVal)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,11 +143,10 @@ MobileMessageCallback::NotifyMessageDeleted(bool *aDeleted, uint32_t aSize)
|
|||
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
|
||||
|
||||
JS::Rooted<JSObject*> deleteArrayObj(cx, JS_NewArrayObject(cx, aSize, NULL));
|
||||
JS::Rooted<JS::Value> jsValTrue(cx, JS::BooleanValue(true));
|
||||
JS::Rooted<JS::Value> jsValFalse(cx, JS::BooleanValue(false));
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
for (uint32_t i = 0; i < aSize; i++) {
|
||||
JS_SetElement(cx, deleteArrayObj, i,
|
||||
aDeleted[i] ? jsValTrue.address() : jsValFalse.address());
|
||||
value.setBoolean(aDeleted[i]);
|
||||
JS_SetElement(cx, deleteArrayObj, i, &value);
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> deleteArrayVal(cx, JS::ObjectValue(*deleteArrayObj));
|
||||
|
|
|
@ -175,7 +175,7 @@ MobileMessageManager::Send(const JS::Value& aNumber_, const nsAString& aMessage,
|
|||
|
||||
JS::Rooted<JS::Value> number(cx);
|
||||
for (uint32_t i=0; i<size; ++i) {
|
||||
if (!JS_GetElement(cx, numbers, i, number.address())) {
|
||||
if (!JS_GetElement(cx, numbers, i, &number)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ MobileMessageManager::Delete(const JS::Value& aParam, nsIDOMDOMRequest** aReques
|
|||
|
||||
JS::Rooted<JS::Value> idJsValue(cx);
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
if (!JS_GetElement(cx, ids, i, idJsValue.address())) {
|
||||
if (!JS_GetElement(cx, ids, i, &idJsValue)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ MobileMessageThread::Create(const uint64_t aId,
|
|||
for (uint32_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> val(aCx);
|
||||
|
||||
if (!JS_GetElement(aCx, obj, i, val.address()) || !val.isString()) {
|
||||
if (!JS_GetElement(aCx, obj, i, &val) || !val.isString()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ SmsFilter::SetNumbers(JSContext* aCx, const JS::Value& aNumbers)
|
|||
|
||||
for (uint32_t i=0; i<size; ++i) {
|
||||
JS::Rooted<JS::Value> jsNumber(aCx);
|
||||
if (!JS_GetElement(aCx, obj, i, jsNumber.address())) {
|
||||
if (!JS_GetElement(aCx, obj, i, &jsNumber)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ GetParamsFromSendMmsMessageRequest(JSContext* aCx,
|
|||
MmsAttachmentDataToJSObject(aCx, aRequest.attachments().ElementAt(i)));
|
||||
NS_ENSURE_TRUE(obj, false);
|
||||
JS::Rooted<JS::Value> val(aCx, JS::ObjectValue(*obj));
|
||||
if (!JS_SetElement(aCx, attachmentArray, i, val.address())) {
|
||||
if (!JS_SetElement(aCx, attachmentArray, i, &val)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2462,7 +2462,7 @@ ImplicitConvert(JSContext* cx,
|
|||
|
||||
for (uint32_t i = 0; i < sourceLength; ++i) {
|
||||
RootedValue item(cx);
|
||||
if (!JS_GetElement(cx, valObj, i, item.address()))
|
||||
if (!JS_GetElement(cx, valObj, i, &item))
|
||||
return false;
|
||||
|
||||
char* data = intermediate.get() + elementSize * i;
|
||||
|
@ -4793,7 +4793,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
|
|||
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
RootedValue item(cx);
|
||||
if (!JS_GetElement(cx, fieldsObj, i, item.address()))
|
||||
if (!JS_GetElement(cx, fieldsObj, i, &item))
|
||||
return JS_FALSE;
|
||||
|
||||
RootedObject fieldType(cx, NULL);
|
||||
|
@ -5567,7 +5567,7 @@ FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp)
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
Array<jsval, 16> argTypes;
|
||||
AutoValueVector argTypes(cx);
|
||||
RootedObject arrayObj(cx, NULL);
|
||||
|
||||
if (args.length() == 3) {
|
||||
|
@ -5582,17 +5582,16 @@ FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp)
|
|||
uint32_t len;
|
||||
ASSERT_OK(JS_GetArrayLength(cx, arrayObj, &len));
|
||||
|
||||
if (!argTypes.appendN(JSVAL_VOID, len)) {
|
||||
if (!argTypes.resize(len)) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Pull out the argument types from the array, if any.
|
||||
JS_ASSERT(!argTypes.length() || arrayObj);
|
||||
js::AutoArrayRooter items(cx, argTypes.length(), argTypes.begin());
|
||||
JS_ASSERT_IF(argTypes.length(), arrayObj);
|
||||
for (uint32_t i = 0; i < argTypes.length(); ++i) {
|
||||
if (!JS_GetElement(cx, arrayObj, i, &argTypes[i]))
|
||||
if (!JS_GetElement(cx, arrayObj, i, argTypes.handleAt(i)))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
CHECK(buf_len1 = JS_NewArrayBuffer(cx, sizes[0]));
|
||||
CHECK(tarray_len1 = JS_NewInt32ArrayWithBuffer(cx, testBuf[0], 0, -1));
|
||||
|
||||
jsval dummy = INT_TO_JSVAL(MAGIC_VALUE_1);
|
||||
JS::RootedValue dummy(cx, INT_TO_JSVAL(MAGIC_VALUE_1));
|
||||
JS_SetElement(cx, testArray[0], 0, &dummy);
|
||||
|
||||
// Many-element ArrayBuffer (uses dynamic storage)
|
||||
|
@ -48,7 +48,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
uint8_t *data = JS_GetArrayBufferData(obj);
|
||||
CHECK(data != NULL);
|
||||
*reinterpret_cast<uint32_t*>(data) = MAGIC_VALUE_2;
|
||||
CHECK(JS_GetElement(cx, view, 0, v.address()));
|
||||
CHECK(JS_GetElement(cx, view, 0, &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(MAGIC_VALUE_2));
|
||||
|
||||
// Steal the contents
|
||||
|
@ -69,7 +69,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
CHECK_SAME(v, INT_TO_JSVAL(0));
|
||||
CHECK_EQUAL(JS_GetArrayBufferByteLength(obj), 0);
|
||||
v = JSVAL_VOID;
|
||||
JS_GetElement(cx, obj, 0, v.address());
|
||||
JS_GetElement(cx, obj, 0, &v);
|
||||
CHECK_SAME(v, JSVAL_VOID);
|
||||
|
||||
// Transfer to a new ArrayBuffer
|
||||
|
@ -84,7 +84,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
|
|||
data = JS_GetArrayBufferData(dst);
|
||||
CHECK(data != NULL);
|
||||
CHECK_EQUAL(*reinterpret_cast<uint32_t*>(data), MAGIC_VALUE_2);
|
||||
CHECK(JS_GetElement(cx, dstview, 0, v.address()));
|
||||
CHECK(JS_GetElement(cx, dstview, 0, &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(MAGIC_VALUE_2));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ constructHook(JSContext *cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
// Perform a side-effect to indicate that this hook was actually called.
|
||||
if (!JS_SetElement(cx, callee, 0, &argv[0]))
|
||||
JS::RootedValue value(cx, argv[0]);
|
||||
if (!JS_SetElement(cx, callee, 0, &value))
|
||||
return false;
|
||||
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
|
@ -87,7 +88,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
CHECK(JS_IsArrayObject(cx, obj));
|
||||
CHECK(JS_GetArrayLength(cx, obj, &len));
|
||||
CHECK_EQUAL(len, N);
|
||||
CHECK(JS_GetElement(cx, obj, N - 1, v.address()));
|
||||
CHECK(JS_GetElement(cx, obj, N - 1, &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(N - 1));
|
||||
|
||||
// With JSClass.construct.
|
||||
|
@ -103,7 +104,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
JS::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor));
|
||||
obj = JS_New(cx, ctor, 3, argv);
|
||||
CHECK(obj);
|
||||
CHECK(JS_GetElement(cx, ctor, 0, v.address()));
|
||||
CHECK(JS_GetElement(cx, ctor, 0, &v));
|
||||
CHECK_SAME(v, JSVAL_ZERO);
|
||||
|
||||
JS_RemoveValueRoot(cx, &argv[0]);
|
||||
|
|
|
@ -80,7 +80,7 @@ TestPlainTypedArray(JSContext *cx)
|
|||
CHECK(data = GetData(array));
|
||||
*data = 13;
|
||||
RootedValue v(cx);
|
||||
CHECK(JS_GetElement(cx, array, 0, v.address()));
|
||||
CHECK(JS_GetElement(cx, array, 0, &v));
|
||||
CHECK_SAME(v, INT_TO_JSVAL(13));
|
||||
|
||||
return true;
|
||||
|
@ -131,39 +131,39 @@ TestArrayFromBuffer(JSContext *cx)
|
|||
|
||||
// Make sure all 3 views reflect the same buffer at the expected locations
|
||||
JS::RootedValue v(cx, INT_TO_JSVAL(39));
|
||||
JS_SetElement(cx, array, 0, v.address());
|
||||
JS_SetElement(cx, array, 0, &v);
|
||||
JS::RootedValue v2(cx);
|
||||
CHECK(JS_GetElement(cx, array, 0, v2.address()));
|
||||
CHECK(JS_GetElement(cx, array, 0, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
CHECK(JS_GetElement(cx, shortArray, 0, v2.address()));
|
||||
CHECK(JS_GetElement(cx, shortArray, 0, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast<Element*>(data)[0]));
|
||||
|
||||
v = INT_TO_JSVAL(40);
|
||||
JS_SetElement(cx, array, elts / 2, v.address());
|
||||
CHECK(JS_GetElement(cx, array, elts / 2, v2.address()));
|
||||
JS_SetElement(cx, array, elts / 2, &v);
|
||||
CHECK(JS_GetElement(cx, array, elts / 2, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
CHECK(JS_GetElement(cx, ofsArray, 0, v2.address()));
|
||||
CHECK(JS_GetElement(cx, ofsArray, 0, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast<Element*>(data)[elts / 2]));
|
||||
|
||||
v = INT_TO_JSVAL(41);
|
||||
JS_SetElement(cx, array, elts - 1, v.address());
|
||||
CHECK(JS_GetElement(cx, array, elts - 1, v2.address()));
|
||||
JS_SetElement(cx, array, elts - 1, &v);
|
||||
CHECK(JS_GetElement(cx, array, elts - 1, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
CHECK(JS_GetElement(cx, ofsArray, elts / 2 - 1, v2.address()));
|
||||
CHECK(JS_GetElement(cx, ofsArray, elts / 2 - 1, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast<Element*>(data)[elts - 1]));
|
||||
|
||||
JS::RootedObject copy(cx, CreateFromArray(cx, array));
|
||||
CHECK(JS_GetElement(cx, array, 0, v.address()));
|
||||
CHECK(JS_GetElement(cx, copy, 0, v2.address()));
|
||||
CHECK(JS_GetElement(cx, array, 0, &v));
|
||||
CHECK(JS_GetElement(cx, copy, 0, &v2));
|
||||
CHECK_SAME(v, v2);
|
||||
|
||||
/* The copy should not see changes in the original */
|
||||
v2 = INT_TO_JSVAL(42);
|
||||
JS_SetElement(cx, array, 0, v2.address());
|
||||
CHECK(JS_GetElement(cx, copy, 0, v2.address()));
|
||||
JS_SetElement(cx, array, 0, &v2);
|
||||
CHECK(JS_GetElement(cx, copy, 0, &v2));
|
||||
CHECK_SAME(v2, v); /* v is still the original value from 'array' */
|
||||
|
||||
return true;
|
||||
|
|
|
@ -3157,18 +3157,14 @@ JS_LookupPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandle
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_LookupElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
|
||||
JS_LookupElement(JSContext *cx, JSObject *objArg, uint32_t index, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
RootedValue value(cx);
|
||||
if (!JS_LookupPropertyById(cx, obj, id, &value))
|
||||
return false;
|
||||
*vp = value;
|
||||
return true;
|
||||
return JS_LookupPropertyById(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -3813,13 +3809,14 @@ JS_GetPropertyByIdDefault(JSContext *cx, JSObject *objArg, jsid idArg, jsval def
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
|
||||
JS_GetElement(JSContext *cx, JSObject *objArg, uint32_t index, MutableHandleValue vp)
|
||||
{
|
||||
return JS_ForwardGetElementTo(cx, objArg, index, objArg, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ForwardGetElementTo(JSContext *cx, JSObject *objArg, uint32_t index, JSObject *onBehalfOfArg, jsval *vp)
|
||||
JS_ForwardGetElementTo(JSContext *cx, JSObject *objArg, uint32_t index, JSObject *onBehalfOfArg,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedObject onBehalfOf(cx, onBehalfOfArg);
|
||||
|
@ -3828,16 +3825,12 @@ JS_ForwardGetElementTo(JSContext *cx, JSObject *objArg, uint32_t index, JSObject
|
|||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
if (!JSObject::getElement(cx, obj, onBehalfOf, index, &value))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
return true;
|
||||
return JSObject::getElement(cx, obj, onBehalfOf, index, vp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_GetElementIfPresent(JSContext *cx, JSObject *objArg, uint32_t index, JSObject *onBehalfOfArg, jsval *vp, JSBool* present)
|
||||
JS_GetElementIfPresent(JSContext *cx, JSObject *objArg, uint32_t index, JSObject *onBehalfOfArg,
|
||||
MutableHandleValue vp, JSBool* present)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedObject onBehalfOf(cx, onBehalfOfArg);
|
||||
|
@ -3846,12 +3839,10 @@ JS_GetElementIfPresent(JSContext *cx, JSObject *objArg, uint32_t index, JSObject
|
|||
assertSameCompartment(cx, obj);
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
RootedValue value(cx);
|
||||
bool isPresent;
|
||||
if (!JSObject::getElementIfPresent(cx, obj, onBehalfOf, index, &value, &isPresent))
|
||||
if (!JSObject::getElementIfPresent(cx, obj, onBehalfOf, index, vp, &isPresent))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
*present = isPresent;
|
||||
return true;
|
||||
}
|
||||
|
@ -3898,20 +3889,15 @@ JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, HandleValue v)
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_SetElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp)
|
||||
JS_SetElement(JSContext *cx, JSObject *objArg, uint32_t index, MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, objArg);
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, *vp);
|
||||
assertSameCompartment(cx, obj, vp);
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING);
|
||||
|
||||
RootedValue value(cx, *vp);
|
||||
if (!JSObject::setElement(cx, obj, obj, index, &value, false))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
return true;
|
||||
return JSObject::setElement(cx, obj, obj, index, vp, false);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
|
|
@ -3667,14 +3667,14 @@ extern JS_PUBLIC_API(JSBool)
|
|||
JS_HasElement(JSContext *cx, JSObject *obj, uint32_t index, JSBool *foundp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LookupElement(JSContext *cx, JSObject *obj, uint32_t index, jsval *vp);
|
||||
JS_LookupElement(JSContext *cx, JSObject *obj, uint32_t index, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, uint32_t index, jsval *vp);
|
||||
JS_GetElement(JSContext *cx, JSObject *obj, uint32_t index, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_ForwardGetElementTo(JSContext *cx, JSObject *obj, uint32_t index, JSObject *onBehalfOf,
|
||||
jsval *vp);
|
||||
JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
/*
|
||||
* Get the property with name given by |index|, if it has one. If
|
||||
|
@ -3683,10 +3683,10 @@ JS_ForwardGetElementTo(JSContext *cx, JSObject *obj, uint32_t index, JSObject *o
|
|||
*/
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_GetElementIfPresent(JSContext *cx, JSObject *obj, uint32_t index, JSObject *onBehalfOf,
|
||||
jsval *vp, JSBool* present);
|
||||
JS::MutableHandle<JS::Value> vp, JSBool* present);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, uint32_t index, jsval *vp);
|
||||
JS_SetElement(JSContext *cx, JSObject *obj, uint32_t index, JS::MutableHandle<JS::Value> vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DeleteElement(JSContext *cx, JSObject *obj, uint32_t index);
|
||||
|
|
|
@ -478,7 +478,7 @@ JSStructuredCloneWriter::parseTransferable()
|
|||
RootedValue v(context());
|
||||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (!JS_GetElement(context(), array, i, v.address())) {
|
||||
if (!JS_GetElement(context(), array, i, &v)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2366,7 +2366,6 @@ GetPDA(JSContext *cx, unsigned argc, jsval *vp)
|
|||
bool ok;
|
||||
JSPropertyDescArray pda;
|
||||
JSPropertyDesc *pd;
|
||||
jsval v;
|
||||
|
||||
if (!JS_ValueToObject(cx, argc == 0 ? UndefinedValue() : vp[2], vobj.address()))
|
||||
return false;
|
||||
|
@ -2399,7 +2398,8 @@ GetPDA(JSContext *cx, unsigned argc, jsval *vp)
|
|||
}
|
||||
|
||||
/* Protect pdobj from GC by setting it as an element of aobj now */
|
||||
v = OBJECT_TO_JSVAL(pdobj);
|
||||
RootedValue v(cx);
|
||||
v.setObject(*pdobj);
|
||||
ok = !!JS_SetElement(cx, aobj, i, &v);
|
||||
if (!ok)
|
||||
break;
|
||||
|
|
|
@ -524,7 +524,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path)
|
|||
/* Append our referrer to this array. */
|
||||
uint32_t length;
|
||||
return JS_GetArrayLength(context, array, &length) &&
|
||||
JS_SetElement(context, array, length, referrer.address());
|
||||
JS_SetElement(context, array, length, &referrer);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
|
|
|
@ -1309,7 +1309,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation,
|
|||
RootedValue value(mContext);
|
||||
RootedId symbolId(mContext);
|
||||
for (uint32_t i = 0; i < symbolCount; ++i) {
|
||||
if (!JS_GetElement(mContext, symbolsObj, i, value.address()) ||
|
||||
if (!JS_GetElement(mContext, symbolsObj, i, &value) ||
|
||||
!value.isString() ||
|
||||
!JS_ValueToId(mContext, value, symbolId.address())) {
|
||||
return ReportOnCaller(cxhelper, ERROR_ARRAY_ELEMENT,
|
||||
|
|
|
@ -32,7 +32,7 @@ nsTArrayToJSArray(JSContext* aCx, const nsTArray<T>& aSourceArray,
|
|||
nullptr, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!JS_SetElement(aCx, arrayObj, index, wrappedVal.address())) {
|
||||
if (!JS_SetElement(aCx, arrayObj, index, &wrappedVal)) {
|
||||
NS_WARNING("JS_SetElement failed!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ nsTArrayToJSArray<nsString>(JSContext* aCx,
|
|||
|
||||
JS::Rooted<JS::Value> wrappedVal(aCx, STRING_TO_JSVAL(s));
|
||||
|
||||
if (!JS_SetElement(aCx, arrayObj, index, wrappedVal.address())) {
|
||||
if (!JS_SetElement(aCx, arrayObj, index, &wrappedVal)) {
|
||||
NS_WARNING("JS_SetElement failed!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -3482,7 +3482,7 @@ GetExpandedPrincipal(JSContext *cx, HandleObject arrayObj, nsIExpandedPrincipal
|
|||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
RootedValue allowed(cx);
|
||||
if (!JS_GetElement(cx, arrayObj, i, allowed.address()))
|
||||
if (!JS_GetElement(cx, arrayObj, i, &allowed))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
@ -1372,7 +1372,7 @@ XPCConvert::NativeArray2JS(jsval* d, const void** s,
|
|||
PR_BEGIN_MACRO \
|
||||
for (i = 0; i < count; i++) { \
|
||||
if (!NativeData2JS(current.address(), ((_t*)*s)+i, type, iid, pErr) || \
|
||||
!JS_SetElement(cx, array, i, current.address())) \
|
||||
!JS_SetElement(cx, array, i, ¤t)) \
|
||||
goto failure; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
@ -1638,7 +1638,7 @@ XPCConvert::JSArray2Native(void** d, HandleValue s,
|
|||
goto failure; \
|
||||
} \
|
||||
for (initedCount = 0; initedCount < count; initedCount++) { \
|
||||
if (!JS_GetElement(cx, jsarray, initedCount, current.address()) || \
|
||||
if (!JS_GetElement(cx, jsarray, initedCount, ¤t) || \
|
||||
!JSData2Native(((_t*)array)+initedCount, current, type, \
|
||||
true, iid, pErr)) \
|
||||
goto failure; \
|
||||
|
|
|
@ -188,7 +188,7 @@ XPCArrayHomogenizer::GetTypeForArray(JSContext* cx, HandleObject array,
|
|||
RootedValue val(cx);
|
||||
RootedObject jsobj(cx);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (!JS_GetElement(cx, array, i, val.address()))
|
||||
if (!JS_GetElement(cx, array, i, &val))
|
||||
return false;
|
||||
|
||||
if (val.isInt32()) {
|
||||
|
|
|
@ -950,7 +950,7 @@ PeerConnectionImpl::ConvertConstraints(
|
|||
}
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
JS::Rooted<JS::Value> element(aCx);
|
||||
if (!JS_GetElement(aCx, array, i, element.address()) ||
|
||||
if (!JS_GetElement(aCx, array, i, &element) ||
|
||||
!element.isObject()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -440,8 +440,8 @@ CompareCountArrays(JSContext *cx, JSObject *aBefore, JSObject *aAfter)
|
|||
|
||||
JS::RootedValue before_num(cx), after_num(cx);
|
||||
for (uint32_t i = 0; i < before_size; ++i) {
|
||||
if (!(JS_GetElement(cx, before, i, before_num.address())
|
||||
&& JS_GetElement(cx, after, i, after_num.address()))) {
|
||||
if (!(JS_GetElement(cx, before, i, &before_num)
|
||||
&& JS_GetElement(cx, after, i, &after_num))) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,9 +94,10 @@ StatementRow::GetProperty(nsIXPConnectWrappedNative *aWrapper,
|
|||
*_vp = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
// Copy the blob over to the JS array.
|
||||
JS::Rooted<JS::Value> val(aCtx);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
JS::Rooted<JS::Value> val(aCtx, INT_TO_JSVAL(blob[i]));
|
||||
if (!::JS_SetElement(aCtx, scope, i, val.address())) {
|
||||
val.setInt32(blob[i]);
|
||||
if (!::JS_SetElement(aCtx, scope, i, &val)) {
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -426,7 +426,7 @@ GetJSObjectFromArray(JSContext* aCtx,
|
|||
"Must provide an object that is an array!");
|
||||
|
||||
JS::Rooted<JS::Value> value(aCtx);
|
||||
JSBool rc = JS_GetElement(aCtx, aArray, aIndex, value.address());
|
||||
JSBool rc = JS_GetElement(aCtx, aArray, aIndex, &value);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_ARG(!JSVAL_IS_PRIMITIVE(value));
|
||||
*_rooter = JSVAL_TO_OBJECT(value);
|
||||
|
@ -2706,7 +2706,7 @@ History::GetPlacesInfo(const JS::Value& aPlaceIdentifiers,
|
|||
nsTArray<VisitData> placesInfo;
|
||||
placesInfo.SetCapacity(placesIndentifiersLength);
|
||||
for (uint32_t i = 0; i < placesIndentifiersLength; i++) {
|
||||
JS::Value placeIdentifier;
|
||||
JS::Rooted<JS::Value> placeIdentifier(aCtx);
|
||||
JSBool rc = JS_GetElement(aCtx, placesIndentifiers, i, &placeIdentifier);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ PlaceInfo::GetVisits(JSContext* aContext,
|
|||
NS_ENSURE_STATE(jsobj);
|
||||
JS::Rooted<JS::Value> wrappedVisit(aContext, OBJECT_TO_JSVAL(jsobj));
|
||||
|
||||
JSBool rc = JS_SetElement(aContext, visits, idx, wrappedVisit.address());
|
||||
JSBool rc = JS_SetElement(aContext, visits, idx, &wrappedVisit);
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
|
|
|
@ -1015,8 +1015,8 @@ TelemetryImpl::ReflectSQL(const SlowSQLEntryType *entry,
|
|||
if (!arrayObj) {
|
||||
return false;
|
||||
}
|
||||
return (JS_SetElement(cx, arrayObj, 0, hitCount.address())
|
||||
&& JS_SetElement(cx, arrayObj, 1, totalTime.address())
|
||||
return (JS_SetElement(cx, arrayObj, 0, &hitCount)
|
||||
&& JS_SetElement(cx, arrayObj, 1, &totalTime)
|
||||
&& JS_DefineProperty(cx, obj,
|
||||
sql.BeginReading(),
|
||||
OBJECT_TO_JSVAL(arrayObj),
|
||||
|
@ -1517,7 +1517,7 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::Value *ret)
|
|||
const size_t length = stacks.GetStackCount();
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
JS::Rooted<JS::Value> duration(cx, INT_TO_JSVAL(mHangReports.GetDuration(i)));
|
||||
if (!JS_SetElement(cx, durationArray, i, duration.address())) {
|
||||
if (!JS_SetElement(cx, durationArray, i, &duration)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -1554,7 +1554,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
|||
return nullptr;
|
||||
}
|
||||
JS::Rooted<JS::Value> val(cx, OBJECT_TO_JSVAL(moduleInfoArray));
|
||||
if (!JS_SetElement(cx, moduleArray, moduleIndex, val.address())) {
|
||||
if (!JS_SetElement(cx, moduleArray, moduleIndex, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1566,7 +1566,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
|||
return nullptr;
|
||||
}
|
||||
val = STRING_TO_JSVAL(str);
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, val.address())) {
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1576,7 +1576,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
|||
return nullptr;
|
||||
}
|
||||
val = STRING_TO_JSVAL(id);
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, val.address())) {
|
||||
if (!JS_SetElement(cx, moduleInfoArray, index++, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1601,7 +1601,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
|||
}
|
||||
|
||||
JS::Rooted<JS::Value> pcArrayVal(cx, OBJECT_TO_JSVAL(pcArray));
|
||||
if (!JS_SetElement(cx, reportArray, i, pcArrayVal.address())) {
|
||||
if (!JS_SetElement(cx, reportArray, i, &pcArrayVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1616,15 +1616,15 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
|||
int modIndex = (std::numeric_limits<uint16_t>::max() == frame.mModIndex) ?
|
||||
-1 : frame.mModIndex;
|
||||
JS::Rooted<JS::Value> modIndexVal(cx, INT_TO_JSVAL(modIndex));
|
||||
if (!JS_SetElement(cx, framePair, 0, modIndexVal.address())) {
|
||||
if (!JS_SetElement(cx, framePair, 0, &modIndexVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
JS::Rooted<JS::Value> mOffsetVal(cx, INT_TO_JSVAL(frame.mOffset));
|
||||
if (!JS_SetElement(cx, framePair, 1, mOffsetVal.address())) {
|
||||
if (!JS_SetElement(cx, framePair, 1, &mOffsetVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
JS::Rooted<JS::Value> framePairVal(cx, OBJECT_TO_JSVAL(framePair));
|
||||
if (!JS_SetElement(cx, pcArray, pcIndex, framePairVal.address())) {
|
||||
if (!JS_SetElement(cx, pcArray, pcIndex, &framePairVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ JSObjectBuilder::ArrayPush(JSCustomArray *aArray, int value)
|
|||
return;
|
||||
|
||||
JS::Rooted<JS::Value> objval(mCx, INT_TO_JSVAL(value));
|
||||
mOk = JS_SetElement(mCx, (JSObject*)aArray, length, objval.address());
|
||||
mOk = JS_SetElement(mCx, (JSObject*)aArray, length, &objval);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -115,7 +115,7 @@ JSObjectBuilder::ArrayPush(JSCustomArray *aArray, const char *value)
|
|||
return;
|
||||
|
||||
JS::Rooted<JS::Value> objval(mCx, STRING_TO_JSVAL(string));
|
||||
mOk = JS_SetElement(mCx, (JSObject*)aArray, length, objval.address());
|
||||
mOk = JS_SetElement(mCx, (JSObject*)aArray, length, &objval);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -131,7 +131,7 @@ JSObjectBuilder::ArrayPush(JSCustomArray *aArray, JSCustomObject *aObject)
|
|||
return;
|
||||
|
||||
JS::Rooted<JS::Value> objval(mCx, OBJECT_TO_JSVAL((JSObject*)aObject));
|
||||
mOk = JS_SetElement(mCx, (JSObject*)aArray, length, objval.address());
|
||||
mOk = JS_SetElement(mCx, (JSObject*)aArray, length, &objval);
|
||||
}
|
||||
|
||||
JSCustomArray*
|
||||
|
|
Загрузка…
Ссылка в новой задаче