Fix test jit-test/tests/debug/Debug-ctor-03.js: only expect new Debug(parent) to fail if parent really cannot be put into debug mode.
authorJason Orendorff <jorendorff@mozilla.com>
Tue, 28 Jun 2011 18:08:49 -0500
changeset 74491 63ee1fe5025c99e88e20847e1e533d2af9117cb8
parent 74490 45f1cf2c59d200bc5e5db35001eed68d9a466a13
child 74492 ba9d8b33753c45c21443be2d78ef2348ffe58395
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone7.0a1
Fix test jit-test/tests/debug/Debug-ctor-03.js: only expect new Debug(parent) to fail if parent really cannot be put into debug mode.
js/src/jit-test/tests/debug/Debug-ctor-03.js
--- a/js/src/jit-test/tests/debug/Debug-ctor-03.js
+++ b/js/src/jit-test/tests/debug/Debug-ctor-03.js
@@ -1,6 +1,19 @@
 // If the debuggee cannot be put into debug mode, throw.
-var g = newGlobal('new-compartment');
-g.libdir = libdir;
-g.eval("load(libdir + 'asserts.js');");
-g.parent = this;
-g.eval("assertThrowsInstanceOf(function () { new Debug(parent); }, Error);");
+
+// Run this test only if this compartment can't be put into debug mode.
+var canEnable = true;
+if (typeof setDebugMode === 'function') {
+    try {
+	setDebugMode(true);
+    } catch (exc) {
+	canEnable = false;
+    }
+}
+
+if (!canEnable) {
+    var g = newGlobal('new-compartment');
+    g.libdir = libdir;
+    g.eval("load(libdir + 'asserts.js');");
+    g.parent = this;
+    g.eval("assertThrowsInstanceOf(function () { new Debug(parent); }, Error);");
+}