From 2523b1efe15e80d94744a46283e93453c15ec8e6 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Mon, 16 Apr 2012 11:44:10 -0700 Subject: [PATCH] Bug 723712 - Test for !isCachedEval assertion failure. r=test --HG-- extra : rebase_source : a88931728024e9045947cee4b3e6a5a82030909d --- js/jsd/test/test_evalCached.js | 23 +++++++++++++++++++++++ js/jsd/test/xpcshell.ini | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 js/jsd/test/test_evalCached.js diff --git a/js/jsd/test/test_evalCached.js b/js/jsd/test/test_evalCached.js new file mode 100644 index 00000000000..4c56ef2eaf8 --- /dev/null +++ b/js/jsd/test/test_evalCached.js @@ -0,0 +1,23 @@ +// 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); + + jsd.scriptHook = { + onScriptCreated: function(script) { + // Just the presence of this will trigger the script to be handed + // to JSD and trigger the crash + }, + onScriptDestroyed: function(script) { + } + } + + eval("4+4"); + eval("4+4"); // Will be found in the eval cache +} diff --git a/js/jsd/test/xpcshell.ini b/js/jsd/test/xpcshell.ini index 7c4f5af7024..4681adf46b8 100644 --- a/js/jsd/test/xpcshell.ini +++ b/js/jsd/test/xpcshell.ini @@ -4,3 +4,6 @@ tail = [test_jsval_retval.js] debug = 1 + +[test_evalCached.js] +debug = 1