mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 867459: Root toolkit/ r=terrence
This commit is contained in:
parent
fc7eb30f67
commit
3ad1dacd45
@ -41,8 +41,8 @@ Module::~Module()
|
||||
static JSBool
|
||||
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
{
|
||||
JS::Value prop;
|
||||
if (!JS_GetProperty(cx, parent, name, &prop))
|
||||
JS::Rooted<JS::Value> prop(cx);
|
||||
if (!JS_GetProperty(cx, parent, name, prop.address()))
|
||||
return false;
|
||||
|
||||
if (prop.isUndefined()) {
|
||||
@ -50,16 +50,16 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject* obj = JSVAL_TO_OBJECT(prop);
|
||||
if (!JS_GetProperty(cx, obj, "prototype", &prop))
|
||||
JS::Rooted<JSObject*> obj(cx, prop.toObjectOrNull());
|
||||
if (!JS_GetProperty(cx, obj, "prototype", prop.address()))
|
||||
return false;
|
||||
|
||||
JSObject* prototype = JSVAL_TO_OBJECT(prop);
|
||||
JS::Rooted<JSObject*> prototype(cx, prop.toObjectOrNull());
|
||||
return JS_FreezeObject(cx, obj) && JS_FreezeObject(cx, prototype);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
InitAndSealPerfMeasurementClass(JSContext* cx, JSObject* global)
|
||||
InitAndSealPerfMeasurementClass(JSContext* cx, JS::Handle<JSObject*> global)
|
||||
{
|
||||
// Init the PerfMeasurement class
|
||||
if (!JS::RegisterPerfMeasurement(cx, global))
|
||||
|
@ -228,8 +228,8 @@ GetURIFromJSObject(JSContext* aCtx,
|
||||
JSObject* aObject,
|
||||
const char* aProperty)
|
||||
{
|
||||
JS::Value uriVal;
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal);
|
||||
JS::Rooted<JS::Value> uriVal(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, uriVal.address());
|
||||
NS_ENSURE_TRUE(rc, nullptr);
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(uriVal)) {
|
||||
@ -263,8 +263,8 @@ GetStringFromJSObject(JSContext* aCtx,
|
||||
const char* aProperty,
|
||||
nsString& _string)
|
||||
{
|
||||
JS::Value val;
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val);
|
||||
JS::Rooted<JS::Value> val(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, val.address());
|
||||
if (!rc || JSVAL_IS_VOID(val) ||
|
||||
!(JSVAL_IS_NULL(val) || JSVAL_IS_STRING(val))) {
|
||||
_string.SetIsVoid(true);
|
||||
@ -304,8 +304,8 @@ GetIntFromJSObject(JSContext* aCtx,
|
||||
const char* aProperty,
|
||||
IntType* _int)
|
||||
{
|
||||
JS::Value value;
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
|
||||
JS::Rooted<JS::Value> value(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, value.address());
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
if (JSVAL_IS_VOID(value)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@ -345,8 +345,8 @@ GetJSObjectFromArray(JSContext* aCtx,
|
||||
NS_PRECONDITION(JS_IsArrayObject(aCtx, aArray),
|
||||
"Must provide an object that is an array!");
|
||||
|
||||
JS::Value value;
|
||||
JSBool rc = JS_GetElement(aCtx, aArray, aIndex, &value);
|
||||
JS::Rooted<JS::Value> value(aCtx);
|
||||
JSBool rc = JS_GetElement(aCtx, aArray, aIndex, value.address());
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_ARG(!JSVAL_IS_PRIMITIVE(value));
|
||||
*_rooter = JSVAL_TO_OBJECT(value);
|
||||
@ -2506,9 +2506,9 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos,
|
||||
NS_ENSURE_TRUE(!JSVAL_IS_PRIMITIVE(aPlaceInfos), NS_ERROR_INVALID_ARG);
|
||||
|
||||
uint32_t infosLength = 1;
|
||||
JSObject* infos;
|
||||
if (JS_IsArrayObject(aCtx, JSVAL_TO_OBJECT(aPlaceInfos))) {
|
||||
infos = JSVAL_TO_OBJECT(aPlaceInfos);
|
||||
JS::Rooted<JSObject*> infos(aCtx);
|
||||
if (JS_IsArrayObject(aCtx, aPlaceInfos.toObjectOrNull())) {
|
||||
infos = aPlaceInfos.toObjectOrNull();
|
||||
(void)JS_GetArrayLength(aCtx, infos, &infosLength);
|
||||
NS_ENSURE_ARG(infosLength > 0);
|
||||
}
|
||||
@ -2524,8 +2524,8 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos,
|
||||
|
||||
nsTArray<VisitData> visitData;
|
||||
for (uint32_t i = 0; i < infosLength; i++) {
|
||||
JSObject* info;
|
||||
nsresult rv = GetJSObjectFromArray(aCtx, infos, i, &info);
|
||||
JS::Rooted<JSObject*> info(aCtx);
|
||||
nsresult rv = GetJSObjectFromArray(aCtx, infos, i, info.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri = GetURIFromJSObject(aCtx, info, "uri");
|
||||
@ -2557,10 +2557,10 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos,
|
||||
nsString title;
|
||||
GetStringFromJSObject(aCtx, info, "title", title);
|
||||
|
||||
JSObject* visits = NULL;
|
||||
JS::Rooted<JSObject*> visits(aCtx, nullptr);
|
||||
{
|
||||
JS::Value visitsVal;
|
||||
JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal);
|
||||
JS::Rooted<JS::Value> visitsVal(aCtx);
|
||||
JSBool rc = JS_GetProperty(aCtx, info, "visits", visitsVal.address());
|
||||
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
|
||||
if (!JSVAL_IS_PRIMITIVE(visitsVal)) {
|
||||
visits = JSVAL_TO_OBJECT(visitsVal);
|
||||
@ -2578,8 +2578,8 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos,
|
||||
// Check each visit, and build our array of VisitData objects.
|
||||
visitData.SetCapacity(visitData.Length() + visitsLength);
|
||||
for (uint32_t j = 0; j < visitsLength; j++) {
|
||||
JSObject* visit;
|
||||
rv = GetJSObjectFromArray(aCtx, visits, j, &visit);
|
||||
JS::Rooted<JSObject*> visit(aCtx);
|
||||
rv = GetJSObjectFromArray(aCtx, visits, j, visit.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
VisitData& data = *visitData.AppendElement(VisitData(uri));
|
||||
|
@ -75,10 +75,10 @@ PlaceInfo::GetVisits(JSContext* aContext,
|
||||
{
|
||||
// TODO bug 625913 when we use this in situations that have more than one
|
||||
// visit here, we will likely want to make this cache the value.
|
||||
JSObject* visits = JS_NewArrayObject(aContext, 0, NULL);
|
||||
JS::Rooted<JSObject*> visits(aContext, JS_NewArrayObject(aContext, 0, NULL));
|
||||
NS_ENSURE_TRUE(visits, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
JSObject* global = JS_GetGlobalForScopeChain(aContext);
|
||||
JS::Rooted<JSObject*> global(aContext, JS_GetGlobalForScopeChain(aContext));
|
||||
NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpc = mozilla::services::GetXPConnect();
|
||||
@ -90,8 +90,8 @@ PlaceInfo::GetVisits(JSContext* aContext,
|
||||
getter_AddRefs(wrapper));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSObject* jsobj;
|
||||
rv = wrapper->GetJSObject(&jsobj);
|
||||
JS::Rooted<JSObject*> jsobj(aContext);
|
||||
rv = wrapper->GetJSObject(jsobj.address());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JS::Value wrappedVisit = OBJECT_TO_JSVAL(jsobj);
|
||||
|
||||
|
@ -782,11 +782,11 @@ CalculateProcessCreationTimestamp()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppStartup::GetStartupInfo(JSContext* aCx, JS::Value* aRetval)
|
||||
{
|
||||
JSObject *obj = JS_NewObject(aCx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, NULL, NULL, NULL));
|
||||
*aRetval = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
PRTime ProcessCreationTimestamp = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
|
||||
|
@ -518,7 +518,7 @@ GetHistogramByEnumId(Telemetry::ID id, Histogram **ret)
|
||||
}
|
||||
|
||||
bool
|
||||
FillRanges(JSContext *cx, JSObject *array, Histogram *h)
|
||||
FillRanges(JSContext *cx, JS::Handle<JSObject*> array, Histogram *h)
|
||||
{
|
||||
for (size_t i = 0; i < h->bucket_count(); i++) {
|
||||
if (!JS_DefineElement(cx, array, i, INT_TO_JSVAL(h->ranges(i)), NULL, NULL, JSPROP_ENUMERATE))
|
||||
@ -568,22 +568,20 @@ ReflectHistogramAndSamples(JSContext *cx, JSObject *obj, Histogram *h,
|
||||
}
|
||||
|
||||
const size_t count = h->bucket_count();
|
||||
JSObject *rarray = JS_NewArrayObject(cx, count, nullptr);
|
||||
JS::Rooted<JSObject*> rarray(cx, JS_NewArrayObject(cx, count, nullptr));
|
||||
if (!rarray) {
|
||||
return REFLECT_FAILURE;
|
||||
}
|
||||
JS::AutoObjectRooter aroot(cx, rarray);
|
||||
if (!(FillRanges(cx, rarray, h)
|
||||
&& JS_DefineProperty(cx, obj, "ranges", OBJECT_TO_JSVAL(rarray),
|
||||
NULL, NULL, JSPROP_ENUMERATE))) {
|
||||
return REFLECT_FAILURE;
|
||||
}
|
||||
|
||||
JSObject *counts_array = JS_NewArrayObject(cx, count, NULL);
|
||||
JS::Rooted<JSObject*> counts_array(cx, JS_NewArrayObject(cx, count, nullptr));
|
||||
if (!counts_array) {
|
||||
return REFLECT_FAILURE;
|
||||
}
|
||||
JS::AutoObjectRooter croot(cx, counts_array);
|
||||
if (!JS_DefineProperty(cx, obj, "counts", OBJECT_TO_JSVAL(counts_array),
|
||||
NULL, NULL, JSPROP_ENUMERATE)) {
|
||||
return REFLECT_FAILURE;
|
||||
@ -656,10 +654,9 @@ JSHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
}
|
||||
|
||||
Histogram *h = static_cast<Histogram*>(JS_GetPrivate(obj));
|
||||
JSObject *snapshot = JS_NewObject(cx, nullptr, nullptr, nullptr);
|
||||
JS::Rooted<JSObject*> snapshot(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
if (!snapshot)
|
||||
return JS_FALSE;
|
||||
JS::AutoObjectRooter sroot(cx, snapshot);
|
||||
|
||||
switch (ReflectHistogramSnapshot(cx, snapshot, h)) {
|
||||
case REFLECT_FAILURE:
|
||||
@ -699,10 +696,9 @@ WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::Value *ret)
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
|
||||
};
|
||||
|
||||
JSObject *obj = JS_NewObject(cx, &JSHistogram_class, NULL, NULL);
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, &JSHistogram_class, NULL, NULL));
|
||||
if (!obj)
|
||||
return NS_ERROR_FAILURE;
|
||||
JS::AutoObjectRooter root(cx, obj);
|
||||
if (!(JS_DefineFunction(cx, obj, "add", JSHistogram_Add, 1, 0)
|
||||
&& JS_DefineFunction(cx, obj, "snapshot", JSHistogram_Snapshot, 0, 0)
|
||||
&& JS_DefineFunction(cx, obj, "clear", JSHistogram_Clear, 0, 0))) {
|
||||
@ -1001,11 +997,10 @@ TelemetryImpl::ReflectSQL(const SlowSQLEntryType *entry,
|
||||
JS::Value hitCount = UINT_TO_JSVAL(stat->hitCount);
|
||||
JS::Value totalTime = UINT_TO_JSVAL(stat->totalTime);
|
||||
|
||||
JSObject *arrayObj = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> arrayObj(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!arrayObj) {
|
||||
return false;
|
||||
}
|
||||
JS::AutoObjectRooter root(cx, arrayObj);
|
||||
return (JS_SetElement(cx, arrayObj, 0, &hitCount)
|
||||
&& JS_SetElement(cx, arrayObj, 1, &totalTime)
|
||||
&& JS_DefineProperty(cx, obj,
|
||||
@ -1032,10 +1027,9 @@ bool
|
||||
TelemetryImpl::AddSQLInfo(JSContext *cx, JSObject *rootObj, bool mainThread,
|
||||
bool privateSQL)
|
||||
{
|
||||
JSObject *statsObj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> statsObj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!statsObj)
|
||||
return false;
|
||||
JS::AutoObjectRooter root(cx, statsObj);
|
||||
|
||||
AutoHashtable<SlowSQLEntryType> &sqlMap =
|
||||
(privateSQL ? mPrivateSQL : mSanitizedSQL);
|
||||
@ -1283,7 +1277,7 @@ TelemetryImpl::UnregisterAddonHistograms(const nsACString &id)
|
||||
NS_IMETHODIMP
|
||||
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
|
||||
{
|
||||
JSObject *root_obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!root_obj)
|
||||
return NS_ERROR_FAILURE;
|
||||
*ret = OBJECT_TO_JSVAL(root_obj);
|
||||
@ -1316,11 +1310,10 @@ TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
|
||||
continue;
|
||||
}
|
||||
|
||||
JSObject *hobj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> hobj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!hobj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS::AutoObjectRooter root(cx, hobj);
|
||||
switch (ReflectHistogramSnapshot(cx, hobj, h)) {
|
||||
case REFLECT_CORRUPT:
|
||||
// We can still hit this case even if ShouldReflectHistograms
|
||||
@ -1379,12 +1372,11 @@ TelemetryImpl::AddonHistogramReflector(AddonHistogramEntryType *entry,
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject *snapshot = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> snapshot(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!snapshot) {
|
||||
// Just consider this to be skippable.
|
||||
return true;
|
||||
}
|
||||
JS::AutoObjectRooter r(cx, snapshot);
|
||||
switch (ReflectHistogramSnapshot(cx, snapshot, info.h)) {
|
||||
case REFLECT_FAILURE:
|
||||
case REFLECT_CORRUPT:
|
||||
@ -1407,11 +1399,10 @@ TelemetryImpl::AddonReflector(AddonEntryType *entry,
|
||||
JSContext *cx, JSObject *obj)
|
||||
{
|
||||
const nsACString &addonId = entry->GetKey();
|
||||
JSObject *subobj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> subobj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!subobj) {
|
||||
return false;
|
||||
}
|
||||
JS::AutoObjectRooter r(cx, subobj);
|
||||
|
||||
AddonHistogramMapType *map = entry->mData;
|
||||
if (!(map->ReflectIntoJS(AddonHistogramReflector, cx, subobj)
|
||||
@ -1428,11 +1419,10 @@ NS_IMETHODIMP
|
||||
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
|
||||
{
|
||||
*ret = JSVAL_VOID;
|
||||
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!obj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS::AutoObjectRooter r(cx, obj);
|
||||
|
||||
if (!mAddonMap.ReflectIntoJS(AddonReflector, cx, obj)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1444,7 +1434,7 @@ TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
|
||||
bool
|
||||
TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql)
|
||||
{
|
||||
JSObject *root_obj = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!root_obj)
|
||||
return false;
|
||||
*ret = OBJECT_TO_JSVAL(root_obj);
|
||||
@ -1456,7 +1446,7 @@ TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql
|
||||
// Add info about slow SQL queries on other threads
|
||||
if (!AddSQLInfo(cx, root_obj, false, includePrivateSql))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1491,14 +1481,14 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::Value *ret)
|
||||
MutexAutoLock hangReportMutex(mHangReportsMutex);
|
||||
|
||||
const CombinedStacks& stacks = mHangReports.GetStacks();
|
||||
JSObject *fullReportObj = CreateJSStackObject(cx, stacks);
|
||||
JS::Rooted<JSObject*> fullReportObj(cx, CreateJSStackObject(cx, stacks));
|
||||
if (!fullReportObj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*ret = OBJECT_TO_JSVAL(fullReportObj);
|
||||
|
||||
JSObject *durationArray = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> durationArray(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!durationArray) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1522,12 +1512,12 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::Value *ret)
|
||||
|
||||
static JSObject *
|
||||
CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
JSObject *ret = JS_NewObject(cx, nullptr, nullptr, nullptr);
|
||||
JS::Rooted<JSObject*> ret(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
if (!ret) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject *moduleArray = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> moduleArray(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!moduleArray) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1544,7 +1534,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
const Telemetry::ProcessedStack::Module& module =
|
||||
stacks.GetModule(moduleIndex);
|
||||
|
||||
JSObject *moduleInfoArray = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> moduleInfoArray(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!moduleInfoArray) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1576,7 +1566,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
}
|
||||
}
|
||||
|
||||
JSObject *reportArray = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> reportArray(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!reportArray) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1590,7 +1580,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
const size_t length = stacks.GetStackCount();
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
// Represent call stack PCs as (module index, offset) pairs.
|
||||
JSObject *pcArray = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> pcArray(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!pcArray) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1604,7 +1594,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
const uint32_t pcCount = stack.size();
|
||||
for (size_t pcIndex = 0; pcIndex < pcCount; ++pcIndex) {
|
||||
const Telemetry::ProcessedStack::Frame& frame = stack[pcIndex];
|
||||
JSObject *framePair = JS_NewArrayObject(cx, 0, nullptr);
|
||||
JS::Rooted<JSObject*> framePair(cx, JS_NewArrayObject(cx, 0, nullptr));
|
||||
if (!framePair) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1797,14 +1787,14 @@ NS_IMETHODIMP
|
||||
TelemetryImpl::GetRegisteredHistograms(JSContext *cx, JS::Value *ret)
|
||||
{
|
||||
size_t count = ArrayLength(gHistograms);
|
||||
JSObject *info = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
JS::Rooted<JSObject*> info(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
JS::AutoObjectRooter root(cx, info);
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
JSString *comment = JS_InternString(cx, gHistograms[i].comment());
|
||||
|
||||
|
||||
if (!(comment
|
||||
&& JS_DefineProperty(cx, info, gHistograms[i].id(),
|
||||
STRING_TO_JSVAL(comment), NULL, NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user