Bug 1162318 - Rooting hazard in WrapNativeParentHelper, r=peterv
authorSteve Fink <sfink@mozilla.com>
Thu, 07 May 2015 09:51:06 -0700
changeset 274256 bfcab00af61f655ae4fabd1234f6cffafa0a77b4
parent 274255 c8ba42a1ce6a6ee73ebefb316f0ca13b36de6971
child 274257 18d25adcfce88d7a0cf69c89a8bab6b653f02323
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [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);
   }
 };