summaryrefslogtreecommitdiff
path: root/js/src/vm/NativeObject-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/vm/NativeObject-inl.h')
-rw-r--r--js/src/vm/NativeObject-inl.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/js/src/vm/NativeObject-inl.h b/js/src/vm/NativeObject-inl.h
index e2fccbdd44..69976bc462 100644
--- a/js/src/vm/NativeObject-inl.h
+++ b/js/src/vm/NativeObject-inl.h
@@ -258,9 +258,8 @@ NativeObject::createWithTemplate(JSContext* cx, gc::InitialHeap heap,
MOZ_ASSERT(CanBeFinalizedInBackground(kind, shape->getObjectClass()));
kind = gc::GetBackgroundAllocKind(kind);
- JSObject* baseObj = create(cx, kind, heap, shape, group);
- if (!baseObj)
- return nullptr;
+ JSObject* baseObj;
+ JS_TRY_VAR_OR_RETURN_NULL(cx, baseObj, create(cx, kind, heap, shape, group));
return &baseObj->as<NativeObject>();
}
@@ -272,9 +271,9 @@ NativeObject::copy(ExclusiveContext* cx, gc::AllocKind kind, gc::InitialHeap hea
RootedObjectGroup group(cx, templateObject->group());
MOZ_ASSERT(!templateObject->denseElementsAreCopyOnWrite());
- JSObject* baseObj = create(cx, kind, heap, shape, group);
- if (!baseObj)
- return nullptr;
+ JSObject* baseObj;
+ JS_TRY_VAR_OR_RETURN_NULL(cx, baseObj, create(cx, kind, heap, shape, group));
+
NativeObject* obj = &baseObj->as<NativeObject>();
size_t span = shape->slotSpan();