Backout 212d9fcab778, 67c738a47561, a5cdc792975d, 6538d5d3c8d4 since suspects for OSX64 m-oth permaorange
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 13 Oct 2011 12:44:31 +0200
changeset 79312 e647b9874e25f367eddd01921f02d14a6dc24e31
parent 79311 22f7fdf1512ba88f3af3c2b3f9da7f0a4107bf69
child 79313 d6d3a1f90e2e237158d4ad25883a95b95422c1d8
child 79331 ac13dbf11d2417002384bcb292d787d10e4ab148
push idunknown
push userunknown
push dateunknown
milestone10.0a1
backs out212d9fcab778bd5bf4fa89e6cc2a988047973ab7
Backout 212d9fcab778, 67c738a47561, a5cdc792975d, 6538d5d3c8d4 since suspects for OSX64 m-oth permaorange
js/jsd/Makefile.in
js/jsd/test/test_jsval_retval.js
js/jsd/test/xpcshell.ini
js/src/jsapi-tests/Makefile.in
js/src/jsapi-tests/testValueABI.cpp
js/src/jsapi-tests/valueABI.c
js/src/jsapi.h
js/src/xpconnect/shell/xpcshell.cpp
js/src/xpconnect/src/nsXPConnect.cpp
js/src/xpconnect/src/xpcprivate.h
js/src/xpconnect/src/xpcpublic.h
testing/xpcshell/runxpcshelltests.py
testing/xpcshell/xpcshell.ini
--- a/js/jsd/Makefile.in
+++ b/js/jsd/Makefile.in
@@ -37,31 +37,29 @@
 # ***** END LICENSE BLOCK *****
 
 
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 VPATH		= @srcdir@
 srcdir		= @srcdir@
-relativesrcdir  = js/jsd
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= jsdebug
 LIBRARY_NAME	= jsd
 DIRS	= idl
 CPPSRCS	 = jsd_xpc.cpp
 IS_COMPONENT = 1
 LIBXUL_LIBRARY = 1
 
 MODULE_NAME = JavaScript_Debugger
 EXPORT_LIBRARY = 1
 
-XPCSHELL_TESTS  = test
 
 # REQUIRES	= java js
 
 EXPORTS		= jsdebug.h
 
 ifdef JS_THREADSAFE
 DEFINES         += -DJS_THREADSAFE
 endif
deleted file mode 100644
--- a/js/jsd/test/test_jsval_retval.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Bug 689101 - if the binary layout of jsval does not match between C and C++
-// code, then calls to functions returning jsval may get compiled differently
-// than the callee, resulting in parameters being shifted over by one.
-//
-// An example is where on Windows, calling jsdValue.getWrappedValue() will
-// return a random floating point number instead of an object.
-//
-// This test must be run with debugging already enabled
-
-function run_test() {
-    const Cc = Components.classes;
-    const Ci = Components.interfaces;
-    const DebuggerService = Cc["@mozilla.org/js/jsd/debugger-service;1"];
-    const jsdIDebuggerService = Ci.jsdIDebuggerService;
-    var jsd = DebuggerService.getService(jsdIDebuggerService);
-
-    do_check_true(jsd.isOn);
-
-    var n = 0;
-    function f() {
-        n++;
-    }
-
-    jsd.enumerateScripts({ enumerateScript: function(script) {
-        script.setBreakpoint(0);
-    } });
-
-    jsd.breakpointHook = function(frame, type, dummy) {
-        var scope = frame.scope;
-        var parent = scope.jsParent; // Probably does not need to be called
-        var wrapped = scope.getWrappedValue();
-        // Do not try to print 'wrapped'; it may be an internal Call object
-        // that will crash when you toString it. Different bug.
-        do_check_eq(typeof(wrapped), "object");
-        return Ci.jsdIExecutionHook.RETURN_CONTINUE;
-    };
-
-    f();
-}
deleted file mode 100644
--- a/js/jsd/test/xpcshell.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-head =
-tail =
-
-[test_jsval_retval.js]
-debug = 1
--- a/js/src/jsapi-tests/Makefile.in
+++ b/js/src/jsapi-tests/Makefile.in
@@ -82,24 +82,20 @@ CPPSRCS = \
   testScriptInfo.cpp \
   testScriptObject.cpp \
   testSetProperty.cpp \
   testStringBuffer.cpp \
   testThreadGC.cpp \
   testThreads.cpp \
   testTrap.cpp \
   testUTF8.cpp \
-  testValueABI.cpp \
   testVersion.cpp \
   testXDR.cpp \
   $(NULL)
 
-CSRCS = \
-  valueABI.c
-
 # Disabled: an entirely unrelated test seems to cause this to fail.  Moreover,
 # given the test's dependence on interactions between the compiler, the GC, and
 # conservative stack scanning, the fix isn't obvious: more investigation
 # needed.
 #CPPSRCS += \
 #  testRegExpInstanceProperties.cpp \
 #  $(NULL)
 
