Bug 1162318 - Rooting hazard in WrapNativeParentHelper, r=peterv
authorSteve Fink <sfink@mozilla.com>
Thu, 07 May 2015 09:51:06 -0700
changeset 272731 bfcab00af61f655ae4fabd1234f6cffafa0a77b4
parent 272730 c8ba42a1ce6a6ee73ebefb316f0ca13b36de6971
child 272732 18d25adcfce88d7a0cf69c89a8bab6b653f02323
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [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);
   }
 };