org.jvnet.hudson
diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
index 5e467ac483d0e696bf1835439f06a441e5b33a99..5690253cc278be9a3aaf4307403978b00673c8fb 100644
--- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
+++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
@@ -120,6 +120,7 @@ import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.jetty.webapp.WebXmlConfiguration;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextFactory;
+import org.mozilla.javascript.tools.shell.JSConsole;
import org.w3c.css.sac.CSSException;
import org.w3c.css.sac.CSSParseException;
import org.w3c.css.sac.ErrorHandler;
@@ -480,6 +481,22 @@ public abstract class HudsonTestCase extends TestCase {
new BufferedReader(new InputStreamReader(System.in)).readLine();
}
+ /**
+ * Starts an interactive JavaScript debugger, and break at the next JavaScript execution.
+ *
+ *
+ * This is useful during debugging a test so that you can step execute and inspect state of JavaScript.
+ * This will launch a Swing GUI, and the method returns immediately.
+ *
+ *
+ * Note that installing a debugger appears to make an execution of JavaScript substantially slower.
+ */
+ public void interactiveJavaScriptDebugger() {
+ org.mozilla.javascript.tools.debugger.Main.mainEmbedded("Rhino debugger: "+getName());
+ // this can be too late, depending on when this method is invoked.
+ Functions.DEBUG_YUI = true;
+ }
+
/**
* Returns the last item in the list.
*/