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 324699 48fc404b0637a7315f9960f97b2482530d73cd94
parent 324698 11a5444e54a9ca7864a70c1a5e66f5d6f419a35c
child 324700 19f0a7a2be1425ac8ecede607f29df47471343fc
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjonco, abillings
bugs1298773
milestone53.0a1
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>() ||