Back out 9aac714775b9 (bug 723111) for make check orange
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 01 Feb 2012 10:25:04 -0800
changeset 87487 d7c7ea755e5439e87b57d9d374a52c3e6d04dc8c
parent 87486 f09662d2ba1f435f49df064d6cf259c20aef03b0
child 87488 8c027f9fc62701b78606ac837e06910b9bb233fd
push id975
push userffxbld
push dateTue, 13 Mar 2012 21:39:16 +0000
treeherdermozilla-aurora@99faebf9dc36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs723111
milestone13.0a1
backs out9aac714775b91362f5178ab446d1e2b5501a414a
Back out 9aac714775b9 (bug 723111) for make check orange
js/src/jscompartment.cpp
js/src/jswrapper.cpp
js/src/jswrapper.h
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCWrapper.cpp
js/xpconnect/src/XPCWrapper.h
js/xpconnect/wrappers/AccessCheck.cpp
js/xpconnect/wrappers/WrapperFactory.h
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -211,17 +211,17 @@ JSCompartment::wrap(JSContext *cx, Value
             return true;
 
         /* Translate StopIteration singleton. */
         if (obj->isStopIteration())
             return js_FindClassObject(cx, NULL, JSProto_StopIteration, vp);
 
         /* Don't unwrap an outer window proxy. */
         if (!obj->getClass()->ext.innerObject) {
-            obj = UnwrapObject(&vp->toObject(), true, &flags);
+            obj = UnwrapObject(&vp->toObject(), &flags);
             vp->setObject(*obj);
             if (obj->compartment() == this)
                 return true;
 
             if (cx->runtime->preWrapObjectCallback) {
                 obj = cx->runtime->preWrapObjectCallback(cx, global, obj, flags);
                 if (!obj)
                     return false;
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -71,23 +71,23 @@ Wrapper::getWrapperFamily()
 
 JS_FRIEND_API(bool)
 js::IsWrapper(const JSObject *wrapper)
 {
     return wrapper->isProxy() && GetProxyHandler(wrapper)->family() == &sWrapperFamily;
 }
 
 JS_FRIEND_API(JSObject *)
-js::UnwrapObject(JSObject *wrapped, bool stopAtOuter, uintN *flagsp)
+js::UnwrapObject(JSObject *wrapped, uintN *flagsp)
 {
     uintN flags = 0;
     while (wrapped->isWrapper()) {
         flags |= static_cast<Wrapper *>(GetProxyHandler(wrapped))->flags();
         wrapped = GetProxyPrivate(wrapped).toObjectOrNull();
-        if (stopAtOuter && wrapped->getClass()->ext.innerObject)
+        if (wrapped->getClass()->ext.innerObject)
             break;
     }
     if (flagsp)
         *flagsp = flags;
     return wrapped;
 }
 
 bool
--- a/js/src/jswrapper.h
+++ b/js/src/jswrapper.h
@@ -201,21 +201,14 @@ class JS_FRIEND_API(ForceFrame)
     bool enter();
 };
 
 extern JSObject *
 TransparentObjectWrapper(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSObject *parent,
                          uintN flags);
 
 JS_FRIEND_API(bool) IsWrapper(const JSObject *obj);
-
-// Given a JSObject, returns that object stripped of wrappers. If
-// stopAtOuter is true, then this returns the outer window if it was
-// previously wrapped. Otherwise, this returns the first object for
-// which JSObject::isWrapper returns false.
-JS_FRIEND_API(JSObject *) UnwrapObject(JSObject *obj, bool stopAtOuter = true,
-                                       uintN *flagsp = NULL);
-
+JS_FRIEND_API(JSObject *) UnwrapObject(JSObject *obj, uintN *flagsp = NULL);
 bool IsCrossCompartmentWrapper(const JSObject *obj);
 
 } /* namespace js */
 
 #endif
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1215,17 +1215,17 @@ XPCConvert::JSObject2NativeInterface(XPC
         // wrappedNative or other wise has 'nsISupportness'.
         // This allows wrapJSAggregatedToNative to work.
 
         // If we're looking at a security wrapper, see now if we're allowed to
         // pass it to C++. If we are, then fall through to the code below. If
         // we aren't, throw an exception eagerly.
         JSObject* inner = nsnull;
         if (XPCWrapper::IsSecurityWrapper(src)) {
-            inner = XPCWrapper::Unwrap(cx, src, false);
+            inner = XPCWrapper::Unwrap(cx, src);
             if (!inner) {
                 if (pErr)
                     *pErr = NS_ERROR_XPC_SECURITY_MANAGER_VETO;
                 return false;
             }
         }
 
         // Is this really a native xpcom object with a wrapper?
--- a/js/xpconnect/src/XPCQuickStubs.cpp
+++ b/js/xpconnect/src/XPCQuickStubs.cpp
@@ -783,17 +783,17 @@ nsresult
 getWrapper(JSContext *cx,
            JSObject *obj,
            JSObject *callee,
            XPCWrappedNative **wrapper,
            JSObject **cur,
            XPCWrappedNativeTearOff **tearoff)
 {
     if (XPCWrapper::IsSecurityWrapper(obj) &&
-        !(obj = XPCWrapper::Unwrap(cx, obj, false))) {
+        !(obj = XPCWrapper::Unwrap(cx, obj))) {
         return NS_ERROR_XPC_SECURITY_MANAGER_VETO;
     }
 
     *cur = obj;
     *tearoff = nsnull;
 
     *wrapper =
         XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj, callee, cur,
--- a/js/xpconnect/src/XPCWrapper.cpp
+++ b/js/xpconnect/src/XPCWrapper.cpp
@@ -118,22 +118,22 @@ AttachNewConstructorObject(XPCCallContex
   return JS_DefineFunction(ccx, JS_GetFunctionObject(xpcnativewrapper), "unwrap", UnwrapNW, 1,
                            JSPROP_READONLY | JSPROP_PERMANENT) != nsnull;
 }
 }
 
 namespace XPCWrapper {
 
 JSObject *
-Unwrap(JSContext *cx, JSObject *wrapper, bool stopAtOuter)
+Unwrap(JSContext *cx, JSObject *wrapper)
 {
   if (js::IsWrapper(wrapper)) {
     if (xpc::AccessCheck::isScriptAccessOnly(cx, wrapper))
       return nsnull;
-    return js::UnwrapObject(wrapper, stopAtOuter);
+    return js::UnwrapObject(wrapper);
   }
 
   return nsnull;
 }
 
 JSObject *
 UnsafeUnwrapSecurityWrapper(JSObject *obj)
 {
--- a/js/xpconnect/src/XPCWrapper.h
+++ b/js/xpconnect/src/XPCWrapper.h
@@ -88,17 +88,17 @@ IsSecurityWrapper(JSObject *wrapper)
  * currently running code has permission to access both the wrapper and
  * wrapped object.
  *
  * Since this is meant to be called from functions like
  * XPCWrappedNative::GetWrappedNativeOfJSObject, it does not set an
  * exception on |cx|.
  */
 JSObject *
-Unwrap(JSContext *cx, JSObject *wrapper, bool stopAtOuter = true);
+Unwrap(JSContext *cx, JSObject *wrapper);
 
 JSObject *
 UnsafeUnwrapSecurityWrapper(JSObject *obj);
 
 } // namespace XPCWrapper
 
 
 #endif
--- a/js/xpconnect/wrappers/AccessCheck.cpp
+++ b/js/xpconnect/wrappers/AccessCheck.cpp
@@ -85,32 +85,22 @@ AccessCheck::isSameOrigin(JSCompartment 
     }
 
     return equals;
 }
 
 bool
 AccessCheck::isLocationObjectSameOrigin(JSContext *cx, JSObject *wrapper)
 {
-    // Location objects are parented to the outer window for which they
-    // were created. This gives us an easy way to determine whether our
-    // object is same origin with the current inner window:
-
-    // Grab the outer window...
     JSObject *obj = js::GetObjectParent(js::UnwrapObject(wrapper));
     if (!js::GetObjectClass(obj)->ext.innerObject) {
-        // ...which might be wrapped in a security wrapper.
         obj = js::UnwrapObject(obj);
         JS_ASSERT(js::GetObjectClass(obj)->ext.innerObject);
     }
-
-    // Now innerize it to find the *current* inner window for our outer.
     obj = JS_ObjectToInnerObject(cx, obj);
-
-    // Which lets us compare the current compartment against the old one.
     return obj &&
            (isSameOrigin(js::GetObjectCompartment(wrapper),
                          js::GetObjectCompartment(obj)) ||
             documentDomainMakesSameOrigin(cx, obj));
 }
 
 bool
 AccessCheck::isChrome(JSCompartment *compartment)
@@ -389,17 +379,17 @@ AccessCheck::needsSystemOnlyWrapper(JSOb
 }
 
 bool
 AccessCheck::isScriptAccessOnly(JSContext *cx, JSObject *wrapper)
 {
     JS_ASSERT(js::IsWrapper(wrapper));
 
     uintN flags;
-    JSObject *obj = js::UnwrapObject(wrapper, true, &flags);
+    JSObject *obj = js::UnwrapObject(wrapper, &flags);
 
     // If the wrapper indicates script-only access, we are done.
     if (flags & WrapperFactory::SCRIPT_ACCESS_ONLY_FLAG) {
         if (flags & WrapperFactory::SOW_FLAG)
             return !isSystemOnlyAccessPermitted(cx);
 
         if (flags & WrapperFactory::PARTIALLY_TRANSPARENT)
             return !XrayUtils::IsTransparent(cx, wrapper);
--- a/js/xpconnect/wrappers/WrapperFactory.h
+++ b/js/xpconnect/wrappers/WrapperFactory.h
@@ -48,17 +48,17 @@ class WrapperFactory {
            IS_XRAY_WRAPPER_FLAG    = WAIVE_XRAY_WRAPPER_FLAG << 1,
            SCRIPT_ACCESS_ONLY_FLAG = IS_XRAY_WRAPPER_FLAG << 1,
            PARTIALLY_TRANSPARENT   = SCRIPT_ACCESS_ONLY_FLAG << 1,
            SOW_FLAG                = PARTIALLY_TRANSPARENT << 1 };
 
     // Return true if any of any of the nested wrappers have the flag set.
     static bool HasWrapperFlag(JSObject *wrapper, uintN flag) {
         uintN flags = 0;
-        js::UnwrapObject(wrapper, true, &flags);
+        js::UnwrapObject(wrapper, &flags);
         return !!(flags & flag);
     }
 
     static bool IsXrayWrapper(JSObject *wrapper) {
         return HasWrapperFlag(wrapper, IS_XRAY_WRAPPER_FLAG);
     }
 
     static bool IsPartiallyTransparent(JSObject *wrapper) {