зеркало из https://github.com/mozilla/gecko-dev.git
Bug 963921 - Clients of the JS API should use JS_DefineElement where appropriate r=smaug
This commit is contained in:
Родитель
8c8822c93b
Коммит
a451fdfd83
|
@ -514,7 +514,7 @@ nsFrameMessageManager::GetDelayedScripts(JSContext* aCx, JS::MutableHandle<JS::V
|
||||||
pair = JS_NewArrayObject(aCx, pairElts);
|
pair = JS_NewArrayObject(aCx, pairElts);
|
||||||
NS_ENSURE_TRUE(pair, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(pair, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
NS_ENSURE_TRUE(JS_SetElement(aCx, array, i, pair),
|
NS_ENSURE_TRUE(JS_DefineElement(aCx, array, i, pair, JSPROP_ENUMERATE),
|
||||||
NS_ERROR_OUT_OF_MEMORY);
|
NS_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ nsFrameMessageManager::SendMessage(const nsAString& aMessageName,
|
||||||
retval[i].Length(), &ret)) {
|
retval[i].Length(), &ret)) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, ret),
|
NS_ENSURE_TRUE(JS_DefineElement(aCx, dataArray, i, ret, JSPROP_ENUMERATE),
|
||||||
NS_ERROR_OUT_OF_MEMORY);
|
NS_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,7 +452,8 @@ private:
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_WARN_IF(!JS_SetElement(aCx, array, index, value))) {
|
if (NS_WARN_IF(!JS_DefineElement(aCx, array, index, value,
|
||||||
|
JSPROP_ENUMERATE))) {
|
||||||
IDB_REPORT_INTERNAL_ERR();
|
IDB_REPORT_INTERNAL_ERR();
|
||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
}
|
}
|
||||||
|
@ -505,7 +506,8 @@ private:
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_WARN_IF(!JS_SetElement(aCx, array, index, value))) {
|
if (NS_WARN_IF(!JS_DefineElement(aCx, array, index, value,
|
||||||
|
JSPROP_ENUMERATE))) {
|
||||||
IDB_REPORT_INTERNAL_ERR();
|
IDB_REPORT_INTERNAL_ERR();
|
||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1096,7 @@ BackgroundFactoryRequestChild::Recv__delete__(
|
||||||
|
|
||||||
IDBOpenDBRequest* request = GetOpenDBRequest();
|
IDBOpenDBRequest* request = GetOpenDBRequest();
|
||||||
MOZ_ASSERT(request);
|
MOZ_ASSERT(request);
|
||||||
|
|
||||||
request->NoteComplete();
|
request->NoteComplete();
|
||||||
|
|
||||||
if (NS_WARN_IF(!result)) {
|
if (NS_WARN_IF(!result)) {
|
||||||
|
|
|
@ -218,7 +218,7 @@ Key::DecodeJSValInternal(const unsigned char*& aPos, const unsigned char* aEnd,
|
||||||
|
|
||||||
aTypeOffset = 0;
|
aTypeOffset = 0;
|
||||||
|
|
||||||
if (!JS_SetElement(aCx, array, index++, val)) {
|
if (!JS_DefineElement(aCx, array, index++, val, JSPROP_ENUMERATE)) {
|
||||||
NS_WARNING("Failed to set array element!");
|
NS_WARNING("Failed to set array element!");
|
||||||
IDB_REPORT_INTERNAL_ERR();
|
IDB_REPORT_INTERNAL_ERR();
|
||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
|
|
|
@ -359,7 +359,7 @@ KeyPath::ExtractKeyAsJSVal(JSContext* aCx, const JS::Value& aValue,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_SetElement(aCx, arrayObj, i, value)) {
|
if (!JS_DefineElement(aCx, arrayObj, i, value, JSPROP_ENUMERATE)) {
|
||||||
IDB_REPORT_INTERNAL_ERR();
|
IDB_REPORT_INTERNAL_ERR();
|
||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ KeyPath::ToJSVal(JSContext* aCx, JS::MutableHandle<JS::Value> aValue) const
|
||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_SetElement(aCx, array, i, val)) {
|
if (!JS_DefineElement(aCx, array, i, val, JSPROP_ENUMERATE)) {
|
||||||
IDB_REPORT_INTERNAL_ERR();
|
IDB_REPORT_INTERNAL_ERR();
|
||||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,7 +587,7 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle<JS::Value> aAttachm
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_SetElement(aCx, attachments, i, attachmentObj)) {
|
if (!JS_DefineElement(aCx, attachments, i, attachmentObj, JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ MobileMessageCallback::NotifyMessageDeleted(bool *aDeleted, uint32_t aSize)
|
||||||
|
|
||||||
JS::Rooted<JSObject*> deleteArrayObj(cx, JS_NewArrayObject(cx, aSize));
|
JS::Rooted<JSObject*> deleteArrayObj(cx, JS_NewArrayObject(cx, aSize));
|
||||||
for (uint32_t i = 0; i < aSize; i++) {
|
for (uint32_t i = 0; i < aSize; i++) {
|
||||||
JS_SetElement(cx, deleteArrayObj, i, aDeleted[i]);
|
JS_DefineElement(cx, deleteArrayObj, i, aDeleted[i], JSPROP_ENUMERATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::Rooted<JS::Value> deleteArrayVal(cx, JS::ObjectValue(*deleteArrayObj));
|
JS::Rooted<JS::Value> deleteArrayVal(cx, JS::ObjectValue(*deleteArrayObj));
|
||||||
|
|
|
@ -120,7 +120,7 @@ GetParamsFromSendMmsMessageRequest(JSContext* aCx,
|
||||||
JS::Rooted<JSObject*> obj(aCx,
|
JS::Rooted<JSObject*> obj(aCx,
|
||||||
MmsAttachmentDataToJSObject(aCx, aRequest.attachments().ElementAt(i)));
|
MmsAttachmentDataToJSObject(aCx, aRequest.attachments().ElementAt(i)));
|
||||||
NS_ENSURE_TRUE(obj, false);
|
NS_ENSURE_TRUE(obj, false);
|
||||||
if (!JS_SetElement(aCx, attachmentArray, i, obj)) {
|
if (!JS_DefineElement(aCx, attachmentArray, i, obj, JSPROP_ENUMERATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ nsTArrayToJSArray(JSContext* aCx, const nsTArray<T>& aSourceArray,
|
||||||
rv = nsContentUtils::WrapNative(aCx, obj, &wrappedVal);
|
rv = nsContentUtils::WrapNative(aCx, obj, &wrappedVal);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (!JS_SetElement(aCx, arrayObj, index, wrappedVal)) {
|
if (!JS_DefineElement(aCx, arrayObj, index, wrappedVal, JSPROP_ENUMERATE)) {
|
||||||
NS_WARNING("JS_SetElement failed!");
|
NS_WARNING("JS_DefineElement failed!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ nsTArrayToJSArray<nsString>(JSContext* aCx,
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_SetElement(aCx, arrayObj, index, s)) {
|
if (!JS_DefineElement(aCx, arrayObj, index, s, JSPROP_ENUMERATE)) {
|
||||||
NS_WARNING("JS_SetElement failed!");
|
NS_WARNING("JS_DefineElement failed!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ XPCConvert::NativeArray2JS(MutableHandleValue d, const void** s,
|
||||||
PR_BEGIN_MACRO \
|
PR_BEGIN_MACRO \
|
||||||
for (i = 0; i < count; i++) { \
|
for (i = 0; i < count; i++) { \
|
||||||
if (!NativeData2JS(¤t, ((_t*)*s)+i, type, iid, pErr) || \
|
if (!NativeData2JS(¤t, ((_t*)*s)+i, type, iid, pErr) || \
|
||||||
!JS_SetElement(cx, array, i, current)) \
|
!JS_DefineElement(cx, array, i, current, JSPROP_ENUMERATE)) \
|
||||||
goto failure; \
|
goto failure; \
|
||||||
} \
|
} \
|
||||||
PR_END_MACRO
|
PR_END_MACRO
|
||||||
|
|
|
@ -95,7 +95,7 @@ StatementRow::GetProperty(nsIXPConnectWrappedNative *aWrapper,
|
||||||
|
|
||||||
// Copy the blob over to the JS array.
|
// Copy the blob over to the JS array.
|
||||||
for (uint32_t i = 0; i < length; i++) {
|
for (uint32_t i = 0; i < length; i++) {
|
||||||
if (!::JS_SetElement(aCtx, scope, i, blob[i])) {
|
if (!::JS_DefineElement(aCtx, scope, i, blob[i], JSPROP_ENUMERATE)) {
|
||||||
*_retval = false;
|
*_retval = false;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ PlaceInfo::GetVisits(JSContext* aContext,
|
||||||
JS::Rooted<JSObject*> jsobj(aContext, wrapper->GetJSObject());
|
JS::Rooted<JSObject*> jsobj(aContext, wrapper->GetJSObject());
|
||||||
NS_ENSURE_STATE(jsobj);
|
NS_ENSURE_STATE(jsobj);
|
||||||
|
|
||||||
bool rc = JS_SetElement(aContext, visits, idx, jsobj);
|
bool rc = JS_DefineElement(aContext, visits, idx, jsobj, JSPROP_ENUMERATE);
|
||||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1923,8 +1923,8 @@ TelemetryImpl::ReflectSQL(const SlowSQLEntryType *entry,
|
||||||
if (!arrayObj) {
|
if (!arrayObj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (JS_SetElement(cx, arrayObj, 0, stat->hitCount)
|
return (JS_DefineElement(cx, arrayObj, 0, stat->hitCount, JSPROP_ENUMERATE)
|
||||||
&& JS_SetElement(cx, arrayObj, 1, stat->totalTime)
|
&& JS_DefineElement(cx, arrayObj, 1, stat->totalTime, JSPROP_ENUMERATE)
|
||||||
&& JS_DefineProperty(cx, obj, sql.BeginReading(), arrayObj,
|
&& JS_DefineProperty(cx, obj, sql.BeginReading(), arrayObj,
|
||||||
JSPROP_ENUMERATE));
|
JSPROP_ENUMERATE));
|
||||||
}
|
}
|
||||||
|
@ -2523,13 +2523,16 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
||||||
|
|
||||||
const size_t length = stacks.GetStackCount();
|
const size_t length = stacks.GetStackCount();
|
||||||
for (size_t i = 0; i < length; ++i) {
|
for (size_t i = 0; i < length; ++i) {
|
||||||
if (!JS_SetElement(cx, durationArray, i, mHangReports.GetDuration(i))) {
|
if (!JS_DefineElement(cx, durationArray, i, mHangReports.GetDuration(i),
|
||||||
|
JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, systemUptimeArray, i, mHangReports.GetSystemUptime(i))) {
|
if (!JS_DefineElement(cx, systemUptimeArray, i, mHangReports.GetSystemUptime(i),
|
||||||
|
JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, firefoxUptimeArray, i, mHangReports.GetFirefoxUptime(i))) {
|
if (!JS_DefineElement(cx, firefoxUptimeArray, i, mHangReports.GetFirefoxUptime(i),
|
||||||
|
JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
const nsTArray<HangReports::AnnotationInfo>& annotationInfo =
|
const nsTArray<HangReports::AnnotationInfo>& annotationInfo =
|
||||||
|
@ -2542,7 +2545,7 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
||||||
}
|
}
|
||||||
JS::RootedValue indexValue(cx);
|
JS::RootedValue indexValue(cx);
|
||||||
indexValue.setNumber(annotationInfo[iterIndex].mHangIndex);
|
indexValue.setNumber(annotationInfo[iterIndex].mHangIndex);
|
||||||
if (!JS_SetElement(cx, keyValueArray, 0, indexValue)) {
|
if (!JS_DefineElement(cx, keyValueArray, 0, indexValue, JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
JS::Rooted<JSObject*> jsAnnotation(cx, JS_NewPlainObject(cx));
|
JS::Rooted<JSObject*> jsAnnotation(cx, JS_NewPlainObject(cx));
|
||||||
|
@ -2564,11 +2567,11 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, keyValueArray, 1, jsAnnotation)) {
|
if (!JS_DefineElement(cx, keyValueArray, 1, jsAnnotation, JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, annotationsArray, iterIndex,
|
if (!JS_DefineElement(cx, annotationsArray, iterIndex,
|
||||||
keyValueArray)) {
|
keyValueArray, JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2604,7 +2607,8 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||||
if (!moduleInfoArray) {
|
if (!moduleInfoArray) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, moduleArray, moduleIndex, moduleInfoArray)) {
|
if (!JS_DefineElement(cx, moduleArray, moduleIndex, moduleInfoArray,
|
||||||
|
JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2615,7 +2619,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, moduleInfoArray, index++, str)) {
|
if (!JS_DefineElement(cx, moduleInfoArray, index++, str, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2624,7 +2628,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, moduleInfoArray, index++, id)) {
|
if (!JS_DefineElement(cx, moduleInfoArray, index++, id, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2646,7 +2650,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!JS_SetElement(cx, reportArray, i, pcArray)) {
|
if (!JS_DefineElement(cx, reportArray, i, pcArray, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2660,13 +2664,14 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||||
}
|
}
|
||||||
int modIndex = (std::numeric_limits<uint16_t>::max() == frame.mModIndex) ?
|
int modIndex = (std::numeric_limits<uint16_t>::max() == frame.mModIndex) ?
|
||||||
-1 : frame.mModIndex;
|
-1 : frame.mModIndex;
|
||||||
if (!JS_SetElement(cx, framePair, 0, modIndex)) {
|
if (!JS_DefineElement(cx, framePair, 0, modIndex, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, framePair, 1, static_cast<double>(frame.mOffset))) {
|
if (!JS_DefineElement(cx, framePair, 1, static_cast<double>(frame.mOffset),
|
||||||
|
JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!JS_SetElement(cx, pcArray, pcIndex, framePair)) {
|
if (!JS_DefineElement(cx, pcArray, pcIndex, framePair, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2799,13 +2804,14 @@ CreateJSTimeHistogram(JSContext* cx, const Telemetry::TimeHistogram& time)
|
||||||
}
|
}
|
||||||
/* In a Chromium-style histogram, the first bucket is an "under" bucket
|
/* In a Chromium-style histogram, the first bucket is an "under" bucket
|
||||||
that represents all values below the histogram's range. */
|
that represents all values below the histogram's range. */
|
||||||
if (!JS_SetElement(cx, ranges, 0, time.GetBucketMin(0)) ||
|
if (!JS_DefineElement(cx, ranges, 0, time.GetBucketMin(0), JSPROP_ENUMERATE) ||
|
||||||
!JS_SetElement(cx, counts, 0, 0)) {
|
!JS_DefineElement(cx, counts, 0, 0, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < ArrayLength(time); i++) {
|
for (size_t i = 0; i < ArrayLength(time); i++) {
|
||||||
if (!JS_SetElement(cx, ranges, i + 1, time.GetBucketMax(i)) ||
|
if (!JS_DefineElement(cx, ranges, i + 1, time.GetBucketMax(i),
|
||||||
!JS_SetElement(cx, counts, i + 1, time[i])) {
|
JSPROP_ENUMERATE) ||
|
||||||
|
!JS_DefineElement(cx, counts, i + 1, time[i], JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2825,7 +2831,7 @@ CreateJSHangStack(JSContext* cx, const Telemetry::HangStack& stack)
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < stack.length(); i++) {
|
for (size_t i = 0; i < stack.length(); i++) {
|
||||||
JS::RootedString string(cx, JS_NewStringCopyZ(cx, stack[i]));
|
JS::RootedString string(cx, JS_NewStringCopyZ(cx, stack[i]));
|
||||||
if (!JS_SetElement(cx, ret, i, string)) {
|
if (!JS_DefineElement(cx, ret, i, string, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2885,7 +2891,7 @@ CreateJSThreadHangStats(JSContext* cx, const Telemetry::ThreadHangStats& thread)
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < thread.mHangs.length(); i++) {
|
for (size_t i = 0; i < thread.mHangs.length(); i++) {
|
||||||
JS::RootedObject obj(cx, CreateJSHangHistogram(cx, thread.mHangs[i]));
|
JS::RootedObject obj(cx, CreateJSHangHistogram(cx, thread.mHangs[i]));
|
||||||
if (!JS_SetElement(cx, hangs, i, obj)) {
|
if (!JS_DefineElement(cx, hangs, i, obj, JSPROP_ENUMERATE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2914,7 +2920,7 @@ TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::MutableHandle<JS::Value> re
|
||||||
histogram; histogram = iter.GetNext()) {
|
histogram; histogram = iter.GetNext()) {
|
||||||
JS::RootedObject obj(cx,
|
JS::RootedObject obj(cx,
|
||||||
CreateJSThreadHangStats(cx, *histogram));
|
CreateJSThreadHangStats(cx, *histogram));
|
||||||
if (!JS_SetElement(cx, retObj, threadIndex++, obj)) {
|
if (!JS_DefineElement(cx, retObj, threadIndex++, obj, JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2925,7 +2931,7 @@ TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::MutableHandle<JS::Value> re
|
||||||
for (size_t i = 0; i < mThreadHangStats.length(); i++) {
|
for (size_t i = 0; i < mThreadHangStats.length(); i++) {
|
||||||
JS::RootedObject obj(cx,
|
JS::RootedObject obj(cx,
|
||||||
CreateJSThreadHangStats(cx, mThreadHangStats[i]));
|
CreateJSThreadHangStats(cx, mThreadHangStats[i]));
|
||||||
if (!JS_SetElement(cx, retObj, threadIndex++, obj)) {
|
if (!JS_DefineElement(cx, retObj, threadIndex++, obj, JSPROP_ENUMERATE)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче