Fix for bug 762280 (Use nsContentUtils::PreserveWrapper for preserving expandos). r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Mon, 16 Jul 2012 16:52:53 +0200
changeset 99419 170854ffe1635c6e06f564871c689458948eba90
parent 99418 c81fb77dcb08c08d86f787e962ffee044d749eb1
child 99420 29104ecddc3a8d331769650931334607450717dd
push id11989
push userpvanderbeken@mozilla.com
push dateMon, 16 Jul 2012 15:39:17 +0000
treeherdermozilla-inbound@29104ecddc3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs762280
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fix for bug 762280 (Use nsContentUtils::PreserveWrapper for preserving expandos). r=bz.
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -591,24 +591,21 @@ class CGAddPropertyHook(CGAbstractClassH
     """
     def __init__(self, descriptor):
         args = [Argument('JSContext*', 'cx'), Argument('JSHandleObject', 'obj'),
                 Argument('JSHandleId', 'id'), Argument('jsval*', 'vp')]
         CGAbstractClassHook.__init__(self, descriptor, ADDPROPERTY_HOOK_NAME,
                                      '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):
     """
     A hook for finalize, used to release our native object.
     """
     def __init__(self, descriptor):
         args = [Argument('JSFreeOp*', 'fop'), Argument('JSObject*', 'obj')]