mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 937818, part 0 - Root newly created objects in Bind across ADDREF. r=bz
This commit is contained in:
parent
b6a2d4d7d5
commit
3f5f23664f
@ -2134,18 +2134,9 @@ class CGConstructorEnabledViaFunc(CGAbstractMethod):
|
||||
return " return %s(cx, obj);" % func[0]
|
||||
|
||||
def CreateBindingJSObject(descriptor, properties, parent):
|
||||
# When we have unforgeable properties, we're going to define them
|
||||
# on our object, so we have to root it when we create it, so it
|
||||
# won't suddenly die while defining the unforgeables. Similarly,
|
||||
# if we have members in slots we'll have to call the getters which
|
||||
# could also GC.
|
||||
needRoot = (properties.unforgeableAttrs.hasNonChromeOnly() or
|
||||
properties.unforgeableAttrs.hasChromeOnly() or
|
||||
descriptor.interface.hasMembersInSlots())
|
||||
if needRoot:
|
||||
objDecl = " JS::Rooted<JSObject*> obj(aCx);\n"
|
||||
else:
|
||||
objDecl = " JSObject *obj;\n"
|
||||
# We don't always need to root obj, but there are a variety
|
||||
# of cases where we do, so for simplicity, just always root it.
|
||||
objDecl = " JS::Rooted<JSObject*> obj(aCx);\n"
|
||||
if descriptor.proxy:
|
||||
create = """ JS::Rooted<JS::Value> proxyPrivateVal(aCx, JS::PrivateValue(aObject));
|
||||
obj = NewProxyObject(aCx, DOMProxyHandler::getInstance(),
|
||||
|
Loading…
Reference in New Issue
Block a user