зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125356 - Use JS_NewPlainObject in the browser. r=bz
This commit is contained in:
Родитель
f9788270a9
Коммит
66ad9a2e49
|
@ -492,7 +492,7 @@ RemotePermissionRequest::Recv__delete__(const bool& aAllow,
|
|||
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
obj = JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr());
|
||||
obj = JS_NewPlainObject(cx);
|
||||
for (uint32_t i = 0; i < aChoices.Length(); ++i) {
|
||||
const nsString& choice = aChoices[i].choice();
|
||||
const nsCString& type = aChoices[i].type();
|
||||
|
|
|
@ -2434,11 +2434,12 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
|
|||
}
|
||||
|
||||
// Create a fake Components object.
|
||||
JS::Rooted<JSObject*> components(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), global));
|
||||
AssertSameCompartment(cx, global);
|
||||
JS::Rooted<JSObject*> components(cx, JS_NewPlainObject(cx));
|
||||
NS_ENSURE_TRUE(components, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Create a fake interfaces object.
|
||||
JS::Rooted<JSObject*> interfaces(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), global));
|
||||
JS::Rooted<JSObject*> interfaces(cx, JS_NewPlainObject(cx));
|
||||
NS_ENSURE_TRUE(interfaces, NS_ERROR_OUT_OF_MEMORY);
|
||||
bool ok =
|
||||
JS_DefineProperty(cx, components, "interfaces", interfaces,
|
||||
|
|
|
@ -981,8 +981,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
JS::Rooted<JSObject*> object(cx, wrappedJS->GetJSObject());
|
||||
|
||||
// The parameter for the listener function.
|
||||
JS::Rooted<JSObject*> param(cx,
|
||||
JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> param(cx, JS_NewPlainObject(cx));
|
||||
NS_ENSURE_TRUE(param, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
JS::Rooted<JS::Value> targetv(cx);
|
||||
|
@ -998,7 +997,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
}
|
||||
|
||||
if (!cpows) {
|
||||
cpows = JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr());
|
||||
cpows = JS_NewPlainObject(cx);
|
||||
if (!cpows) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
|
|
@ -5702,7 +5702,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
|
|||
|
||||
nsTArray<nsString> keys;
|
||||
${result}.GetKeys(keys);
|
||||
JS::Rooted<JSObject*> returnObj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> returnObj(cx, JS_NewPlainObject(cx));
|
||||
if (!returnObj) {
|
||||
$*{exceptionCode}
|
||||
}
|
||||
|
@ -7542,7 +7542,7 @@ class CGJsonifierMethod(CGSpecializedMethod):
|
|||
|
||||
def definition_body(self):
|
||||
ret = dedent("""
|
||||
JS::Rooted<JSObject*> result(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> result(cx, JS_NewPlainObject(cx));
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
@ -11516,7 +11516,7 @@ class CGDictionary(CGThing):
|
|||
else:
|
||||
body += fill(
|
||||
"""
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -722,8 +722,7 @@ BluetoothService::Notify(const BluetoothSignal& aData)
|
|||
nsString type = NS_LITERAL_STRING("bluetooth-pairing-request");
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
NS_ENSURE_TRUE_VOID(obj);
|
||||
|
||||
if (!SetJsObject(cx, aData.value(), obj)) {
|
||||
|
|
|
@ -84,8 +84,7 @@ BroadcastSystemMessage(const nsAString& aType,
|
|||
aData.get_nsString().Length());
|
||||
value = STRING_TO_JSVAL(jsData);
|
||||
} else if (aData.type() == BluetoothValue::TArrayOfBluetoothNamedValue) {
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
BT_WARNING("Failed to new JSObject for system message!");
|
||||
return false;
|
||||
|
@ -115,8 +114,7 @@ BroadcastSystemMessage(const nsAString& aType,
|
|||
NS_ASSERTION(!::JS_IsExceptionPending(cx),
|
||||
"Shouldn't get here when an exception is pending!");
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
BT_WARNING("Failed to new JSObject for system message!");
|
||||
return false;
|
||||
|
|
|
@ -116,8 +116,7 @@ BroadcastSystemMessage(const nsAString& aType,
|
|||
aData.get_nsString().Length());
|
||||
value = STRING_TO_JSVAL(jsData);
|
||||
} else if (aData.type() == BluetoothValue::TArrayOfBluetoothNamedValue) {
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx)));
|
||||
if (!obj) {
|
||||
BT_WARNING("Failed to new JSObject for system message!");
|
||||
return false;
|
||||
|
|
|
@ -111,8 +111,7 @@ BroadcastSystemMessage(const nsAString& aType,
|
|||
NS_ASSERTION(!::JS_IsExceptionPending(cx),
|
||||
"Shouldn't get here when an exception is pending!");
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
BT_WARNING("Failed to new JSObject for system message!");
|
||||
return false;
|
||||
|
|
|
@ -36,8 +36,7 @@ nsresult
|
|||
MetadataHelper::GetSuccessResult(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aVal)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
||||
NS_ENSURE_TRUE(obj, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (mParams->SizeRequested()) {
|
||||
|
|
|
@ -1743,7 +1743,7 @@ HTMLMediaElement::MozGetMetadata(JSContext* cx,
|
|||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> tags(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> tags(cx, JS_NewPlainObject(cx));
|
||||
if (!tags) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
|
|
|
@ -677,9 +677,7 @@ public:
|
|||
MOZ_ASSERT(!aDatabase);
|
||||
|
||||
// MutableFile can't be used in index creation, so just make a dummy object.
|
||||
JS::Rooted<JSObject*> obj(aCx,
|
||||
JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
||||
if (NS_WARN_IF(!obj)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -705,8 +703,7 @@ public:
|
|||
// File.name
|
||||
// File.lastModifiedDate
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx,
|
||||
JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
||||
if (NS_WARN_IF(!obj)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -154,8 +154,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
if (tokenizer.hasMoreTokens()) {
|
||||
// If we're not at the end, we need to add a dummy object to the
|
||||
// chain.
|
||||
JS::Rooted<JSObject*> dummy(aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> dummy(aCx, JS_NewPlainObject(aCx));
|
||||
if (!dummy) {
|
||||
IDB_REPORT_INTERNAL_ERR();
|
||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
|
|
|
@ -546,8 +546,7 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle<JS::Value> aAttachm
|
|||
for (uint32_t i = 0; i < length; ++i) {
|
||||
const Attachment &attachment = mAttachments[i];
|
||||
|
||||
JS::Rooted<JSObject*> attachmentObj(
|
||||
aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> attachmentObj(aCx, JS_NewPlainObject(aCx));
|
||||
NS_ENSURE_TRUE(attachmentObj, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
JS::Rooted<JSString*> tmpJsStr(aCx);
|
||||
|
|
|
@ -33,8 +33,7 @@ static JSObject*
|
|||
MmsAttachmentDataToJSObject(JSContext* aContext,
|
||||
const MmsAttachmentData& aAttachment)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aContext, JS_NewObject(aContext, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(aContext, JS_NewPlainObject(aContext));
|
||||
NS_ENSURE_TRUE(obj, nullptr);
|
||||
|
||||
JS::Rooted<JSString*> idStr(aContext, JS_NewUCStringCopyN(aContext,
|
||||
|
@ -83,7 +82,7 @@ GetParamsFromSendMmsMessageRequest(JSContext* aCx,
|
|||
const SendMmsMessageRequest& aRequest,
|
||||
JS::Value* aParam)
|
||||
{
|
||||
JS::Rooted<JSObject*> paramsObj(aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> paramsObj(aCx, JS_NewPlainObject(aCx));
|
||||
NS_ENSURE_TRUE(paramsObj, false);
|
||||
|
||||
// smil
|
||||
|
|
|
@ -699,7 +699,7 @@ JavaScriptShared::Unwrap(JSContext *cx, const InfallibleTArray<CpowEntry> &aCpow
|
|||
if (!aCpows.Length())
|
||||
return true;
|
||||
|
||||
RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
RootedObject obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -3400,7 +3400,7 @@ nsXPCComponents_Utils::GetWatchdogTimestamp(const nsAString& aCategory, PRTime *
|
|||
NS_IMETHODIMP
|
||||
nsXPCComponents_Utils::GetJSEngineTelemetryValue(JSContext *cx, MutableHandleValue rval)
|
||||
{
|
||||
RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
RootedObject obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
|
|
@ -745,7 +745,7 @@ nsAppStartup::Observe(nsISupports *aSubject,
|
|||
NS_IMETHODIMP
|
||||
nsAppStartup::GetStartupInfo(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
||||
|
||||
aRetval.setObject(*obj);
|
||||
|
||||
|
|
|
@ -777,7 +777,7 @@ KeyedHistogram::GetJSKeys(JSContext* cx, JS::CallArgs& args)
|
|||
bool
|
||||
KeyedHistogram::ReflectKeyedHistogram(KeyedHistogramEntry* entry, JSContext* cx, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
JS::RootedObject histogramSnapshot(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject histogramSnapshot(cx, JS_NewPlainObject(cx));
|
||||
if (!histogramSnapshot) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1241,7 +1241,7 @@ JSHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
|
|||
}
|
||||
|
||||
Histogram *h = static_cast<Histogram*>(JS_GetPrivate(obj));
|
||||
JS::Rooted<JSObject*> snapshot(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> snapshot(cx, JS_NewPlainObject(cx));
|
||||
if (!snapshot)
|
||||
return false;
|
||||
|
||||
|
@ -1384,7 +1384,7 @@ JSKeyedHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
|
|||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.length() == 0) {
|
||||
JS::RootedObject snapshot(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject snapshot(cx, JS_NewPlainObject(cx));
|
||||
if (!snapshot) {
|
||||
JS_ReportError(cx, "Failed to create object");
|
||||
return false;
|
||||
|
@ -1412,7 +1412,7 @@ JSKeyedHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
JS::RootedObject snapshot(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject snapshot(cx, JS_NewPlainObject(cx));
|
||||
if (!snapshot) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1841,7 +1841,7 @@ bool
|
|||
TelemetryImpl::AddSQLInfo(JSContext *cx, JS::Handle<JSObject*> rootObj, bool mainThread,
|
||||
bool privateSQL)
|
||||
{
|
||||
JS::Rooted<JSObject*> statsObj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> statsObj(cx, JS_NewPlainObject(cx));
|
||||
if (!statsObj)
|
||||
return false;
|
||||
|
||||
|
@ -2116,7 +2116,7 @@ TelemetryImpl::UnregisterAddonHistograms(const nsACString &id)
|
|||
NS_IMETHODIMP
|
||||
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
||||
{
|
||||
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> root_obj(cx, JS_NewPlainObject(cx));
|
||||
if (!root_obj)
|
||||
return NS_ERROR_FAILURE;
|
||||
ret.setObject(*root_obj);
|
||||
|
@ -2155,7 +2155,7 @@ TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value>
|
|||
continue;
|
||||
}
|
||||
|
||||
hobj = JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr());
|
||||
hobj = JS_NewPlainObject(cx);
|
||||
if (!hobj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2217,7 +2217,7 @@ TelemetryImpl::AddonHistogramReflector(AddonHistogramEntryType *entry,
|
|||
return true;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> snapshot(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> snapshot(cx, JS_NewPlainObject(cx));
|
||||
if (!snapshot) {
|
||||
// Just consider this to be skippable.
|
||||
return true;
|
||||
|
@ -2242,7 +2242,7 @@ TelemetryImpl::AddonReflector(AddonEntryType *entry,
|
|||
JSContext *cx, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
const nsACString &addonId = entry->GetKey();
|
||||
JS::Rooted<JSObject*> subobj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> subobj(cx, JS_NewPlainObject(cx));
|
||||
if (!subobj) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2259,7 +2259,7 @@ TelemetryImpl::AddonReflector(AddonEntryType *entry,
|
|||
NS_IMETHODIMP
|
||||
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2277,7 +2277,7 @@ TelemetryImpl::KeyedHistogramsReflector(const nsACString& key, nsAutoPtr<KeyedHi
|
|||
{
|
||||
KeyedHistogramReflectArgs* args = static_cast<KeyedHistogramReflectArgs*>(arg);
|
||||
JSContext *cx = args->jsContext;
|
||||
JS::RootedObject snapshot(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject snapshot(cx, JS_NewPlainObject(cx));
|
||||
if (!snapshot) {
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
@ -2297,7 +2297,7 @@ TelemetryImpl::KeyedHistogramsReflector(const nsACString& key, nsAutoPtr<KeyedHi
|
|||
NS_IMETHODIMP
|
||||
TelemetryImpl::GetKeyedHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2316,7 +2316,7 @@ TelemetryImpl::GetKeyedHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::V
|
|||
bool
|
||||
TelemetryImpl::GetSQLStats(JSContext *cx, JS::MutableHandle<JS::Value> ret, bool includePrivateSql)
|
||||
{
|
||||
JS::Rooted<JSObject*> root_obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> root_obj(cx, JS_NewPlainObject(cx));
|
||||
if (!root_obj)
|
||||
return false;
|
||||
ret.setObject(*root_obj);
|
||||
|
@ -2428,9 +2428,7 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
|||
if (!JS_SetElement(cx, keyValueArray, 0, indexValue)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JS::Rooted<JSObject*> jsAnnotation(cx, JS_NewObject(cx, nullptr,
|
||||
JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> jsAnnotation(cx, JS_NewPlainObject(cx));
|
||||
if (!jsAnnotation) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2464,7 +2462,7 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, JS::MutableHandle<JS::Value> ret)
|
|||
|
||||
static JSObject *
|
||||
CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
|
||||
JS::Rooted<JSObject*> ret(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> ret(cx, JS_NewPlainObject(cx));
|
||||
if (!ret) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2653,7 +2651,7 @@ CreateJSTimeHistogram(JSContext* cx, const Telemetry::TimeHistogram& time)
|
|||
{
|
||||
/* Create JS representation of TimeHistogram,
|
||||
in the format of Chromium-style histograms. */
|
||||
JS::RootedObject ret(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject ret(cx, JS_NewPlainObject(cx));
|
||||
if (!ret) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2720,8 +2718,7 @@ CreateJSHangStack(JSContext* cx, const Telemetry::HangStack& stack)
|
|||
static JSObject*
|
||||
CreateJSHangHistogram(JSContext* cx, const Telemetry::HangHistogram& hang)
|
||||
{
|
||||
JS::RootedObject ret(cx,
|
||||
JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject ret(cx, JS_NewPlainObject(cx));
|
||||
if (!ret) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2749,7 +2746,7 @@ CreateJSHangHistogram(JSContext* cx, const Telemetry::HangHistogram& hang)
|
|||
static JSObject*
|
||||
CreateJSThreadHangStats(JSContext* cx, const Telemetry::ThreadHangStats& thread)
|
||||
{
|
||||
JS::RootedObject ret(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
JS::RootedObject ret(cx, JS_NewPlainObject(cx));
|
||||
if (!ret) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -3264,8 +3261,7 @@ NS_IMETHODIMP
|
|||
TelemetryImpl::GetFileIOReports(JSContext *cx, JS::MutableHandleValue ret)
|
||||
{
|
||||
if (sTelemetryIOObserver) {
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(),
|
||||
JS::NullPtr()));
|
||||
JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
|
||||
if (!obj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ InfoObject::DefineProperty(const char *name, const char *value)
|
|||
|
||||
InfoObject::InfoObject(JSContext *aCx) : mCx(aCx), mObj(aCx), mOk(true)
|
||||
{
|
||||
mObj = JS_NewObject(mCx, nullptr, JS::NullPtr(), JS::NullPtr());
|
||||
mObj = JS_NewPlainObject(aCx);
|
||||
if (!mObj)
|
||||
mOk = false;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ RunTest(JSRuntime* rt, JSContext* cx, ArrayT* array)
|
|||
RootedValue value(cx);
|
||||
const char* property = "foo";
|
||||
for (size_t i = 0; i < ElementCount; ++i) {
|
||||
RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
RootedObject obj(cx, JS_NewPlainObject(cx));
|
||||
ASSERT_FALSE(JS::ObjectIsTenured(obj));
|
||||
value = Int32Value(i);
|
||||
ASSERT_TRUE(JS_SetProperty(cx, obj, property, value));
|
||||
|
|
Загрузка…
Ссылка в новой задаче