Bug 1162318 - Rooting hazard in WrapNativeParentHelper, r=peterv
authorSteve Fink <sfink@mozilla.com>
Thu, 07 May 2015 09:51:06 -0700
changeset 242891 bfcab00af61f655ae4fabd1234f6cffafa0a77b4
parent 242890 c8ba42a1ce6a6ee73ebefb316f0ca13b36de6971
child 242892 18d25adcfce88d7a0cf69c89a8bab6b653f02323
push id28713
push userkwierso@gmail.com
push dateFri, 08 May 2015 17:06:43 +0000
treeherdermozilla-central@fd5e9b7eec13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1162318
milestone40.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
Bug 1162318 - Rooting hazard in WrapNativeParentHelper, r=peterv
dom/bindings/BindingUtils.h
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -1535,18 +1535,20 @@ struct WrapNativeParentHelper
 template<typename T>
 struct WrapNativeParentHelper<T, false>
 {
   static inline JSObject* Wrap(JSContext* cx, T* parent, nsWrapperCache* cache)
   {
     JSObject* obj;
     if (cache && (obj = cache->GetWrapper())) {
 #ifdef DEBUG
-      NS_ASSERTION(WrapNativeISupportsParent(cx, parent, cache) == obj,
+      JS::Rooted<JSObject*> rootedObj(cx, obj);
+      NS_ASSERTION(WrapNativeISupportsParent(cx, parent, cache) == rootedObj,
                    "Unexpected object in nsWrapperCache");
+      obj = rootedObj;
 #endif
       return obj;
     }
 
     return WrapNativeISupportsParent(cx, parent, cache);
   }
 };