deleted file mode 100644
--- a/js/src/jsapi-tests/testValueABI.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "tests.h"
-
-/*
- * Bug 689101 - jsval is technically a non-POD type because it has a private
- * data member. On gcc, this doesn't seem to matter. On MSVC, this prevents
- * returning a jsval from a function between C and C++ because it will use a
- * retparam in C++ and a direct return value in C.
- */
-
-extern "C" {
-
-extern JSBool
-C_ValueToObject(JSContext *cx, jsval v, JSObject **obj);
-
-extern jsval
-C_GetEmptyStringValue(JSContext *cx);
-
-}
-
-BEGIN_TEST(testValueABI)
-{
-    JSObject* obj = JS_GetGlobalObject(cx);
-    jsval v = OBJECT_TO_JSVAL(obj);
-    obj = NULL;
-    CHECK(C_ValueToObject(cx, v, &obj));
-    JSBool equal;
-    CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal));
-    CHECK(equal);
-
-    v = C_GetEmptyStringValue(cx);
-    CHECK(JSVAL_IS_STRING(v));
-
-    return true;
-}
-END_TEST(testValueABI)
deleted file mode 100644
--- a/js/src/jsapi-tests/valueABI.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "jsapi.h"
-
-JSBool C_ValueToObject(JSContext *cx, jsval v, JSObject **obj)
-{
-    return JS_ValueToObject(cx, v, obj);
-}
-
-jsval
-C_GetEmptyStringValue(JSContext *cx)
-{
-    return JS_GetEmptyStringValue(cx);
-}
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -658,35 +658,27 @@ class Value
     const size_t *payloadWord() const {
 #if JS_BITS_PER_WORD == 32
         return &data.s.payload.word;
 #elif JS_BITS_PER_WORD == 64
         return &data.asWord;
 #endif
     }
 
-#ifndef _MSC_VER
-  /* To make jsval binary compatible when linking across C and C++ with MSVC,
-   * JS::Value needs to be POD. Otherwise, jsval will be passed in memory
-   * in C++ but by value in C (bug 645111).
-   */
-  private:
-#endif
-
-    jsval_layout data;
-
   private:
     void staticAssertions() {
         JS_STATIC_ASSERT(sizeof(JSValueType) == 1);
         JS_STATIC_ASSERT(sizeof(JSValueTag) == 4);
         JS_STATIC_ASSERT(sizeof(JSBool) == 4);
         JS_STATIC_ASSERT(sizeof(JSWhyMagic) <= 4);
         JS_STATIC_ASSERT(sizeof(Value) == 8);
     }
 
+    jsval_layout data;
+
     friend jsval_layout (::JSVAL_TO_IMPL)(Value);
     friend Value (::IMPL_TO_JSVAL)(jsval_layout l);
 } JSVAL_ALIGNMENT;
 
 /************************************************************************/
 
 static JS_ALWAYS_INLINE Value
 NullValue()
