summaryrefslogtreecommitdiffstats
path: root/js/src/vm/ProxyObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/vm/ProxyObject.cpp')
-rw-r--r--js/src/vm/ProxyObject.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp
index b7655ff..13b52fd 100644
--- a/js/src/vm/ProxyObject.cpp
+++ b/js/src/vm/ProxyObject.cpp
@@ -103,8 +103,16 @@ static gc::AllocKind GetProxyGCObjectKind(const Class* clasp,
else
proxy->setSameCompartmentPrivate(priv);
+ if (newKind == SingletonObject) {
+ Rooted<ProxyObject*> rootedProxy(cx, proxy);
+ if (!JSObject::setSingleton(cx, rootedProxy)) {
+ return nullptr;
+ }
+ return rootedProxy;
+ }
+
/* Don't track types of properties of non-DOM and non-singleton proxies. */
- if (newKind != SingletonObject && !clasp->isDOMClass())
+ if (!clasp->isDOMClass())
MarkObjectGroupUnknownProperties(cx, proxy->group());
return proxy;
@@ -184,12 +192,6 @@ void ProxyObject::nuke() {
js::gc::TraceCreateObject(pobj);
- if (newKind == SingletonObject) {
- Rooted<ProxyObject*> pobjRoot(cx, pobj);
- if (!JSObject::setSingleton(cx, pobjRoot)) return cx->alreadyReportedOOM();
- pobj = pobjRoot;
- }
-
return pobj;
}