Bug 882997 - Don't DROP or clear wrapper cache flag in GetAndClearExpandoObject. r=peterv, a=bajaj
authorAndrew McCreight <amccreight@mozilla.com>
Fri, 28 Jun 2013 12:32:27 -0700
changeset 147812 9f5d65c04085338724d890f191cf379fece3c1ad
parent 147811 7568be854b6570a032a833b38bc11a22ce671277
child 147813 cdc01273863f7f551899d27c75193de8394a4b4b
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv, bajaj
bugs882997
milestone24.0a2
Bug 882997 - Don't DROP or clear wrapper cache flag in GetAndClearExpandoObject. r=peterv, a=bajaj
content/base/src/nsContentUtils.cpp
dom/bindings/DOMJSProxyHandler.cpp
dom/bindings/DOMJSProxyHandler.h
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -6282,19 +6282,16 @@ nsContentUtils::ReleaseWrapper(void* aSc
 {
   if (aCache->PreservingWrapper()) {
     // PreserveWrapper puts new DOM bindings in the JS holders hash, but they
     // can also be in the DOM expando hash, so we need to try to remove them
     // from both here.
     JSObject* obj = aCache->GetWrapperPreserveColor();
     if (aCache->IsDOMBinding() && obj && js::IsProxy(obj)) {
         DOMProxyHandler::GetAndClearExpandoObject(obj);
-        if (!aCache->PreservingWrapper()) {
-          return;
-        }
     }
     aCache->SetPreservingWrapper(false);
     DropJSObjects(aScriptObjectHolder);
   }
 }
 
 // static
 int32_t
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -84,22 +84,16 @@ DOMProxyHandler::GetAndClearExpandoObjec
     xpc::GetObjectScope(obj)->RemoveDOMExpandoObject(obj);
   } else {
     js::ExpandoAndGeneration* expandoAndGeneration =
       static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
     v = expandoAndGeneration->expando;
     if (v.isUndefined()) {
       return nullptr;
     }
-
-    nsISupports* native = UnwrapDOMObject<nsISupports>(obj);
-    nsWrapperCache* cache;
-    CallQueryInterface(native, &cache);
-    cache->SetPreservingWrapper(false);
-    nsContentUtils::DropJSObjects(native);
     expandoAndGeneration->expando = UndefinedValue();
   }
 
 
   return &v.toObject();
 }
 
 // static
--- a/dom/bindings/DOMJSProxyHandler.h
+++ b/dom/bindings/DOMJSProxyHandler.h
@@ -65,16 +65,17 @@ public:
       return nullptr;
     }
 
     js::ExpandoAndGeneration* expandoAndGeneration =
       static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
     v = expandoAndGeneration->expando;
     return v.isUndefined() ? nullptr : &v.toObject();
   }
+  /* GetAndClearExpandoObject does not DROP or clear the preserving wrapper flag. */
   static JSObject* GetAndClearExpandoObject(JSObject* obj);
   static JSObject* EnsureExpandoObject(JSContext* cx,
                                        JS::Handle<JSObject*> obj);
 
   const DOMClass& mClass;
 
 protected:
   // Append the property names in "names" to "props". If