Backed out changeset 4ef990c3d69d (bug 1131803) for potentially busting mochitest-e10s-dt on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 26 Feb 2015 23:20:33 -0800
changeset 231117 351ff671a30106a8f4aea581997da1e5af2c44ba
parent 231116 5dac945cae321bf7da54f6ca830d995fd4758906
child 231118 68df163b1792131fe2541fdc70eae75895d48b2a
push id28344
push userryanvm@gmail.com
push dateFri, 27 Feb 2015 18:20:08 +0000
treeherdermozilla-central@9dd9d1e5b43c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1131803
milestone39.0a1
backs out4ef990c3d69d31c78253b6c4125aa5b46533f238
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
Backed out changeset 4ef990c3d69d (bug 1131803) for potentially busting mochitest-e10s-dt on a CLOSED TREE
js/xpconnect/src/Sandbox.cpp
js/xpconnect/wrappers/XrayWrapper.h
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -573,25 +573,24 @@ xpc::IsSandboxPrototypeProxy(JSObject *o
 }
 
 bool
 xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle<JSObject*> proxy,
                                        const JS::CallArgs &args) const
 {
     // We forward the call to our underlying callable.
 
-    // Get our SandboxProxyHandler proxy.
-    RootedObject sandboxProxy(cx, getSandboxProxy(proxy));
+    // The parent of our proxy is the SandboxProxyHandler proxy
+    RootedObject sandboxProxy(cx, JS_GetParent(proxy));
     MOZ_ASSERT(js::IsProxy(sandboxProxy) &&
                js::GetProxyHandler(sandboxProxy) == &xpc::sandboxProxyHandler);
 
-    // The global of the sandboxProxy is the sandbox global, and the
+    // The parent of the sandboxProxy is the sandbox global, and the
     // target object is the original proto.
-    RootedObject sandboxGlobal(cx,
-      js::GetGlobalForObjectCrossCompartment(sandboxProxy));
+    RootedObject sandboxGlobal(cx, JS_GetParent(sandboxProxy));
     MOZ_ASSERT(IsSandbox(sandboxGlobal));
 
     // If our this object is the sandbox global, we call with this set to the
     // original proto instead.
     //
     // There are two different ways we can compute |this|. If we use
     // JS_THIS_VALUE, we'll get the bonafide |this| value as passed by the
     // caller, which may be undefined if a global function was invoked without
@@ -634,31 +633,26 @@ const xpc::SandboxCallableProxyHandler x
  * Wrap a callable such that if we're called with oldThisObj as the
  * "this" we will instead call it with newThisObj as the this.
  */
 static JSObject*
 WrapCallable(JSContext *cx, HandleObject callable, HandleObject sandboxProtoProxy)
 {
     MOZ_ASSERT(JS::IsCallable(callable));
     // Our proxy is wrapping the callable.  So we need to use the
-    // callable as the private.  We put the given sandboxProtoProxy in
-    // an extra slot,, and our call() hook depends on that.
+    // callable as the private.  We use the given sandboxProtoProxy as
+    // the parent, and our call() hook depends on that.
     MOZ_ASSERT(js::IsProxy(sandboxProtoProxy) &&
                js::GetProxyHandler(sandboxProtoProxy) ==
                  &xpc::sandboxProxyHandler);
 
     RootedValue priv(cx, ObjectValue(*callable));
-    JSObject *obj = js::NewProxyObject(cx, &xpc::sandboxCallableProxyHandler,
-                                       priv, nullptr, nullptr);
-    if (obj) {
-        js::SetProxyExtra(obj, SandboxCallableProxyHandler::SandboxProxySlot,
-                          ObjectValue(*sandboxProtoProxy));
-    }
-
-    return obj;
+    return js::NewProxyObject(cx, &xpc::sandboxCallableProxyHandler,
+                              priv, nullptr,
+                              sandboxProtoProxy);
 }
 
 template<typename Op>
 bool WrapAccessorFunction(JSContext *cx, Op &op, JSPropertyDescriptor *desc,
                           unsigned attrFlag, HandleObject sandboxProtoProxy)
 {
     if (!op) {
         return true;
@@ -967,17 +961,17 @@ xpc::CreateSandboxObject(JSContext *cx, 
             JSObject *unwrappedProto = js::UncheckedUnwrap(options.proto, false);
             const js::Class *unwrappedClass = js::GetObjectClass(unwrappedProto);
             if (IS_WN_CLASS(unwrappedClass) ||
                 mozilla::dom::IsDOMClass(Jsvalify(unwrappedClass))) {
                 // Wrap it up in a proxy that will do the right thing in terms
                 // of this-binding for methods.
                 RootedValue priv(cx, ObjectValue(*options.proto));
                 options.proto = js::NewProxyObject(cx, &xpc::sandboxProxyHandler,
-                                                   priv, nullptr, nullptr);
+                                                   priv, nullptr, sandbox);
                 if (!options.proto)
                     return NS_ERROR_OUT_OF_MEMORY;
             }
 
             ok = JS_SetPrototype(cx, sandbox, options.proto);
             if (!ok)
                 return NS_ERROR_XPC_UNEXPECTED;
         }
--- a/js/xpconnect/wrappers/XrayWrapper.h
+++ b/js/xpconnect/wrappers/XrayWrapper.h
@@ -7,17 +7,16 @@
 #ifndef XrayWrapper_h
 #define XrayWrapper_h
 
 #include "mozilla/Attributes.h"
 
 #include "WrapperFactory.h"
 
 #include "jswrapper.h"
-#include "js/Proxy.h"
 
 // Xray wrappers re-resolve the original native properties on the native
 // object and always directly access to those properties.
 // Because they work so differently from the rest of the wrapper hierarchy,
 // we pull them out of the Wrapper inheritance hierarchy and create a
 // little world around them.
 
 class nsIPrincipal;
@@ -522,23 +521,16 @@ extern const SandboxProxyHandler sandbox
 class SandboxCallableProxyHandler : public js::Wrapper {
 public:
     MOZ_CONSTEXPR SandboxCallableProxyHandler() : js::Wrapper(0)
     {
     }
 
     virtual bool call(JSContext *cx, JS::Handle<JSObject*> proxy,
                       const JS::CallArgs &args) const MOZ_OVERRIDE;
-
-    static const size_t SandboxProxySlot = 0;
-
-    static inline JSObject *getSandboxProxy(JS::Handle<JSObject*> proxy)
-    {
-        return &js::GetProxyExtra(proxy, SandboxProxySlot).toObject();
-    }
 };
 
 extern const SandboxCallableProxyHandler sandboxCallableProxyHandler;
 
 class AutoSetWrapperNotShadowing;
 
 }