Bug 580128. Remove XrayUtils::JSSLOT_PROXY_OBJ to fix leaks. r=mrbkap.
authorPeter Van der Beken <peterv@propagandism.org>
Sun, 10 Oct 2010 15:46:45 -0700
changeset 55684 c1ca077ef22858921a691239dba0c34351be8f01
parent 55683 1916a5ca667a604b418e87c227cb4425a60b981d
child 55685 d4ac84ec66499b8cc8540062ad2771bf536ee8cb
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs580128
milestone2.0b8pre
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
Bug 580128. Remove XrayUtils::JSSLOT_PROXY_OBJ to fix leaks. r=mrbkap.
js/src/xpconnect/wrappers/WrapperFactory.cpp
js/src/xpconnect/wrappers/XrayWrapper.cpp
js/src/xpconnect/wrappers/XrayWrapper.h
--- a/js/src/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/src/xpconnect/wrappers/WrapperFactory.cpp
@@ -229,17 +229,16 @@ WrapperFactory::Rewrap(JSContext *cx, JS
 
     JSObject *wrapperObj = JSWrapper::New(cx, obj, wrappedProto, parent, wrapper);
     if (!wrapperObj || !xrayHolder)
         return wrapperObj;
 
     // NB: The fact that the only wrappers to use ProxyExtra are XrayWrappers
     // is relied on by XPCNativeWrapper.unwrap.
     wrapperObj->setProxyExtra(js::ObjectValue(*xrayHolder));
-    xrayHolder->setSlot(XrayUtils::JSSLOT_PROXY_OBJ, js::ObjectValue(*wrapperObj));
     return wrapperObj;
 }
 
 typedef FilteringWrapper<XrayWrapper<JSWrapper, SameCompartmentXray>,
                          SameOriginOrCrossOriginAccessiblePropertiesOnly> LW;
 
 bool
 WrapperFactory::IsLocationObject(JSObject *obj)
@@ -253,13 +252,12 @@ WrapperFactory::WrapLocationObject(JSCon
 {
     JSObject *xrayHolder = LW::createHolder(cx, obj, obj->getParent());
     if (!xrayHolder)
         return NULL;
     JSObject *wrapperObj = JSWrapper::New(cx, obj, obj->getProto(), NULL, &LW::singleton);
     if (!wrapperObj)
         return NULL;
     wrapperObj->setProxyExtra(js::ObjectValue(*xrayHolder));
-    xrayHolder->setSlot(XrayUtils::JSSLOT_PROXY_OBJ, js::ObjectValue(*wrapperObj));
     return wrapperObj;
 }
 
 }
--- a/js/src/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/src/xpconnect/wrappers/XrayWrapper.cpp
@@ -51,22 +51,16 @@
 
 namespace xpc {
 
 using namespace js;
 
 static const uint32 JSSLOT_WN_OBJ = JSSLOT_PRIVATE;
 static const uint32 JSSLOT_RESOLVING = JSSLOT_PRIVATE + 1;
 
-namespace XrayUtils {
-
-const uint32 JSSLOT_PROXY_OBJ = JSSLOT_PRIVATE + 2;
-
-}
-
 class ResolvingId
 {
   public:
     ResolvingId(JSObject *holder, jsid id)
       : mId(id),
         mPrev(getResolvingId(holder)),
         mHolder(holder)
     {
@@ -108,17 +102,17 @@ holder_set(JSContext *cx, JSObject *hold
 
 static JSBool
 holder_enumerate(JSContext *cx, JSObject *holder);
 
 namespace XrayUtils {
 
 JSClass HolderClass = {
     "NativePropertyHolder",
-    JSCLASS_HAS_RESERVED_SLOTS(3),
+    JSCLASS_HAS_RESERVED_SLOTS(2),
     JS_PropertyStub,        JS_PropertyStub, holder_get,      holder_set,
     holder_enumerate,       JS_ResolveStub,  JS_ConvertStub,  NULL,
     NULL,                   NULL,            NULL,            NULL,
     NULL,                   NULL,            NULL,            NULL
 };
 
 }
 
--- a/js/src/xpconnect/wrappers/XrayWrapper.h
+++ b/js/src/xpconnect/wrappers/XrayWrapper.h
@@ -46,17 +46,16 @@
 // we pull them out of the JSWrapper inheritance hierarchy and create a
 // little world around them.
 
 namespace xpc {
 
 namespace XrayUtils {
 
 extern JSClass HolderClass;
-extern const uint32 JSSLOT_PROXY_OBJ;
 
 }
 
 // NB: Base *must* derive from JSProxyHandler
 template <typename Base, typename Policy>
 class XrayWrapper : public Base {
   public:
     XrayWrapper(uintN flags);