Fix for bug 762280 (Use nsContentUtils::PreserveWrapper for preserving expandos). r=bz.

--HG--
extra : rebase_source : cd426b3c3b987d8e39196e1dd1e468bc87e87f53
This commit is contained in:
Peter Van der Beken 2012-07-16 16:52:53 +02:00
parent e45b10608b
commit 8d3d9a8f02

View File

@ -596,14 +596,11 @@ class CGAddPropertyHook(CGAbstractClassHook):
'JSBool', args)
def generate_code(self):
return """
JSCompartment* compartment = js::GetObjectCompartment(obj);
xpc::CompartmentPrivate* priv =
static_cast<xpc::CompartmentPrivate*>(JS_GetCompartmentPrivate(compartment));
if (!priv->RegisterDOMExpandoObject(obj)) {
return false;
}
self->SetPreservingWrapper(true);
# FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=774279
# Using a real trace hook might enable us to deal with non-nsISupports
# wrappercached things here.
assert self.descriptor.nativeIsISupports
return """ nsContentUtils::PreserveWrapper(reinterpret_cast<nsISupports*>(self), self);
return true;"""
class CGClassFinalizeHook(CGAbstractClassHook):