Preserve location wrappers with expandos.
authorPeter Van der Beken <peterv@propagandism.org>
Sat, 15 Feb 2014 22:12:34 +0100
changeset 171903 06a96ab749bcb15d99d54f8233e4867056f0ad4b
parent 171902 15f214a30db78cc872c6667a1a88735995d07fe4
child 171904 c81966818719aaacc9fb3e68d629703b827b2de2
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
milestone30.0a1
Preserve location wrappers with expandos.
dom/base/nsDOMClassInfo.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -3487,16 +3487,19 @@ nsLocationSH::AddProperty(nsIXPConnectWr
   // Shadowing protection. This will go away when nsLocation moves to the new
   // bindings.
   JS::Rooted<jsid> id(cx, aId);
   if (wrapper->HasNativeMember(id)) {
     JS_ReportError(cx, "Permission denied to shadow native property");
     return NS_ERROR_FAILURE;
   }
 
+  nsLocation* location = static_cast<nsLocation*>(GetNative(wrapper, obj));
+  location->PreserveWrapper(location);
+
   return NS_OK;
 }
 
 // EventTarget helper
 
 NS_IMETHODIMP
 nsEventTargetSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
                            JSObject *aGlobalObj, JSObject **parentObj)