--- a/js/src/xpconnect/shell/xpcshell.cpp
+++ b/js/src/xpconnect/shell/xpcshell.cpp
@@ -1220,19 +1220,16 @@ ProcessArgs(JSContext *cx, JSObject *obj
         case 'S':
             JS_ToggleOptions(cx, JSOPTION_WERROR);
         case 's':
             JS_ToggleOptions(cx, JSOPTION_STRICT);
             break;
         case 'x':
             JS_ToggleOptions(cx, JSOPTION_XML);
             break;
-        case 'd':
-            xpc_ActivateDebugMode();
-            break;
         case 'P':
             if (JS_GET_CLASS(cx, JS_GetPrototype(cx, obj)) != &global_class) {
                 JSObject *gobj;
 
                 if (!JS_DeepFreezeObject(cx, obj))
                     return JS_FALSE;
                 gobj = JS_NewGlobalObject(cx, &global_class);
                 if (!gobj || !JS_SplicePrototype(cx, gobj, obj))
--- a/js/src/xpconnect/src/nsXPConnect.cpp
+++ b/js/src/xpconnect/src/nsXPConnect.cpp
@@ -2656,24 +2656,16 @@ fail:
      * always safe to turn debug mode off, since DeactivateDebugger prevents
      * debugger callbacks from having any effect.
      */
     if (gDesiredDebugMode)
         JS_SetRuntimeDebugMode(rt, JS_FALSE);
     gDesiredDebugMode = gDebugMode = JS_FALSE;
 }
 
-NS_EXPORT_(void)
-xpc_ActivateDebugMode()
-{
-    XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
-    nsXPConnect::GetXPConnect()->SetDebugModeWhenPossible(true);
-    nsXPConnect::CheckForDebugMode(rt->GetJSRuntime());
-}
-
 /* JSContext Pop (); */
 NS_IMETHODIMP
 nsXPConnect::Pop(JSContext * *_retval)
 {
     XPCPerThreadData* data = XPCPerThreadData::GetData(nsnull);
 
     if(!data)
     {
--- a/js/src/xpconnect/src/xpcprivate.h
+++ b/js/src/xpconnect/src/xpcprivate.h
@@ -575,18 +575,16 @@ public:
                                     bool showThisProps);
 
 
     static bool ReportAllJSExceptions()
     {
       return gReportAllJSExceptions > 0;
     }
 
-    static void CheckForDebugMode(JSRuntime *rt);
-
 protected:
     nsXPConnect();
 
 private:
     static PRThread* FindMainThread();
 
 private:
     // Singleton instance
@@ -606,16 +604,17 @@ private:
 
     typedef nsBaseHashtable<nsVoidPtrHashKey, nsISupports*, nsISupports*> ScopeSet;
     ScopeSet mScopes;
     nsCOMPtr<nsIXPCScriptable> mBackstagePass;
 
     static PRUint32 gReportAllJSExceptions;
     static JSBool gDebugMode;
     static JSBool gDesiredDebugMode;
+    static inline void CheckForDebugMode(JSRuntime *rt);
 
 public:
     static nsIScriptSecurityManager *gScriptSecurityManager;
 };
 
 /***************************************************************************/
 
 class XPCRootSetElem
--- a/js/src/xpconnect/src/xpcpublic.h
+++ b/js/src/xpconnect/src/xpcpublic.h
@@ -177,21 +177,16 @@ xpc_UnmarkGrayObjectRecursive(JSObject* 
 // be reached through it.
 inline void
 xpc_UnmarkGrayObject(JSObject *obj)
 {
     if(obj && xpc_IsGrayGCThing(obj))
         xpc_UnmarkGrayObjectRecursive(obj);
 }
 
-// No JS can be on the stack when this is called. Probably only useful from
-// xpcshell.
-NS_EXPORT_(void)
-xpc_ActivateDebugMode();
-
 class nsIMemoryMultiReporterCallback;
 
 namespace mozilla {
 namespace xpconnect {
 namespace memory {
 
 struct CompartmentStats
 {
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -497,25 +497,21 @@ class XPCShellTests(object):
 
       # create a temp dir that the JS harness can stick a profile in
       self.profileDir = self.setupProfileDir()
       self.leakLogFile = self.setupLeakLogging()
 
       # The test file will have to be loaded after the head files.
       cmdT = self.buildCmdTestFile(name)
 
-      args = self.xpcsRunArgs
-      if 'debug' in test:
-          args.insert(0, '-d')
-
       try:
         self.log.info("TEST-INFO | %s | running test ..." % name)
         startTime = time.time()
 
-        proc = self.launchProcess(cmdH + cmdT + args,
+        proc = self.launchProcess(cmdH + cmdT + self.xpcsRunArgs,
                     stdout=pStdout, stderr=pStderr, env=self.env, cwd=testdir)
 
         # Allow user to kill hung subprocess with SIGINT w/o killing this script
         # - don't move this line above launchProcess, or child will inherit the SIG_IGN
         signal.signal(signal.SIGINT, markGotSIGINT)
         # |stderr == None| as |pStderr| was either |None| or redirected to |stdout|.
         stdout, stderr = self.communicate(proc)
         signal.signal(signal.SIGINT, signal.SIG_DFL)
--- a/testing/xpcshell/xpcshell.ini
+++ b/testing/xpcshell/xpcshell.ini
@@ -42,17 +42,16 @@ skip-if = os == "android"
 [include:xpcom/tests/unit/xpcshell.ini]
 [include:modules/libpref/test/unit/xpcshell.ini]
 [include:intl/strres/tests/unit/xpcshell.ini]
 [include:intl/unicharutil/tests/unit/xpcshell.ini]
 [include:intl/uconv/tests/unit/xpcshell.ini]
 [include:netwerk/test/unit/xpcshell.ini]
 [include:netwerk/test/httpserver/test/xpcshell.ini]
 [include:js/ductwork/debugger/tests/xpcshell.ini]
-[include:js/jsd/test/xpcshell.ini]
 [include:js/jetpack/tests/unit/xpcshell.ini]
 [include:js/src/xpconnect/tests/unit/xpcshell.ini]
 [include:modules/libjar/test/unit/xpcshell.ini]
 [include:extensions/cookie/test/unit/xpcshell.ini]
 [include:storage/test/unit/xpcshell.ini]
 [include:rdf/tests/unit/xpcshell.ini]
 [include:gfx/tests/unit/xpcshell.ini]
 [include:widget/tests/unit/xpcshell.ini]