Bug 650161 - Allow for the possibility that the wrapper cache hasn't been initialized yet when updating it r=bz
authorJon Coppeard <jcoppeard@mozilla.com>
Fri, 03 Oct 2014 10:04:19 +0100
changeset 208560 2424dd8f3da08094b568e2092f6b43b89a25edf1
parent 208559 3aade35d80936c4df6c75dac6838825d02dab0df
child 208561 c5be3f231f6f3903adfce9ab6aaf87362e4f5be6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbz
bugs650161
milestone35.0a1
Bug 650161 - Allow for the possibility that the wrapper cache hasn't been initialized yet when updating it r=bz
dom/base/nsWrapperCache.h
--- a/dom/base/nsWrapperCache.h
+++ b/dom/base/nsWrapperCache.h
@@ -118,18 +118,20 @@ public:
   /**
    * Update the wrapper if the object it contains is moved.
    *
    * This method must be called from the objectMovedOp class extension hook for
    * any wrapper cached object.
    */
   void UpdateWrapper(JSObject* aNewObject, const JSObject* aOldObject)
   {
-    MOZ_ASSERT(mWrapper == aOldObject);
-    mWrapper = aNewObject;
+    if (mWrapper) {
+      MOZ_ASSERT(mWrapper == aOldObject);
+      mWrapper = aNewObject;
+    }
   }
 
   bool PreservingWrapper()
   {
     return HasWrapperFlag(WRAPPER_BIT_PRESERVED);
   }
 
   void SetIsDOMBinding()