Backed out 3 changesets (bug 851895) for Windows debug bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 21 Mar 2013 15:24:04 -0400
changeset 125795 55a5bbf32adbeda5bc73c529f162fc531f08c35e
parent 125794 0174ae8897f8f425033a711499528e6e8d20695d
child 125796 b53685d06c8deb7d34910ff9f9c8a5d45fbc8090
push id25108
push userryanvm@gmail.com
push dateThu, 21 Mar 2013 19:25:14 +0000
treeherdermozilla-inbound@de90200c61e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs851895
milestone22.0a1
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 3 changesets (bug 851895) for Windows debug bustage.
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/tests/unit/test_bug851895.js
js/xpconnect/tests/unit/xpcshell.ini
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2205,16 +2205,21 @@ XPCWrappedNative::CallMethod(XPCCallCont
                              CallMode mode /*= CALL_METHOD */)
 {
     XPCContext* xpcc = ccx.GetXPCContext();
     NS_ASSERTION(xpcc->CallerTypeIsJavaScript(),
                  "Native caller for XPCWrappedNative::CallMethod?");
 
     nsresult rv = ccx.CanCallNow();
     if (NS_FAILED(rv)) {
+        // If the security manager is complaining then this is not really an
+        // internal error in xpconnect. So, no reason to botch the assertion.
+        NS_ASSERTION(rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO,
+                     "hmm? CanCallNow failed in XPCWrappedNative::CallMethod. "
+                     "We are finding out about this late!");
         return Throw(rv, ccx);
     }
 
     DEBUG_TrackWrapperCall(ccx.GetWrapper(), mode);
 
     // set up the method index and do the security check if needed
 
     uint32_t secFlag;
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -1394,34 +1394,24 @@ XPCNativeScriptableShared::PopulateJSCla
 // a proper |this|. So, if it's quite clear that we're in this situation and
 // about to use a |this| argument that just won't work, fix things up.
 //
 // This hack is only useful for getters/setters if someone sets an XPCOM object
 // as the prototype for a vanilla JS object and expects the XPCOM attributes to
 // work on the derived object, which we really don't want to support. But we
 // handle it anyway, for now, to minimize regression risk on an already-risky
 // landing.
-//
-// This hack is mainly useful for the NoHelper JSClass. We also fix up
-// Components.utils because it implements nsIXPCScriptable (giving it a custom
-// JSClass) but not nsIClassInfo (which would put the methods on a prototype).
-
-#define IS_NOHELPER_CLASS(clasp) (clasp == &XPC_WN_NoHelper_JSClass.base)
-#define IS_CU_CLASS(clasp) (clasp->name[0] == 'n' && !strcmp(clasp->name, "nsXPCComponents_Utils"))
-
 MOZ_ALWAYS_INLINE JSObject*
 FixUpThisIfBroken(JSObject *obj, JSObject *funobj)
 {
-    if (funobj) {
-        js::Class *parentClass = js::GetObjectClass(js::GetObjectParent(funobj));
-        if (MOZ_UNLIKELY((IS_NOHELPER_CLASS(parentClass) || IS_CU_CLASS(parentClass)) &&
-                         (js::GetObjectClass(obj) != parentClass)))
-        {
-            return js::GetObjectParent(funobj);
-        }
+    if (MOZ_UNLIKELY(funobj &&
+        (js::GetObjectClass(js::GetObjectParent(funobj)) == &XPC_WN_NoHelper_JSClass.base) &&
+        (js::GetObjectClass(obj) != &XPC_WN_NoHelper_JSClass.base)))
+    {
+        return js::GetObjectParent(funobj);
     }
     return obj;
 }
 
 JSBool
 XPC_WN_CallMethod(JSContext *cx, unsigned argc, jsval *vp)
 {
     NS_ASSERTION(JS_TypeOfValue(cx, JS_CALLEE(cx, vp)) == JSTYPE_FUNCTION, "bad function");
deleted file mode 100644
--- a/js/xpconnect/tests/unit/test_bug851895.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const Cu = Components.utils;
-
-function run_test() {
-  // Make sure Components.utils gets its |this| fixed up.
-  var isXrayWrapper = Components.utils.isXrayWrapper;
-  do_check_true(!isXrayWrapper({}), "Didn't throw");
-
-  // Even for classes without |this| fixup, make sure that we don't crash.
-  var isSuccessCode = Components.isSuccessCode;
-  try { isSuccessCode(Components.results.NS_OK); } catch (e) {};
-}
--- a/js/xpconnect/tests/unit/xpcshell.ini
+++ b/js/xpconnect/tests/unit/xpcshell.ini
@@ -13,17 +13,16 @@ tail =
 [test_bug711404.js]
 [test_bug778409.js]
 [test_bug780370.js]
 [test_bug805807.js]
 [test_bug809652.js]
 [test_bug813901.js]
 [test_bug845201.js]
 [test_bug849730.js]
-[test_bug851895.js]
 [test_bug_442086.js]
 [test_file.js]
 [test_blob.js]
 [test_import.js]
 [test_import_fail.js]
 [test_js_weak_references.js]
 [test_reflect_parse.js]
 [test_localeCompare.js]