Bug 1298773 - Expose wrappees that may be used through a wrapper r=jonco a=abillings
authorTerrence Cole <terrence@mozilla.com>
Wed, 14 Sep 2016 14:17:46 -0700
changeset 452513 5174502dbfeb1ccfeac35f4c4eaa8eee055c4779
parent 452512 ebb55d6b06fc0c72234c619fc9df1f9c7fd75c03
child 452514 4d147e29f30c9da246d9ecbeb8b778fbd26fd749
push id39418
push userbmo:twointofive@gmail.com
push dateWed, 21 Dec 2016 20:59:30 +0000
reviewersjonco, abillings
bugs1298773
milestone51.0
Bug 1298773 - Expose wrappees that may be used through a wrapper r=jonco a=abillings
js/src/proxy/Wrapper.cpp
--- a/js/src/proxy/Wrapper.cpp
+++ b/js/src/proxy/Wrapper.cpp
@@ -324,17 +324,20 @@ Wrapper::wrapperHandler(JSObject* wrappe
     MOZ_ASSERT(wrapper->is<WrapperObject>());
     return static_cast<const Wrapper*>(wrapper->as<ProxyObject>().handler());
 }
 
 JSObject*
 Wrapper::wrappedObject(JSObject* wrapper)
 {
     MOZ_ASSERT(wrapper->is<WrapperObject>());
-    return wrapper->as<ProxyObject>().target();
+    JSObject* target = wrapper->as<ProxyObject>().target();
+    if (target)
+        JS::ExposeObjectToActiveJS(target);
+    return target;
 }
 
 JS_FRIEND_API(JSObject*)
 js::UncheckedUnwrap(JSObject* wrapped, bool stopAtWindowProxy, unsigned* flagsp)
 {
     unsigned flags = 0;
     while (true) {
         if (!wrapped->is<WrapperObject>() ||