Bug 867341 - Replace NULL with nullptr in Rooted<JSObject*> lines. r=vladan

This is the rebased remnants of an earlier patch replacing AutoObjectRooter with Rooted<JSObject*>, after dzbarsky landed a patch doing the same thing.

--HG--
extra : rebase_source : c138f3de547c95a01aee62262bff467e5f5f2e81
This commit is contained in:
Steve Fink 2013-05-02 12:51:41 -07:00
Родитель 4c8e9c3387
Коммит 24a0772ec2
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -696,7 +696,7 @@ WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::Value *ret)
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
}; };
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, &JSHistogram_class, NULL, NULL)); JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, &JSHistogram_class, nullptr, nullptr));
if (!obj) if (!obj)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
if (!(JS_DefineFunction(cx, obj, "add", JSHistogram_Add, 1, 0) if (!(JS_DefineFunction(cx, obj, "add", JSHistogram_Add, 1, 0)
@ -1027,7 +1027,7 @@ bool
TelemetryImpl::AddSQLInfo(JSContext *cx, JSObject *rootObj, bool mainThread, TelemetryImpl::AddSQLInfo(JSContext *cx, JSObject *rootObj, bool mainThread,
bool privateSQL) bool privateSQL)
{ {
JS::Rooted<JSObject*> statsObj(cx, JS_NewObject(cx, NULL, NULL, NULL)); JS::Rooted<JSObject*> statsObj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!statsObj) if (!statsObj)
return false; return false;
@ -1277,7 +1277,7 @@ TelemetryImpl::UnregisterAddonHistograms(const nsACString &id)
NS_IMETHODIMP NS_IMETHODIMP
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret) TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
{ {
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!root_obj) if (!root_obj)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
*ret = OBJECT_TO_JSVAL(root_obj); *ret = OBJECT_TO_JSVAL(root_obj);
@ -1304,13 +1304,14 @@ TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
IdentifyCorruptHistograms(hs); IdentifyCorruptHistograms(hs);
// OK, now we can actually reflect things. // OK, now we can actually reflect things.
JS::Rooted<JSObject*> hobj(cx);
for (HistogramIterator it = hs.begin(); it != hs.end(); ++it) { for (HistogramIterator it = hs.begin(); it != hs.end(); ++it) {
Histogram *h = *it; Histogram *h = *it;
if (!ShouldReflectHistogram(h) || IsEmpty(h)) { if (!ShouldReflectHistogram(h) || IsEmpty(h)) {
continue; continue;
} }
JS::Rooted<JSObject*> hobj(cx, JS_NewObject(cx, NULL, NULL, NULL)); hobj = JS_NewObject(cx, nullptr, nullptr, nullptr);
if (!hobj) { if (!hobj) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -1372,7 +1373,7 @@ TelemetryImpl::AddonHistogramReflector(AddonHistogramEntryType *entry,
return true; return true;
} }
JS::Rooted<JSObject*> snapshot(cx, JS_NewObject(cx, NULL, NULL, NULL)); JS::Rooted<JSObject*> snapshot(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!snapshot) { if (!snapshot) {
// Just consider this to be skippable. // Just consider this to be skippable.
return true; return true;
@ -1399,7 +1400,7 @@ TelemetryImpl::AddonReflector(AddonEntryType *entry,
JSContext *cx, JSObject *obj) JSContext *cx, JSObject *obj)
{ {
const nsACString &addonId = entry->GetKey(); const nsACString &addonId = entry->GetKey();
JS::Rooted<JSObject*> subobj(cx, JS_NewObject(cx, NULL, NULL, NULL)); JS::Rooted<JSObject*> subobj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!subobj) { if (!subobj) {
return false; return false;
} }
@ -1419,7 +1420,7 @@ NS_IMETHODIMP
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret) TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
{ {
*ret = JSVAL_VOID; *ret = JSVAL_VOID;
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!obj) { if (!obj) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -1434,7 +1435,7 @@ TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
bool bool
TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql) TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql)
{ {
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); JSObject *root_obj = JS_NewObject(cx, nullptr, nullptr, nullptr);
if (!root_obj) if (!root_obj)
return false; return false;
*ret = OBJECT_TO_JSVAL(root_obj); *ret = OBJECT_TO_JSVAL(root_obj);
@ -1787,10 +1788,9 @@ NS_IMETHODIMP
TelemetryImpl::GetRegisteredHistograms(JSContext *cx, JS::Value *ret) TelemetryImpl::GetRegisteredHistograms(JSContext *cx, JS::Value *ret)
{ {
size_t count = ArrayLength(gHistograms); size_t count = ArrayLength(gHistograms);
JS::Rooted<JSObject*> info(cx, JS_NewObject(cx, NULL, NULL, NULL)); JS::Rooted<JSObject*> info(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
if (!info) if (!info)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
JS::AutoObjectRooter root(cx, info);
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
JSString *comment = JS_InternString(cx, gHistograms[i].comment()); JSString *comment = JS_InternString(cx, gHistograms[i].comment());