aboutsummaryrefslogtreecommitdiffstats
path: root/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app')
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/jsUnitStyle.css50
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/readme10
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/emptyPage.html11
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitCore.js534
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitMockTimeout.js81
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestManager.js705
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestSuite.js44
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTracer.js102
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitVersionCheck.js59
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-errors.html12
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-failures.html13
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-runs.html13
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts.html21
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-data.html189
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-errors.html23
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-frame.html19
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-loader.html45
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-progress.html25
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-results.html67
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-status.html13
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainer.html16
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainerController.html77
-rw-r--r--tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/xbDebug.js306
23 files changed, 2435 insertions, 0 deletions
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/jsUnitStyle.css b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/jsUnitStyle.css
new file mode 100644
index 0000000..358bffe
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/jsUnitStyle.css
@@ -0,0 +1,50 @@
+body {
+ margin-top: 0;
+ margin-bottom: 0;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ color: #000;
+ font-size: 0.8em;
+ background-color: #fff;
+}
+
+a:link, a:visited {
+ color: #00F;
+}
+
+a:hover {
+ color: #F00;
+}
+
+h1 {
+ font-size: 1.2em;
+ font-weight: bold;
+ color: #039;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+h2 {
+ font-weight: bold;
+ color: #039;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+h3 {
+ font-weight: bold;
+ color: #039;
+ text-decoration: underline;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+h4 {
+ font-weight: bold;
+ color: #039;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+}
+
+.jsUnitTestResultSuccess {
+ color: #000;
+}
+
+.jsUnitTestResultNotSuccess {
+ color: #F00;
+} \ No newline at end of file
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/readme b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/readme
new file mode 100644
index 0000000..f722210
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/css/readme
@@ -0,0 +1,10 @@
+this file is required due to differences in behavior between Mozilla/Opera
+and Internet Explorer.
+
+main-data.html calls kickOffTests() which calls top.testManager.start()
+in the top most frame. top.testManager.start() initializes the output
+frames using document.write and HTML containing a relative <link> to the
+jsUnitStyle.css file. In MSIE, the base href used to find the CSS file is
+that of the top level frame however in Mozilla/Opera the base href is
+that of main-data.html. This leads to not-found for the jsUnitStyle.css
+in Mozilla/Opera. Creating app/css/jsUnitStyle.css works around this problem.
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/emptyPage.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/emptyPage.html
new file mode 100644
index 0000000..f9729dc
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/emptyPage.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>emptyPage</title>
+</head>
+
+<body>
+</body>
+</html>
+
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitCore.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitCore.js
new file mode 100644
index 0000000..438513e
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitCore.js
@@ -0,0 +1,534 @@
+var JSUNIT_UNDEFINED_VALUE;
+var JSUNIT_VERSION = 2.2;
+var isTestPageLoaded = false;
+
+//hack for NS62 bug
+function jsUnitFixTop() {
+ var tempTop = top;
+ if (!tempTop) {
+ tempTop = window;
+ while (tempTop.parent) {
+ tempTop = tempTop.parent;
+ if (tempTop.top && tempTop.top.jsUnitTestSuite) {
+ tempTop = tempTop.top;
+ break;
+ }
+ }
+ }
+ try {
+ window.top = tempTop;
+ } catch (e) {
+ }
+}
+
+jsUnitFixTop();
+
+/**
+ + * A more functional typeof
+ + * @param Object o
+ + * @return String
+ + */
+function _trueTypeOf(something) {
+ var result = typeof something;
+ try {
+ switch (result) {
+ case 'string':
+ case 'boolean':
+ case 'number':
+ break;
+ case 'object':
+ case 'function':
+ switch (something.constructor)
+ {
+ case String:
+ result = 'String';
+ break;
+ case Boolean:
+ result = 'Boolean';
+ break;
+ case Number:
+ result = 'Number';
+ break;
+ case Array:
+ result = 'Array';
+ break;
+ case RegExp:
+ result = 'RegExp';
+ break;
+ case Function:
+ result = 'Function';
+ break;
+ default:
+ var m = something.constructor.toString().match(/function\s*([^( ]+)\(/);
+ if (m)
+ result = m[1];
+ else
+ break;
+ }
+ break;
+ }
+ }
+ finally {
+ result = result.substr(0, 1).toUpperCase() + result.substr(1);
+ return result;
+ }
+}
+
+function _displayStringForValue(aVar) {
+ var result = '<' + aVar + '>';
+ if (!(aVar === null || aVar === top.JSUNIT_UNDEFINED_VALUE)) {
+ result += ' (' + _trueTypeOf(aVar) + ')';
+ }
+ return result;
+}
+
+function fail(failureMessage) {
+ throw new JsUnitException("Call to fail()", failureMessage);
+}
+
+function error(errorMessage) {
+ var errorObject = new Object();
+ errorObject.description = errorMessage;
+ errorObject.stackTrace = getStackTrace();
+ throw errorObject;
+}
+
+function argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) {
+ return args.length == expectedNumberOfNonCommentArgs + 1;
+}
+
+function commentArg(expectedNumberOfNonCommentArgs, args) {
+ if (argumentsIncludeComments(expectedNumberOfNonCommentArgs, args))
+ return args[0];
+
+ return null;
+}
+
+function nonCommentArg(desiredNonCommentArgIndex, expectedNumberOfNonCommentArgs, args) {
+ return argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) ?
+ args[desiredNonCommentArgIndex] :
+ args[desiredNonCommentArgIndex - 1];
+}
+
+function _validateArguments(expectedNumberOfNonCommentArgs, args) {
+ if (!( args.length == expectedNumberOfNonCommentArgs ||
+ (args.length == expectedNumberOfNonCommentArgs + 1 && typeof(args[0]) == 'string') ))
+ error('Incorrect arguments passed to assert function');
+}
+
+function _assert(comment, booleanValue, failureMessage) {
+ if (!booleanValue)
+ throw new JsUnitException(comment, failureMessage);
+}
+
+function assert() {
+ _validateArguments(1, arguments);
+ var booleanValue = nonCommentArg(1, 1, arguments);
+
+ if (typeof(booleanValue) != 'boolean')
+ error('Bad argument to assert(boolean)');
+
+ _assert(commentArg(1, arguments), booleanValue === true, 'Call to assert(boolean) with false');
+}
+
+function assertTrue() {
+ _validateArguments(1, arguments);
+ var booleanValue = nonCommentArg(1, 1, arguments);
+
+ if (typeof(booleanValue) != 'boolean')
+ error('Bad argument to assertTrue(boolean)');
+
+ _assert(commentArg(1, arguments), booleanValue === true, 'Call to assertTrue(boolean) with false');
+}
+
+function assertFalse() {
+ _validateArguments(1, arguments);
+ var booleanValue = nonCommentArg(1, 1, arguments);
+
+ if (typeof(booleanValue) != 'boolean')
+ error('Bad argument to assertFalse(boolean)');
+
+ _assert(commentArg(1, arguments), booleanValue === false, 'Call to assertFalse(boolean) with true');
+}
+
+function assertEquals() {
+ _validateArguments(2, arguments);
+ var var1 = nonCommentArg(1, 2, arguments);
+ var var2 = nonCommentArg(2, 2, arguments);
+ _assert(commentArg(2, arguments), var1 === var2, 'Expected ' + _displayStringForValue(var1) + ' but was ' + _displayStringForValue(var2));
+}
+
+function assertNotEquals() {
+ _validateArguments(2, arguments);
+ var var1 = nonCommentArg(1, 2, arguments);
+ var var2 = nonCommentArg(2, 2, arguments);
+ _assert(commentArg(2, arguments), var1 !== var2, 'Expected not to be ' + _displayStringForValue(var2));
+}
+
+function assertNull() {
+ _validateArguments(1, arguments);
+ var aVar = nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar === null, 'Expected ' + _displayStringForValue(null) + ' but was ' + _displayStringForValue(aVar));
+}
+
+function assertNotNull() {
+ _validateArguments(1, arguments);
+ var aVar = nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar !== null, 'Expected not to be ' + _displayStringForValue(null));
+}
+
+function assertUndefined() {
+ _validateArguments(1, arguments);
+ var aVar = nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar === top.JSUNIT_UNDEFINED_VALUE, 'Expected ' + _displayStringForValue(top.JSUNIT_UNDEFINED_VALUE) + ' but was ' + _displayStringForValue(aVar));
+}
+
+function assertNotUndefined() {
+ _validateArguments(1, arguments);
+ var aVar = nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), aVar !== top.JSUNIT_UNDEFINED_VALUE, 'Expected not to be ' + _displayStringForValue(top.JSUNIT_UNDEFINED_VALUE));
+}
+
+function assertNaN() {
+ _validateArguments(1, arguments);
+ var aVar = nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), isNaN(aVar), 'Expected NaN');
+}
+
+function assertNotNaN() {
+ _validateArguments(1, arguments);
+ var aVar = nonCommentArg(1, 1, arguments);
+ _assert(commentArg(1, arguments), !isNaN(aVar), 'Expected not NaN');
+}
+
+function assertObjectEquals() {
+ _validateArguments(2, arguments);
+ var var1 = nonCommentArg(1, 2, arguments);
+ var var2 = nonCommentArg(2, 2, arguments);
+ var type;
+ var msg = commentArg(2, arguments)?commentArg(2, arguments):'';
+ var isSame = (var1 === var2);
+ //shortpath for references to same object
+ var isEqual = ( (type = _trueTypeOf(var1)) == _trueTypeOf(var2) );
+ if (isEqual && !isSame) {
+ switch (type) {
+ case 'String':
+ case 'Number':
+ isEqual = (var1 == var2);
+ break;
+ case 'Boolean':
+ case 'Date':
+ isEqual = (var1 === var2);
+ break;
+ case 'RegExp':
+ case 'Function':
+ isEqual = (var1.toString() === var2.toString());
+ break;
+ default: //Object | Array
+ var i;
+ if (isEqual = (var1.length === var2.length))
+ for (i in var1)
+ assertObjectEquals(msg + ' found nested ' + type + '@' + i + '\n', var1[i], var2[i]);
+ }
+ _assert(msg, isEqual, 'Expected ' + _displayStringForValue(var1) + ' but was ' + _displayStringForValue(var2));
+ }
+}
+
+assertArrayEquals = assertObjectEquals;
+
+function assertEvaluatesToTrue() {
+ _validateArguments(1, arguments);
+ var value = nonCommentArg(1, 1, arguments);
+ if (!value)
+ fail(commentArg(1, arguments));
+}
+
+function assertEvaluatesToFalse() {
+ _validateArguments(1, arguments);
+ var value = nonCommentArg(1, 1, arguments);
+ if (value)
+ fail(commentArg(1, arguments));
+}
+
+function assertHTMLEquals() {
+ _validateArguments(2, arguments);
+ var var1 = nonCommentArg(1, 2, arguments);
+ var var2 = nonCommentArg(2, 2, arguments);
+ var var1Standardized = standardizeHTML(var1);
+ var var2Standardized = standardizeHTML(var2);
+
+ _assert(commentArg(2, arguments), var1Standardized === var2Standardized, 'Expected ' + _displayStringForValue(var1Standardized) + ' but was ' + _displayStringForValue(var2Standardized));
+}
+
+function assertHashEquals() {
+ _validateArguments(2, arguments);
+ var var1 = nonCommentArg(1, 2, arguments);
+ var var2 = nonCommentArg(2, 2, arguments);
+ for (var key in var1) {
+ assertNotUndefined("Expected hash had key " + key + " that was not found", var2[key]);
+ assertEquals(
+ "Value for key " + key + " mismatch - expected = " + var1[key] + ", actual = " + var2[key],
+ var1[key], var2[key]
+ );
+ }
+ for (var key in var2) {
+ assertNotUndefined("Actual hash had key " + key + " that was not expected", var1[key]);
+ }
+}
+
+function assertRoughlyEquals() {
+ _validateArguments(3, arguments);
+ var expected = nonCommentArg(1, 3, arguments);
+ var actual = nonCommentArg(2, 3, arguments);
+ var tolerance = nonCommentArg(3, 3, arguments);
+ assertTrue(
+ "Expected " + expected + ", but got " + actual + " which was more than " + tolerance + " away",
+ Math.abs(expected - actual) < tolerance
+ );
+}
+
+function assertContains() {
+ _validateArguments(2, arguments);
+ var contained = nonCommentArg(1, 2, arguments);
+ var container = nonCommentArg(2, 2, arguments);
+ assertTrue(
+ "Expected '" + container + "' to contain '" + contained + "'",
+ container.indexOf(contained) != -1
+ );
+}
+
+function standardizeHTML(html) {
+ var translator = document.createElement("DIV");
+ translator.innerHTML = html;
+ return translator.innerHTML;
+}
+
+function isLoaded() {
+ return isTestPageLoaded;
+}
+
+function setUp() {
+}
+
+function tearDown() {
+}
+
+function getFunctionName(aFunction) {
+ var regexpResult = aFunction.toString().match(/function(\s*)(\w*)/);
+ if (regexpResult && regexpResult.length >= 2 && regexpResult[2]) {
+ return regexpResult[2];
+ }
+ return 'anonymous';
+}
+
+function getStackTrace() {
+ var result = '';
+
+ if (typeof(arguments.caller) != 'undefined') { // IE, not ECMA
+ for (var a = arguments.caller; a != null; a = a.caller) {
+ result += '> ' + getFunctionName(a.callee) + '\n';
+ if (a.caller == a) {
+ result += '*';
+ break;
+ }
+ }
+ }
+ else { // Mozilla, not ECMA
+ // fake an exception so we can get Mozilla's error stack
+ var testExcp;
+ try
+ {
+ foo.bar;
+ }
+ catch(testExcp)
+ {
+ var stack = parseErrorStack(testExcp);
+ for (var i = 1; i < stack.length; i++)
+ {
+ result += '> ' + stack[i] + '\n';
+ }
+ }
+ }
+
+ return result;
+}
+
+function parseErrorStack(excp)
+{
+ var stack = [];
+ var name;
+
+ if (!excp || !excp.stack)
+ {
+ return stack;
+ }
+
+ var stacklist = excp.stack.split('\n');
+
+ for (var i = 0; i < stacklist.length - 1; i++)
+ {
+ var framedata = stacklist[i];
+
+ name = framedata.match(/^(\w*)/)[1];
+ if (!name) {
+ name = 'anonymous';
+ }
+
+ stack[stack.length] = name;
+ }
+ // remove top level anonymous functions to match IE
+
+ while (stack.length && stack[stack.length - 1] == 'anonymous')
+ {
+ stack.length = stack.length - 1;
+ }
+ return stack;
+}
+
+function JsUnitException(comment, message) {
+ this.isJsUnitException = true;
+ this.comment = comment;
+ this.jsUnitMessage = message;
+ this.stackTrace = getStackTrace();
+}
+
+function warn() {
+ if (top.tracer != null)
+ top.tracer.warn(arguments[0], arguments[1]);
+}
+
+function inform() {
+ if (top.tracer != null)
+ top.tracer.inform(arguments[0], arguments[1]);
+}
+
+function info() {
+ inform(arguments[0], arguments[1]);
+}
+
+function debug() {
+ if (top.tracer != null)
+ top.tracer.debug(arguments[0], arguments[1]);
+}
+
+function setJsUnitTracer(aJsUnitTracer) {
+ top.tracer = aJsUnitTracer;
+}
+
+function trim(str) {
+ if (str == null)
+ return null;
+
+ var startingIndex = 0;
+ var endingIndex = str.length - 1;
+
+ while (str.substring(startingIndex, startingIndex + 1) == ' ')
+ startingIndex++;
+
+ while (str.substring(endingIndex, endingIndex + 1) == ' ')
+ endingIndex--;
+
+ if (endingIndex < startingIndex)
+ return '';
+
+ return str.substring(startingIndex, endingIndex + 1);
+}
+
+function isBlank(str) {
+ return trim(str) == '';
+}
+
+// the functions push(anArray, anObject) and pop(anArray)
+// exist because the JavaScript Array.push(anObject) and Array.pop()
+// functions are not available in IE 5.0
+
+function push(anArray, anObject) {
+ anArray[anArray.length] = anObject;
+}
+function pop(anArray) {
+ if (anArray.length >= 1) {
+ delete anArray[anArray.length - 1];
+ anArray.length--;
+ }
+}
+
+function jsUnitGetParm(name)
+{
+ if (typeof(top.jsUnitParmHash[name]) != 'undefined')
+ {
+ return top.jsUnitParmHash[name];
+ }
+ return null;
+}
+
+if (top && typeof(top.xbDEBUG) != 'undefined' && top.xbDEBUG.on && top.testManager)
+{
+ top.xbDebugTraceObject('top.testManager.containerTestFrame', 'JSUnitException');
+ // asserts
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_displayStringForValue');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'error');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'argumentsIncludeComments');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'commentArg');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'nonCommentArg');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_validateArguments');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_assert');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assert');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertTrue');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertEquals');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotEquals');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNull');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNull');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertUndefined');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotUndefined');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNaN');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNaN');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isLoaded');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setUp');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'tearDown');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getFunctionName');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getStackTrace');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'warn');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'inform');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'debug');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setJsUnitTracer');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'trim');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isBlank');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'newOnLoadEvent');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'push');
+ top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'pop');
+}
+
+function newOnLoadEvent() {
+ isTestPageLoaded = true;
+}
+
+function jsUnitSetOnLoad(windowRef, onloadHandler)
+{
+ var isKonqueror = navigator.userAgent.indexOf('Konqueror/') != -1 ||
+ navigator.userAgent.indexOf('Safari/') != -1;
+
+ if (typeof(windowRef.attachEvent) != 'undefined') {
+ // Internet Explorer, Opera
+ windowRef.attachEvent("onload", onloadHandler);
+ } else if (typeof(windowRef.addEventListener) != 'undefined' && !isKonqueror) {
+ // Mozilla, Konqueror
+ // exclude Konqueror due to load issues
+ windowRef.addEventListener("load", onloadHandler, false);
+ } else if (typeof(windowRef.document.addEventListener) != 'undefined' && !isKonqueror) {
+ // DOM 2 Events
+ // exclude Mozilla, Konqueror due to load issues
+ windowRef.document.addEventListener("load", onloadHandler, false);
+ } else if (typeof(windowRef.onload) != 'undefined' && windowRef.onload) {
+ windowRef.jsunit_original_onload = windowRef.onload;
+ windowRef.onload = function() {
+ windowRef.jsunit_original_onload();
+ onloadHandler();
+ };
+ } else {
+ // browsers that do not support windowRef.attachEvent or
+ // windowRef.addEventListener will override a page's own onload event
+ windowRef.onload = onloadHandler;
+ }
+}
+
+jsUnitSetOnLoad(window, newOnLoadEvent); \ No newline at end of file
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitMockTimeout.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitMockTimeout.js
new file mode 100644
index 0000000..99a4bf1
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitMockTimeout.js
@@ -0,0 +1,81 @@
+// Mock setTimeout, clearTimeout
+// Contributed by Pivotal Computer Systems, www.pivotalsf.com
+
+var Clock = {
+ timeoutsMade: 0,
+ scheduledFunctions: {},
+ nowMillis: 0,
+ reset: function() {
+ this.scheduledFunctions = {};
+ this.nowMillis = 0;
+ this.timeoutsMade = 0;
+ },
+ tick: function(millis) {
+ var oldMillis = this.nowMillis;
+ var newMillis = oldMillis + millis;
+ this.runFunctionsWithinRange(oldMillis, newMillis);
+ this.nowMillis = newMillis;
+ },
+ runFunctionsWithinRange: function(oldMillis, nowMillis) {
+ var scheduledFunc;
+ var funcsToRun = [];
+ for (var timeoutKey in this.scheduledFunctions) {
+ scheduledFunc = this.scheduledFunctions[timeoutKey];
+ if (scheduledFunc != undefined &&
+ scheduledFunc.runAtMillis >= oldMillis &&
+ scheduledFunc.runAtMillis <= nowMillis) {
+ funcsToRun.push(scheduledFunc);
+ this.scheduledFunctions[timeoutKey] = undefined;
+ }
+ }
+
+ if (funcsToRun.length > 0) {
+ funcsToRun.sort(function(a, b) {
+ return a.runAtMillis - b.runAtMillis;
+ });
+ for (var i = 0; i < funcsToRun.length; ++i) {
+ try {
+ this.nowMillis = funcsToRun[i].runAtMillis;
+ funcsToRun[i].funcToCall();
+ if (funcsToRun[i].recurring) {
+ Clock.scheduleFunction(funcsToRun[i].timeoutKey,
+ funcsToRun[i].funcToCall,
+ funcsToRun[i].millis,
+ true);
+ }
+ } catch(e) {
+ }
+ }
+ this.runFunctionsWithinRange(oldMillis, nowMillis);
+ }
+ },
+ scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
+ Clock.scheduledFunctions[timeoutKey] = {
+ runAtMillis: Clock.nowMillis + millis,
+ funcToCall: funcToCall,
+ recurring: recurring,
+ timeoutKey: timeoutKey,
+ millis: millis
+ };
+ }
+};
+
+function setTimeout(funcToCall, millis) {
+ Clock.timeoutsMade = Clock.timeoutsMade + 1;
+ Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, false);
+ return Clock.timeoutsMade;
+}
+
+function setInterval(funcToCall, millis) {
+ Clock.timeoutsMade = Clock.timeoutsMade + 1;
+ Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, true);
+ return Clock.timeoutsMade;
+}
+
+function clearTimeout(timeoutKey) {
+ Clock.scheduledFunctions[timeoutKey] = undefined;
+}
+
+function clearInterval(timeoutKey) {
+ Clock.scheduledFunctions[timeoutKey] = undefined;
+}
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestManager.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestManager.js
new file mode 100644
index 0000000..7d5bf0f
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestManager.js
@@ -0,0 +1,705 @@
+function jsUnitTestManager() {
+ this._windowForAllProblemMessages = null;
+
+ this.container = top.frames.testContainer
+ this.documentLoader = top.frames.documentLoader;
+ this.mainFrame = top.frames.mainFrame;
+
+ this.containerController = this.container.frames.testContainerController;
+ this.containerTestFrame = this.container.frames.testFrame;
+
+ var mainData = this.mainFrame.frames.mainData;
+
+ // form elements on mainData frame
+ this.testFileName = mainData.document.testRunnerForm.testFileName;
+ this.runButton = mainData.document.testRunnerForm.runButton;
+ this.traceLevel = mainData.document.testRunnerForm.traceLevel;
+ this.closeTraceWindowOnNewRun = mainData.document.testRunnerForm.closeTraceWindowOnNewRun;
+ this.timeout = mainData.document.testRunnerForm.timeout;
+ this.setUpPageTimeout = mainData.document.testRunnerForm.setUpPageTimeout;
+
+ // image output
+ this.progressBar = this.mainFrame.frames.mainProgress.document.progress;
+
+ this.problemsListField = this.mainFrame.frames.mainErrors.document.testRunnerForm.problemsList;
+ this.testCaseResultsField = this.mainFrame.frames.mainResults.document.resultsForm.testCases;
+ this.resultsTimeField = this.mainFrame.frames.mainResults.document.resultsForm.time;
+
+ // 'layer' output frames
+ this.uiFrames = new Object();
+ this.uiFrames.mainStatus = this.mainFrame.frames.mainStatus;
+
+ var mainCounts = this.mainFrame.frames.mainCounts;
+
+ this.uiFrames.mainCountsErrors = mainCounts.frames.mainCountsErrors;
+ this.uiFrames.mainCountsFailures = mainCounts.frames.mainCountsFailures;
+ this.uiFrames.mainCountsRuns = mainCounts.frames.mainCountsRuns;
+ this._baseURL = "";
+
+ this.setup();
+}
+
+// seconds to wait for each test page to load
+jsUnitTestManager.TESTPAGE_WAIT_SEC = 120;
+jsUnitTestManager.TIMEOUT_LENGTH = 20;
+
+// seconds to wait for setUpPage to complete
+jsUnitTestManager.SETUPPAGE_TIMEOUT = 120;
+
+// milliseconds to wait between polls on setUpPages
+jsUnitTestManager.SETUPPAGE_INTERVAL = 100;
+
+jsUnitTestManager.RESTORED_HTML_DIV_ID = "jsUnitRestoredHTML";
+
+jsUnitTestManager.prototype.setup = function () {
+ this.totalCount = 0;
+ this.errorCount = 0;
+ this.failureCount = 0;
+ this._suiteStack = Array();
+
+ var initialSuite = new top.jsUnitTestSuite();
+ push(this._suiteStack, initialSuite);
+}
+
+jsUnitTestManager.prototype.start = function () {
+ this._baseURL = this.resolveUserEnteredTestFileName();
+ var firstQuery = this._baseURL.indexOf("?");
+ if (firstQuery >= 0) {
+ this._baseURL = this._baseURL.substring(0, firstQuery);
+ }
+ var lastSlash = this._baseURL.lastIndexOf("/");
+ var lastRevSlash = this._baseURL.lastIndexOf("\\");
+ if (lastRevSlash > lastSlash) {
+ lastSlash = lastRevSlash;
+ }
+ if (lastSlash > 0) {
+ this._baseURL = this._baseURL.substring(0, lastSlash + 1);
+ }
+
+ this._timeRunStarted = new Date();
+ this.initialize();
+ setTimeout('top.testManager._nextPage();', jsUnitTestManager.TIMEOUT_LENGTH);
+}
+
+jsUnitTestManager.prototype.getBaseURL = function () {
+ return this._baseURL;
+}
+
+jsUnitTestManager.prototype.doneLoadingPage = function (pageName) {
+ //this.containerTestFrame.setTracer(top.tracer);
+ this._testFileName = pageName;
+ if (this.isTestPageSuite())
+ this._handleNewSuite();
+ else
+ {
+ this._testIndex = 0;
+ this._testsInPage = this.getTestFunctionNames();
+ this._numberOfTestsInPage = this._testsInPage.length;
+ this._runTest();
+ }
+}
+
+jsUnitTestManager.prototype._handleNewSuite = function () {
+ var allegedSuite = this.containerTestFrame.suite();
+ if (allegedSuite.isjsUnitTestSuite) {
+ var newSuite = allegedSuite.clone();
+ if (newSuite.containsTestPages())
+ push(this._suiteStack, newSuite);
+ this._nextPage();
+ }
+ else {
+ this.fatalError('Invalid test suite in file ' + this._testFileName);
+ this.abort();
+ }
+}
+
+jsUnitTestManager.prototype._runTest = function () {
+ if (this._testIndex + 1 > this._numberOfTestsInPage)
+ {
+ // execute tearDownPage *synchronously*
+ // (unlike setUpPage which is asynchronous)
+ if (typeof this.containerTestFrame.tearDownPage == 'function') {
+ this.containerTestFrame.tearDownPage();
+ }
+
+ this._nextPage();
+ return;
+ }
+
+ if (this._testIndex == 0) {
+ this.storeRestoredHTML();
+ if (typeof(this.containerTestFrame.setUpPage) == 'function') {
+ // first test for this page and a setUpPage is defined
+ if (typeof(this.containerTestFrame.setUpPageStatus) == 'undefined') {
+ // setUpPage() not called yet, so call it
+ this.containerTestFrame.setUpPageStatus = false;
+ this.containerTestFrame.startTime = new Date();
+ this.containerTestFrame.setUpPage();
+ // try test again later
+ setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
+ return;
+ }
+
+ if (this.containerTestFrame.setUpPageStatus != 'complete') {
+ top.status = 'setUpPage not completed... ' + this.containerTestFrame.setUpPageStatus + ' ' + (new Date());
+ if ((new Date() - this.containerTestFrame.startTime) / 1000 > this.getsetUpPageTimeout()) {
+ this.fatalError('setUpPage timed out without completing.');
+ if (!this.userConfirm('Retry Test Run?')) {
+ this.abort();
+ return;
+ }
+ this.containerTestFrame.startTime = (new Date());
+ }
+ // try test again later
+ setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
+ return;
+ }
+ }
+ }
+
+ top.status = '';
+ // either not first test, or no setUpPage defined, or setUpPage completed
+ this.executeTestFunction(this._testsInPage[this._testIndex]);
+ this.totalCount++;
+ this.updateProgressIndicators();
+ this._testIndex++;
+ setTimeout('top.testManager._runTest()', jsUnitTestManager.TIMEOUT_LENGTH);
+}
+
+jsUnitTestManager.prototype._done = function () {
+ var secondsSinceRunBegan = (new Date() - this._timeRunStarted) / 1000;
+ this.setStatus('Done (' + secondsSinceRunBegan + ' seconds)');
+ this._cleanUp();
+ if (top.shouldSubmitResults()) {
+ this.resultsTimeField.value = secondsSinceRunBegan;
+ top.submitResults();
+ }
+}
+
+jsUnitTestManager.prototype._nextPage = function () {
+ this._restoredHTML = null;
+ if (this._currentSuite().hasMorePages()) {
+ this.loadPage(this._currentSuite().nextPage());
+ }
+ else {
+ pop(this._suiteStack);
+ if (this._currentSuite() == null)
+ this._done();
+ else
+ this._nextPage();
+ }
+}
+
+jsUnitTestManager.prototype._currentSuite = function () {
+ var suite = null;
+
+ if (this._suiteStack && this._suiteStack.length > 0)
+ suite = this._suiteStack[this._suiteStack.length - 1];
+
+ return suite;
+}
+
+jsUnitTestManager.prototype.calculateProgressBarProportion = function () {
+ if (this.totalCount == 0)
+ return 0;
+ var currentDivisor = 1;
+ var result = 0;
+
+ for (var i = 0; i < this._suiteStack.length; i++) {
+ var aSuite = this._suiteStack[i];
+ currentDivisor *= aSuite.testPages.length;
+ result += (aSuite.pageIndex - 1) / currentDivisor;
+ }
+ result += (this._testIndex + 1) / (this._numberOfTestsInPage * currentDivisor);
+ return result;
+}
+
+jsUnitTestManager.prototype._cleanUp = function () {
+ this.containerController.setTestPage('./app/emptyPage.html');
+ this.finalize();
+ top.tracer.finalize();
+}
+
+jsUnitTestManager.prototype.abort = function () {
+ this.setStatus('Aborted');
+ this._cleanUp();
+}
+
+jsUnitTestManager.prototype.getTimeout = function () {
+ var result = jsUnitTestManager.TESTPAGE_WAIT_SEC;
+ try {
+ result = eval(this.timeout.value);
+ }
+ catch (e) {
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.getsetUpPageTimeout = function () {
+ var result = jsUnitTestManager.SETUPPAGE_TIMEOUT;
+ try {
+ result = eval(this.setUpPageTimeout.value);
+ }
+ catch (e) {
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.isTestPageSuite = function () {
+ var result = false;
+ if (typeof(this.containerTestFrame.suite) == 'function')
+ {
+ result = true;
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype.getTestFunctionNames = function () {
+ var testFrame = this.containerTestFrame;
+ var testFunctionNames = new Array();
+ var i;
+
+ if (testFrame && typeof(testFrame.exposeTestFunctionNames) == 'function')
+ return testFrame.exposeTestFunctionNames();
+
+ if (testFrame &&
+ testFrame.document &&
+ typeof(testFrame.document.scripts) != 'undefined' &&
+ testFrame.document.scripts.length > 0) { // IE5 and up
+ var scriptsInTestFrame = testFrame.document.scripts;
+
+ for (i = 0; i < scriptsInTestFrame.length; i++) {
+ var someNames = this._extractTestFunctionNamesFromScript(scriptsInTestFrame[i]);
+ if (someNames)
+ testFunctionNames = testFunctionNames.concat(someNames);
+ }
+ }
+ else {
+ for (i in testFrame) {
+ if (i.substring(0, 4) == 'test' && typeof(testFrame[i]) == 'function')
+ push(testFunctionNames, i);
+ }
+ }
+ return testFunctionNames;
+}
+
+jsUnitTestManager.prototype._extractTestFunctionNamesFromScript = function (aScript) {
+ var result;
+ var remainingScriptToInspect = aScript.text;
+ var currentIndex = this._indexOfTestFunctionIn(remainingScriptToInspect);
+ while (currentIndex != -1) {
+ if (!result)
+ result = new Array();
+
+ var fragment = remainingScriptToInspect.substring(currentIndex, remainingScriptToInspect.length);
+ result = result.concat(fragment.substring('function '.length, fragment.indexOf('(')));
+ remainingScriptToInspect = remainingScriptToInspect.substring(currentIndex + 12, remainingScriptToInspect.length);
+ currentIndex = this._indexOfTestFunctionIn(remainingScriptToInspect);
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype._indexOfTestFunctionIn = function (string) {
+ return string.indexOf('function test');
+}
+
+jsUnitTestManager.prototype.loadPage = function (testFileName) {
+ this._testFileName = testFileName;
+ this._loadAttemptStartTime = new Date();
+ this.setStatus('Opening Test Page "' + this._testFileName + '"');
+ this.containerController.setTestPage(this._testFileName);
+ this._callBackWhenPageIsLoaded();
+}
+
+jsUnitTestManager.prototype._callBackWhenPageIsLoaded = function () {
+ if ((new Date() - this._loadAttemptStartTime) / 1000 > this.getTimeout()) {
+ this.fatalError('Reading Test Page ' + this._testFileName + ' timed out.\nMake sure that the file exists and is a Test Page.');
+ if (this.userConfirm('Retry Test Run?')) {
+ this.loadPage(this._testFileName);
+ return;
+ } else {
+ this.abort();
+ return;
+ }
+ }
+ if (!this._isTestFrameLoaded()) {
+ setTimeout('top.testManager._callBackWhenPageIsLoaded();', jsUnitTestManager.TIMEOUT_LENGTH);
+ return;
+ }
+ this.doneLoadingPage(this._testFileName);
+}
+
+jsUnitTestManager.prototype._isTestFrameLoaded = function () {
+ try {
+ return this.containerController.isPageLoaded();
+ }
+ catch (e) {
+ }
+ return false;
+}
+
+jsUnitTestManager.prototype.executeTestFunction = function (functionName) {
+ this._testFunctionName = functionName;
+ this.setStatus('Running test "' + this._testFunctionName + '"');
+ var excep = null;
+ var timeBefore = new Date();
+ try {
+ if (this._restoredHTML)
+ top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID).innerHTML = this._restoredHTML;
+ if (this.containerTestFrame.setUp !== JSUNIT_UNDEFINED_VALUE)
+ this.containerTestFrame.setUp();
+ this.containerTestFrame[this._testFunctionName]();
+ }
+ catch (e1) {
+ excep = e1;
+ }
+ finally {
+ try {
+ if (this.containerTestFrame.tearDown !== JSUNIT_UNDEFINED_VALUE)
+ this.containerTestFrame.tearDown();
+ }
+ catch (e2) {
+ //Unlike JUnit, only assign a tearDown exception to excep if there is not already an exception from the test body
+ if (excep == null)
+ excep = e2;
+ }
+ }
+ var timeTaken = (new Date() - timeBefore) / 1000;
+ if (excep != null)
+ this._handleTestException(excep);
+ var serializedTestCaseString = this._currentTestFunctionNameWithTestPageName(true) + "|" + timeTaken + "|";
+ if (excep == null)
+ serializedTestCaseString += "S||";
+ else {
+ if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException)
+ serializedTestCaseString += "F|";
+ else {
+ serializedTestCaseString += "E|";
+ }
+ serializedTestCaseString += this._problemDetailMessageFor(excep);
+ }
+ this._addOption(this.testCaseResultsField,
+ serializedTestCaseString,
+ serializedTestCaseString);
+}
+
+jsUnitTestManager.prototype._currentTestFunctionNameWithTestPageName = function(useFullyQualifiedTestPageName) {
+ var testURL = this.containerTestFrame.location.href;
+ var testQuery = testURL.indexOf("?");
+ if (testQuery >= 0) {
+ testURL = testURL.substring(0, testQuery);
+ }
+ if (!useFullyQualifiedTestPageName) {
+ if (testURL.substring(0, this._baseURL.length) == this._baseURL)
+ testURL = testURL.substring(this._baseURL.length);
+ }
+ return testURL + ':' + this._testFunctionName;
+}
+
+jsUnitTestManager.prototype._addOption = function(listField, problemValue, problemMessage) {
+ if (typeof(listField.ownerDocument) != 'undefined'
+ && typeof(listField.ownerDocument.createElement) != 'undefined') {
+ // DOM Level 2 HTML method.
+ // this is required for Opera 7 since appending to the end of the
+ // options array does not work, and adding an Option created by new Option()
+ // and appended by listField.options.add() fails due to WRONG_DOCUMENT_ERR
+ var problemDocument = listField.ownerDocument;
+ var errOption = problemDocument.createElement('option');
+ errOption.setAttribute('value', problemValue);
+ errOption.appendChild(problemDocument.createTextNode(problemMessage));
+ listField.appendChild(errOption);
+ }
+ else {
+ // new Option() is DOM 0
+ errOption = new Option(problemMessage, problemValue);
+ if (typeof(listField.add) != 'undefined') {
+ // DOM 2 HTML
+ listField.add(errOption, null);
+ }
+ else if (typeof(listField.options.add) != 'undefined') {
+ // DOM 0
+ listField.options.add(errOption, null);
+ }
+ else {
+ // DOM 0
+ listField.options[listField.length] = errOption;
+ }
+ }
+}
+
+jsUnitTestManager.prototype._handleTestException = function (excep) {
+ var problemMessage = this._currentTestFunctionNameWithTestPageName(false) + ' ';
+ var errOption;
+ if (typeof(excep.isJsUnitException) == 'undefined' || !excep.isJsUnitException) {
+ problemMessage += 'had an error';
+ this.errorCount++;
+ }
+ else {
+ problemMessage += 'failed';
+ this.failureCount++;
+ }
+ var listField = this.problemsListField;
+ this._addOption(listField,
+ this._problemDetailMessageFor(excep),
+ problemMessage);
+}
+
+jsUnitTestManager.prototype._problemDetailMessageFor = function (excep) {
+ var result = null;
+ if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException) {
+ result = '';
+ if (excep.comment != null)
+ result += ('"' + excep.comment + '"\n');
+
+ result += excep.jsUnitMessage;
+
+ if (excep.stackTrace)
+ result += '\n\nStack trace follows:\n' + excep.stackTrace;
+ }
+ else {
+ result = 'Error message is:\n"';
+ result +=
+ (typeof(excep.description) == 'undefined') ?
+ excep :
+ excep.description;
+ result += '"';
+ if (typeof(excep.stack) != 'undefined') // Mozilla only
+ result += '\n\nStack trace follows:\n' + excep.stack;
+ }
+ return result;
+}
+
+jsUnitTestManager.prototype._setTextOnLayer = function (layerName, str) {
+ try {
+ var content;
+ if (content = this.uiFrames[layerName].document.getElementById('content'))
+ content.innerHTML = str;
+ else
+ throw 'No content div found.';
+ }
+ catch (e) {
+ var html = '';
+ html += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
+ html += '<html><head><link rel="stylesheet" type="text/css" href="css/jsUnitStyle.css"><\/head>';
+ html += '<body><div id="content">';
+ html += str;
+ html += '<\/div><\/body>';
+ html += '<\/html>';
+ this.uiFrames[layerName].document.write(html);
+ this.uiFrames[layerName].document.close();
+ }
+}
+
+jsUnitTestManager.prototype.setStatus = function (str) {
+ this._setTextOnLayer('mainStatus', '<b>Status:<\/b> ' + str);
+}
+
+jsUnitTestManager.prototype._setErrors = function (n) {
+ this._setTextOnLayer('mainCountsErrors', '<b>Errors: <\/b>' + n);
+}
+
+jsUnitTestManager.prototype._setFailures = function (n) {
+ this._setTextOnLayer('mainCountsFailures', '<b>Failures:<\/b> ' + n);
+}
+
+jsUnitTestManager.prototype._setTotal = function (n) {
+ this._setTextOnLayer('mainCountsRuns', '<b>Runs:<\/b> ' + n);
+}
+
+jsUnitTestManager.prototype._setProgressBarImage = function (imgName) {
+ this.progressBar.src = imgName;
+}
+
+jsUnitTestManager.prototype._setProgressBarWidth = function (w) {
+ this.progressBar.width = w;
+}
+
+jsUnitTestManager.prototype.updateProgressIndicators = function () {
+ this._setTotal(this.totalCount);
+ this._setErrors(this.errorCount);
+ this._setFailures(this.failureCount);
+ this._setProgressBarWidth(300 * this.calculateProgressBarProportion());
+
+ if (this.errorCount > 0 || this.failureCount > 0)
+ this._setProgressBarImage('../images/red.gif');
+ else
+ this._setProgressBarImage('../images/green.gif');
+}
+
+jsUnitTestManager.prototype.showMessageForSelectedProblemTest = function () {
+ var problemTestIndex = this.problemsListField.selectedIndex;
+ if (problemTestIndex != -1)
+ this.fatalError(this.problemsListField[problemTestIndex].value);
+}
+
+jsUnitTestManager.prototype.showMessagesForAllProblemTests = function () {
+ if (this.problemsListField.length == 0)
+ return;
+
+ try {
+ if (this._windowForAllProblemMessages && !this._windowForAllProblemMessages.closed)
+ this._windowForAllProblemMessages.close();
+ }
+ catch(e) {
+ }
+
+ this._windowForAllProblemMessages = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes');
+ var resDoc = this._windowForAllProblemMessages.document;
+ resDoc.write('<html><head><link rel="stylesheet" href="../css/jsUnitStyle.css"><title>Tests with problems - JsUnit<\/title><head><body>');
+ resDoc.write('<p class="jsUnitSubHeading">Tests with problems (' + this.problemsListField.length + ' total) - JsUnit<\/p>');
+ resDoc.write('<p class="jsUnitSubSubHeading"><i>Running on ' + navigator.userAgent + '</i></p>');
+ for (var i = 0; i < this.problemsListField.length; i++)
+ {
+ resDoc.write('<p class="jsUnitDefault">');
+ resDoc.write('<b>' + (i + 1) + '. ');
+ resDoc.write(this.problemsListField[i].text);
+ resDoc.write('<\/b><\/p><p><pre>');
+ resDoc.write(this._makeHTMLSafe(this.problemsListField[i].value));
+ resDoc.write('<\/pre><\/p>');
+ }
+
+ resDoc.write('<\/body><\/html>');
+ resDoc.close();
+}
+
+jsUnitTestManager.prototype._makeHTMLSafe = function (string) {
+ string = string.replace(/&/g, '&amp;');
+ string = string.replace(/</g, '&lt;');
+ string = string.replace(/>/g, '&gt;');
+ return string;
+}
+
+jsUnitTestManager.prototype._clearProblemsList = function () {
+ var listField = this.problemsListField;
+ var initialLength = listField.options.length;
+
+ for (var i = 0; i < initialLength; i++)
+ listField.remove(0);
+}
+
+jsUnitTestManager.prototype.initialize = function () {
+ this.setStatus('Initializing...');
+ this._setRunButtonEnabled(false);
+ this._clearProblemsList();
+ this.updateProgressIndicators();
+ this.setStatus('Done initializing');
+}
+
+jsUnitTestManager.prototype.finalize = function () {
+ this._setRunButtonEnabled(true);
+}
+
+jsUnitTestManager.prototype._setRunButtonEnabled = function (b) {
+ this.runButton.disabled = !b;
+}
+
+jsUnitTestManager.prototype.getTestFileName = function () {
+ var rawEnteredFileName = this.testFileName.value;
+ var result = rawEnteredFileName;
+
+ while (result.indexOf('\\') != -1)
+ result = result.replace('\\', '/');
+
+ return result;
+}
+
+jsUnitTestManager.prototype.getTestFunctionName = function () {
+ return this._testFunctionName;
+}
+
+jsUnitTestManager.prototype.resolveUserEnteredTestFileName = function (rawText) {
+ var userEnteredTestFileName = top.testManager.getTestFileName();
+
+ // only test for file:// since Opera uses a different format
+ if (userEnteredTestFileName.indexOf('http://') == 0 || userEnteredTestFileName.indexOf('https://') == 0 || userEnteredTestFileName.indexOf('file://') == 0)
+ return userEnteredTestFileName;
+
+ return getTestFileProtocol() + this.getTestFileName();
+}
+
+jsUnitTestManager.prototype.storeRestoredHTML = function () {
+ if (document.getElementById && top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID))
+ this._restoredHTML = top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID).innerHTML;
+}
+
+jsUnitTestManager.prototype.fatalError = function(aMessage) {
+ if (top.shouldSubmitResults())
+ this.setStatus(aMessage);
+ else
+ alert(aMessage);
+}
+
+jsUnitTestManager.prototype.userConfirm = function(aMessage) {
+ if (top.shouldSubmitResults())
+ return false;
+ else
+ return confirm(aMessage);
+}
+
+function getTestFileProtocol() {
+ return getDocumentProtocol();
+}
+
+function getDocumentProtocol() {
+ var protocol = top.document.location.protocol;
+
+ if (protocol == "file:")
+ return "file:///";
+
+ if (protocol == "http:")
+ return "http://";
+
+ if (protocol == 'https:')
+ return 'https://';
+
+ if (protocol == "chrome:")
+ return "chrome://";
+
+ return null;
+}
+
+function browserSupportsReadingFullPathFromFileField() {
+ return !isOpera() && !isIE7();
+}
+
+function isOpera() {
+ return navigator.userAgent.toLowerCase().indexOf("opera") != -1;
+}
+
+function isIE7() {
+ return navigator.userAgent.toLowerCase().indexOf("msie 7") != -1;
+}
+
+function isBeingRunOverHTTP() {
+ return getDocumentProtocol() == "http://";
+}
+
+function getWebserver() {
+ if (isBeingRunOverHTTP()) {
+ var myUrl = location.href;
+ var myUrlWithProtocolStripped = myUrl.substring(myUrl.indexOf("/") + 2);
+ return myUrlWithProtocolStripped.substring(0, myUrlWithProtocolStripped.indexOf("/"));
+ }
+ return null;
+}
+
+// the functions push(anArray, anObject) and pop(anArray)
+// exist because the JavaScript Array.push(anObject) and Array.pop()
+// functions are not available in IE 5.0
+
+function push(anArray, anObject) {
+ anArray[anArray.length] = anObject;
+}
+
+function pop(anArray) {
+ if (anArray.length >= 1) {
+ delete anArray[anArray.length - 1];
+ anArray.length--;
+ }
+}
+
+if (xbDEBUG.on) {
+ xbDebugTraceObject('window', 'jsUnitTestManager');
+ xbDebugTraceFunction('window', 'getTestFileProtocol');
+ xbDebugTraceFunction('window', 'getDocumentProtocol');
+}
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestSuite.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestSuite.js
new file mode 100644
index 0000000..3f3eb8c
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTestSuite.js
@@ -0,0 +1,44 @@
+function jsUnitTestSuite() {
+ this.isjsUnitTestSuite = true;
+ this.testPages = Array();
+ this.pageIndex = 0;
+}
+
+jsUnitTestSuite.prototype.addTestPage = function (pageName)
+{
+ this.testPages[this.testPages.length] = pageName;
+}
+
+jsUnitTestSuite.prototype.addTestSuite = function (suite)
+{
+ for (var i = 0; i < suite.testPages.length; i++)
+ this.addTestPage(suite.testPages[i]);
+}
+
+jsUnitTestSuite.prototype.containsTestPages = function ()
+{
+ return this.testPages.length > 0;
+}
+
+jsUnitTestSuite.prototype.nextPage = function ()
+{
+ return this.testPages[this.pageIndex++];
+}
+
+jsUnitTestSuite.prototype.hasMorePages = function ()
+{
+ return this.pageIndex < this.testPages.length;
+}
+
+jsUnitTestSuite.prototype.clone = function ()
+{
+ var clone = new jsUnitTestSuite();
+ clone.testPages = this.testPages;
+ return clone;
+}
+
+if (xbDEBUG.on)
+{
+ xbDebugTraceObject('window', 'jsUnitTestSuite');
+}
+
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTracer.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTracer.js
new file mode 100644
index 0000000..b120e39
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitTracer.js
@@ -0,0 +1,102 @@
+var TRACE_LEVEL_NONE = new JsUnitTraceLevel(0, null);
+var TRACE_LEVEL_WARNING = new JsUnitTraceLevel(1, "#FF0000");
+var TRACE_LEVEL_INFO = new JsUnitTraceLevel(2, "#009966");
+var TRACE_LEVEL_DEBUG = new JsUnitTraceLevel(3, "#0000FF");
+
+function JsUnitTracer(testManager) {
+ this._testManager = testManager;
+ this._traceWindow = null;
+ this.popupWindowsBlocked = false;
+}
+
+JsUnitTracer.prototype.initialize = function() {
+ if (this._traceWindow != null && top.testManager.closeTraceWindowOnNewRun.checked)
+ this._traceWindow.close();
+ this._traceWindow = null;
+}
+
+JsUnitTracer.prototype.finalize = function() {
+ if (this._traceWindow != null) {
+ this._traceWindow.document.write('<\/body>\n<\/html>');
+ this._traceWindow.document.close();
+ }
+}
+
+JsUnitTracer.prototype.warn = function() {
+ this._trace(arguments[0], arguments[1], TRACE_LEVEL_WARNING);
+}
+
+JsUnitTracer.prototype.inform = function() {
+ this._trace(arguments[0], arguments[1], TRACE_LEVEL_INFO);
+}
+
+JsUnitTracer.prototype.debug = function() {
+ this._trace(arguments[0], arguments[1], TRACE_LEVEL_DEBUG);
+}
+
+JsUnitTracer.prototype._trace = function(message, value, traceLevel) {
+ if (!top.shouldSubmitResults() && this._getChosenTraceLevel().matches(traceLevel)) {
+ var traceString = message;
+ if (value)
+ traceString += ': ' + value;
+ var prefix = this._testManager.getTestFileName() + ":" +
+ this._testManager.getTestFunctionName() + " - ";
+ this._writeToTraceWindow(prefix, traceString, traceLevel);
+ }
+}
+
+JsUnitTracer.prototype._getChosenTraceLevel = function() {
+ var levelNumber = eval(top.testManager.traceLevel.value);
+ return traceLevelByLevelNumber(levelNumber);
+}
+
+JsUnitTracer.prototype._writeToTraceWindow = function(prefix, traceString, traceLevel) {
+ var htmlToAppend = '<p class="jsUnitDefault">' + prefix + '<font color="' + traceLevel.getColor() + '">' + traceString + '</font><\/p>\n';
+ this._getTraceWindow().document.write(htmlToAppend);
+}
+
+JsUnitTracer.prototype._getTraceWindow = function() {
+ if (this._traceWindow == null && !top.shouldSubmitResults() && !this.popupWindowsBlocked) {
+ this._traceWindow = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes');
+ if (!this._traceWindow)
+ this.popupWindowsBlocked = true;
+ else {
+ var resDoc = this._traceWindow.document;
+ resDoc.write('<html>\n<head>\n<link rel="stylesheet" href="css/jsUnitStyle.css">\n<title>Tracing - JsUnit<\/title>\n<head>\n<body>');
+ resDoc.write('<h2>Tracing - JsUnit<\/h2>\n');
+ resDoc.write('<p class="jsUnitDefault"><i>(Traces are color coded: ');
+ resDoc.write('<font color="' + TRACE_LEVEL_WARNING.getColor() + '">Warning</font> - ');
+ resDoc.write('<font color="' + TRACE_LEVEL_INFO.getColor() + '">Information</font> - ');
+ resDoc.write('<font color="' + TRACE_LEVEL_DEBUG.getColor() + '">Debug</font>');
+ resDoc.write(')</i></p>');
+ }
+ }
+ return this._traceWindow;
+}
+
+if (xbDEBUG.on) {
+ xbDebugTraceObject('window', 'JsUnitTracer');
+}
+
+function JsUnitTraceLevel(levelNumber, color) {
+ this._levelNumber = levelNumber;
+ this._color = color;
+}
+
+JsUnitTraceLevel.prototype.matches = function(anotherTraceLevel) {
+ return this._levelNumber >= anotherTraceLevel._levelNumber;
+}
+
+JsUnitTraceLevel.prototype.getColor = function() {
+ return this._color;
+}
+
+function traceLevelByLevelNumber(levelNumber) {
+ switch (levelNumber) {
+ case 0: return TRACE_LEVEL_NONE;
+ case 1: return TRACE_LEVEL_WARNING;
+ case 2: return TRACE_LEVEL_INFO;
+ case 3: return TRACE_LEVEL_DEBUG;
+ }
+ return null;
+} \ No newline at end of file
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitVersionCheck.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitVersionCheck.js
new file mode 100644
index 0000000..41c8862
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/jsUnitVersionCheck.js
@@ -0,0 +1,59 @@
+var versionRequest;
+
+function isOutOfDate(newVersionNumber) {
+ return JSUNIT_VERSION < newVersionNumber;
+}
+
+function sendRequestForLatestVersion(url) {
+ versionRequest = createXmlHttpRequest();
+ if (versionRequest) {
+ versionRequest.onreadystatechange = requestStateChanged;
+ versionRequest.open("GET", url, true);
+ versionRequest.send(null);
+ }
+}
+
+function createXmlHttpRequest() {
+ if (window.XMLHttpRequest)
+ return new XMLHttpRequest();
+ else if (window.ActiveXObject)
+ return new ActiveXObject("Microsoft.XMLHTTP");
+}
+
+function requestStateChanged() {
+ if (versionRequest && versionRequest.readyState == 4) {
+ if (versionRequest.status == 200) {
+ var latestVersion = versionRequest.responseText;
+ if (isOutOfDate(latestVersion))
+ versionNotLatest(latestVersion);
+ else
+ versionLatest();
+ } else
+ versionCheckError();
+ }
+}
+
+function checkForLatestVersion(url) {
+ setLatestVersionDivHTML("Checking for newer version...");
+ try {
+ sendRequestForLatestVersion(url);
+ } catch (e) {
+ setLatestVersionDivHTML("An error occurred while checking for a newer version: " + e.message);
+ }
+}
+
+function versionNotLatest(latestVersion) {
+ setLatestVersionDivHTML('<font color="red">A newer version of JsUnit, version ' + latestVersion + ', is available.</font>');
+}
+
+function versionLatest() {
+ setLatestVersionDivHTML("You are running the latest version of JsUnit.");
+}
+
+function setLatestVersionDivHTML(string) {
+ document.getElementById("versionCheckDiv").innerHTML = string;
+}
+
+function versionCheckError() {
+ setLatestVersionDivHTML("An error occurred while checking for a newer version.");
+} \ No newline at end of file
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-errors.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-errors.html
new file mode 100644
index 0000000..ca726b5
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-errors.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<div id="content"><b>Errors:</b> 0</div>
+</body>
+</html> \ No newline at end of file
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-failures.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-failures.html
new file mode 100644
index 0000000..861c78b
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-failures.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<div id="content"><b>Failures:</b> 0</div>
+
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-runs.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-runs.html
new file mode 100644
index 0000000..5429f8f
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts-runs.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<div id="content"><b>Runs:</b> 0</div>
+
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts.html
new file mode 100644
index 0000000..0431eae
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-counts.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title></title>
+</head>
+
+<frameset cols="200,190,*" border="0">
+ <frame name="mainCountsRuns" src="main-counts-runs.html" scrolling="no" frameborder="0">
+ <frame name="mainCountsErrors" src="main-counts-errors.html" scrolling="no" frameborder="0">
+ <frame name="mainCountsFailures" src="main-counts-failures.html" scrolling="no" frameborder="0">
+
+ <noframes>
+ <body>
+ <p>jsUnit uses frames in order to remove dependencies upon a browser's implementation of document.getElementById
+ and HTMLElement.innerHTML.</p>
+ </body>
+ </noframes>
+</frameset>
+</html>
+
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-data.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-data.html
new file mode 100644
index 0000000..8a15b97
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-data.html
@@ -0,0 +1,189 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-data.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="jsUnitVersionCheck.js"></script>
+ <script language="JavaScript" type="text/javascript">
+
+ function pageLoaded() {
+ giveFocusToTestFileNameField();
+ }
+
+ function giveFocusToTestFileNameField() {
+ if (document.testRunnerForm.testFileName.type != "hidden")
+ document.testRunnerForm.testFileName.focus();
+ }
+
+ function kickOffTests() {
+ //
+ // Check if Init was called by onload handler
+ //
+ if (typeof(top.testManager) == 'undefined') {
+ top.init();
+ }
+
+ if (isBlank(top.testManager.getTestFileName())) {
+ top.testManager.fatalError('No Test Page specified.');
+ return;
+ }
+
+ top.testManager.setup();
+
+ top.testManager._currentSuite().addTestPage(top.testManager.resolveUserEnteredTestFileName());
+ top.tracer.initialize();
+
+ var traceLevel = document.forms.testRunnerForm.traceLevel;
+ if (traceLevel.value != '0')
+ {
+ var traceWindow = top.tracer._getTraceWindow();
+ if (traceWindow) {
+ traceWindow.focus();
+ }
+ else {
+ top.testManager.fatalError('Tracing requires popup windows, and popups are blocked in your browser.\n\nPlease enable popups if you wish to use tracing.');
+ }
+ }
+
+ top.testManager.start();
+ }
+
+ </script>
+</head>
+
+<body onload="pageLoaded();">
+<table width="100%" cellpadding="0" cellspacing="0" border="0" summary="jsUnit Information" bgcolor="#DDDDDD">
+ <tr>
+ <td width="1"><a href="http://www.jsunit.net" target="_blank"><img src="../images/logo_jsunit.gif" alt="JsUnit" border="0"/></a></td>
+ <td width="50">&nbsp;</td>
+ <th nowrap align="left">
+ <h4>JsUnit <script language="javascript">document.write(JSUNIT_VERSION);</script> TestRunner</h4>
+ <font size="-2"><i>Running on <script language="javascript" type="text/javascript">document.write(navigator.userAgent);</script>
+ </i></font>
+ </th>
+
+ <td nowrap align="right" valign="middle">
+ <font size="-2">
+ <b><a href="http://www.jsunit.net/" target="_blank">www.jsunit.net</a></b>&nbsp;&nbsp;<br>
+ </font>
+ <a href="http://www.pivotalsf.com/" target="top">
+ <img border="0" src="../images/powerby-transparent.gif" alt="Powered By Pivotal">
+ </a>
+ </td>
+ </tr>
+</table>
+
+<form name="testRunnerForm" action="">
+ <script type="text/javascript" language="javascript">
+ if (!jsUnitGetParm('testpage')) {
+ document.write("<p>Enter the filename of the Test Page to be run:</p>");
+ } else {
+ document.write("<br>");
+ };
+ </script>
+
+ <table cellpadding="0" cellspacing="0" border="0" summary="Form for entering test case location">
+ <tr>
+ <td align="center" valign="middle">
+ <script language="JavaScript" type="text/javascript">
+ document.write(top.getDocumentProtocol());
+ </script>
+ </td>
+
+ <td nowrap align="center" valign="bottom">
+ &nbsp;
+ <script language="JavaScript" type="text/javascript">
+ var specifiedTestPage = jsUnitGetParm('testpage');
+ if (specifiedTestPage) {
+ var html = '<input type="hidden" name="testFileName" value="';
+ var valueString = '';
+ if ((top.getDocumentProtocol() == 'http://' || top.getDocumentProtocol() == 'https://') && jsUnitGetParm('testpage').indexOf('/') == 0)
+ valueString += top.location.host;
+ valueString += specifiedTestPage;
+ var testParms = top.jsUnitConstructTestParms();
+ if (testParms != '') {
+ valueString += '?';
+ valueString += testParms;
+ }
+ html += valueString;
+ html += '">';
+ html += valueString;
+ document.write(html);
+ } else {
+ if (top.getDocumentProtocol() == 'file:///' && top.browserSupportsReadingFullPathFromFileField())
+ document.write('<input type="file" name="testFileName" size="60">');
+ else
+ document.write('<input type="text" name="testFileName" size="60">');
+ }
+ </script>
+ <input type="button" name="runButton" value="Run" onclick="kickOffTests()">
+ <script type="text/javascript">
+ function jscoverageWindow() {
+ /*
+ the path may have to be adjusted: it should point to the
+ jscoverage.html file (relative to the jsunit/app
+ directory)
+ */
+ window.open("../../jscoverage.html");
+ }
+ </script>
+ <button onclick="jscoverageWindow();">Coverage report</button>
+ </td>
+ </tr>
+ </table>
+ <br>
+ <hr>
+
+ <table cellpadding="0" cellspacing="0" border="0" summary="Choose Trace Level">
+ <tr>
+ <td nowrap>Trace level:</td>
+
+ <td><select name="traceLevel">
+ <option value="0" selected>
+ no tracing
+ </option>
+
+ <option value="1">
+ warning (lowest)
+ </option>
+
+ <option value="2">
+ info
+ </option>
+
+ <option value="3">
+ debug (highest)
+ </option>
+ </select></td>
+
+ <td>&nbsp;&nbsp;&nbsp;</td>
+
+ <td><input type="checkbox" name="closeTraceWindowOnNewRun" checked></td>
+ <td nowrap>Close old trace window on new run</td>
+
+ <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+ <td nowrap>Page load timeout:</td>
+ <td>&nbsp;
+ <script language="javascript" type="text/javascript">
+ document.write('<input type="text" size="2" name="timeout" value="' + top.jsUnitTestManager.TESTPAGE_WAIT_SEC + '">');
+ </script>
+ </td>
+
+ <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+ <td nowrap>Setup page timeout:</td>
+ <td>&nbsp;
+ <script language="javascript" type="text/javascript">
+ document.write('<input type="text" size="2" name="setUpPageTimeout" value="' + top.jsUnitTestManager.SETUPPAGE_TIMEOUT + '">');
+ </script>
+ </td>
+ </tr>
+ </table>
+ <hr>
+</form>
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-errors.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-errors.html
new file mode 100644
index 0000000..cc76ff0
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-errors.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-errors.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<hr>
+
+<form name="testRunnerForm" action="javascript:top.testManager.showMessageForSelectedProblemTest()">
+ <p>Errors and failures:&nbsp;</p>
+ <select size="5" ondblclick="top.testManager.showMessageForSelectedProblemTest()" name="problemsList">
+ <option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
+ </select>
+ <br>
+ <input type="button" value="Show selected" onclick="top.testManager.showMessageForSelectedProblemTest()">
+ &nbsp;&nbsp;&nbsp;
+ <input type="button" value="Show all" onclick="top.testManager.showMessagesForAllProblemTests()">
+</form>
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-frame.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-frame.html
new file mode 100644
index 0000000..af0dc7a
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-frame.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+<head>
+ <title>jsUnit Main Frame</title>
+</head>
+<frameset rows="230,30,30,30,0,*" border="0">>
+ <frame name="mainData" src="main-data.html" scrolling="no" frameborder="0">
+ <frame name="mainStatus" src="main-status.html" scrolling="no" frameborder="0">
+ <frame name="mainProgress" src="main-progress.html" scrolling="no" frameborder="0">
+ <frame name="mainCounts" src="main-counts.html" scrolling="no" frameborder="0">
+ <frame name="mainResults" src="main-results.html" scrolling="no" frameborder="0">
+ <frame name="mainErrors" src="main-errors.html" scrolling="no" frameborder="0">
+ <noframes>
+ <body>
+ <p>Sorry, JsUnit requires frames.</p>
+ </body>
+ </noframes>
+</frameset>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-loader.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-loader.html
new file mode 100644
index 0000000..302c084
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-loader.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>jsUnit External Data Document loader</title>
+ <script language="JavaScript" type="text/javascript">
+
+ var loadStatus;
+ var callback = function () {
+ };
+
+ function buffer() {
+ return window.frames.documentBuffer;
+ }
+
+ function load(uri) {
+ loadStatus = 'loading';
+ buffer().document.location.href = uri;
+ }
+
+ function loadComplete() {
+ top.xbDEBUG.dump('main-loader.html:loadComplete(): loadStatus = ' + loadStatus + ' href=' + buffer().document.location.href);
+ if (loadStatus == 'loading') {
+ loadStatus = 'complete';
+ callback();
+ callback = function () {
+ };
+ }
+ }
+
+ if (top.xbDEBUG.on) {
+ var scopeName = 'main_loader_' + (new Date()).getTime();
+ top[scopeName] = window;
+ top.xbDebugTraceFunction(scopeName, 'buffer');
+ top.xbDebugTraceFunction(scopeName, 'load');
+ top.xbDebugTraceFunction(scopeName, 'loadComplete');
+ }
+
+ </script>
+</head>
+
+<body>
+<iframe name="documentBuffer" onload="loadComplete()"></iframe>
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-progress.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-progress.html
new file mode 100644
index 0000000..5ca52f6
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-progress.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-progress.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<table width="375" cellpadding="0" cellspacing="0" border="0" summary="Test progress indicator">
+ <tr>
+ <td width="65" valign="top"><b>Progress:</b></td>
+
+ <td width="300" height="14" valign="middle">
+ <table width="300" cellpadding="0" cellspacing="0" border="1" summary="Progress image">
+ <tr>
+ <td width="300" height="14" valign="top"><img name="progress" height="14" width="0"
+ alt="progress image" src="../images/green.gif"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-results.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-results.html
new file mode 100644
index 0000000..5a904cd
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-results.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-results.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<script language="javascript" type="text/javascript">
+ var DEFAULT_SUBMIT_WEBSERVER = "localhost:8080";
+
+ function submitUrlFromSpecifiedUrl() {
+ var result = "";
+ var specifiedUrl = top.getSpecifiedResultUrl();
+ if (specifiedUrl.indexOf("http://") != 0)
+ result = "http://";
+ result += specifiedUrl;
+ return result;
+ }
+
+ function submitUrlFromTestRunnerLocation() {
+ var result = "http://";
+ var webserver = top.getWebserver();
+ if (webserver == null) // running over file:///
+ webserver = DEFAULT_SUBMIT_WEBSERVER;
+ result += webserver;
+ result += "/jsunit/acceptor";
+ return result;
+ }
+
+ var submitUrl = "";
+ if (top.wasResultUrlSpecified()) {
+ submitUrl = submitUrlFromSpecifiedUrl();
+ } else {
+ submitUrl = submitUrlFromTestRunnerLocation();
+ }
+
+ var formString = "<form name=\"resultsForm\" action=\"" + submitUrl + "\" method=\"post\" target=\"_top\">";
+ document.write(formString);
+</script>
+<input type="hidden" name="id">
+<input type="hidden" name="userAgent">
+<input type="hidden" name="jsUnitVersion">
+<input type="hidden" name="time">
+<input type="hidden" name="url">
+<input type="hidden" name="cacheBuster">
+<select size="5" name="testCases" multiple></select>
+</form>
+<script language="javascript" type="text/javascript">
+ function populateHeaderFields(id, userAgent, jsUnitVersion, baseURL) {
+ document.resultsForm.id.value = id;
+ document.resultsForm.userAgent.value = userAgent;
+ document.resultsForm.jsUnitVersion.value = jsUnitVersion;
+ document.resultsForm.url.value = baseURL;
+ document.resultsForm.cacheBuster.value = new Date().getTime();
+ }
+ function submitResults() {
+ var testCasesField = document.resultsForm.testCases;
+ for (var i = 0; i < testCasesField.length; i++) {
+ testCasesField[i].selected = true;
+ }
+ document.resultsForm.submit();
+ }
+</script>
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-status.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-status.html
new file mode 100644
index 0000000..1053f5d
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/main-status.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit main-status.html</title>
+ <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
+</head>
+
+<body>
+<div id="content"><b>Status:</b> (Idle)</div>
+
+</body>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainer.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainer.html
new file mode 100644
index 0000000..df6a997
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainer.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit Test Container</title>
+</head>
+<frameset rows="0, *" border="0">
+ <frame name="testContainerController" src="testContainerController.html">
+ <frame name="testFrame" src="emptyPage.html">
+ <noframes>
+ <body>
+ <p>Sorry, JsUnit requires frames.</p>
+ </body>
+ </noframes>
+</frameset>
+</html>
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainerController.html b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainerController.html
new file mode 100644
index 0000000..3130d76
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/testContainerController.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit Test Container Controller</title>
+ <script language="javascript" type="text/javascript">
+ var containerReady = false;
+
+ function init() {
+ containerReady = true;
+ }
+
+ function isPageLoaded() {
+ if (!containerReady)
+ return false;
+
+ var isTestPageLoaded = false;
+
+ try {
+ // attempt to access the var isTestPageLoaded in the testFrame
+ if (typeof(top.testManager.containerTestFrame.isTestPageLoaded) != 'undefined') {
+ isTestPageLoaded = top.testManager.containerTestFrame.isTestPageLoaded;
+ }
+
+ // ok, if the above did not throw an exception, then the
+ // variable is defined. If the onload has not fired in the
+ // testFrame then isTestPageLoaded is still false. Otherwise
+ // the testFrame has set it to true
+ }
+ catch (e) {
+ // an error occured while attempting to access the isTestPageLoaded
+ // in the testFrame, therefore the testFrame has not loaded yet
+ isTestPageLoaded = false;
+ }
+ return isTestPageLoaded;
+ }
+
+ function isContainerReady() {
+ return containerReady;
+ }
+
+ function setNotReady() {
+ try {
+ // attempt to set the isTestPageLoaded variable
+ // in the test frame to false.
+ top.testManager.containerTestFrame.isTestPageLoaded = false;
+ }
+ catch (e) {
+ // testFrame.isTestPageLoaded not available... ignore
+ }
+ }
+ function setTestPage(testPageURI) {
+ setNotReady();
+ top.jsUnitParseParms(testPageURI);
+ testPageURI = appendCacheBusterParameterTo(testPageURI);
+ try {
+ top.testManager.containerTestFrame.location.href = testPageURI;
+ } catch (e) {
+ }
+ }
+
+ function appendCacheBusterParameterTo(testPageURI) {
+ if (testPageURI.indexOf("?") == -1)
+ testPageURI += "?";
+ else
+ testPageURI += "&";
+ testPageURI += "cacheBuster=";
+ testPageURI += new Date().getTime();
+ return testPageURI;
+ }
+ </script>
+</head>
+
+<body onload="init()">
+Test Container Controller
+</body>
+</html> \ No newline at end of file
diff --git a/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/xbDebug.js b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/xbDebug.js
new file mode 100644
index 0000000..b7167ec
--- /dev/null
+++ b/tools/node_modules/expresso/deps/jscoverage/doc/example-jsunit/jsunit/app/xbDebug.js
@@ -0,0 +1,306 @@
+// xbDebug.js revision: 0.003 2002-02-26
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ * Full Terms at /xbProjects-srce/license/mpl-tri-license.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Bob Clary <bclary@netscape.com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ChangeLog:
+
+2002-02-25: bclary - modified xbDebugTraceOject to make sure
+ that original versions of wrapped functions were not
+ rewrapped. This had caused an infinite loop in IE.
+
+2002-02-07: bclary - modified xbDebug.prototype.close to not null
+ the debug window reference. This can cause problems with
+ Internet Explorer if the page is refreshed. These issues will
+ be addressed at a later date.
+*/
+
+function xbDebug()
+{
+ this.on = false;
+ this.stack = new Array();
+ this.debugwindow = null;
+ this.execprofile = new Object();
+}
+
+xbDebug.prototype.push = function ()
+{
+ this.stack[this.stack.length] = this.on;
+ this.on = true;
+}
+
+xbDebug.prototype.pop = function ()
+{
+ this.on = this.stack[this.stack.length - 1];
+ --this.stack.length;
+}
+
+xbDebug.prototype.open = function ()
+{
+ if (this.debugwindow && !this.debugwindow.closed)
+ this.close();
+
+ this.debugwindow = window.open('about:blank', 'DEBUGWINDOW', 'height=400,width=600,resizable=yes,scrollbars=yes');
+
+ this.debugwindow.title = 'xbDebug Window';
+ this.debugwindow.document.write('<html><head><title>xbDebug Window</title></head><body><h3>Javascript Debug Window</h3></body></html>');
+ this.debugwindow.focus();
+}
+
+xbDebug.prototype.close = function ()
+{
+ if (!this.debugwindow)
+ return;
+
+ if (!this.debugwindow.closed)
+ this.debugwindow.close();
+
+ // bc 2002-02-07, other windows may still hold a reference to this: this.debugwindow = null;
+}
+
+xbDebug.prototype.dump = function (msg)
+{
+ if (!this.on)
+ return;
+
+ if (!this.debugwindow || this.debugwindow.closed)
+ this.open();
+
+ this.debugwindow.document.write(msg + '<br>');
+
+ return;
+}
+
+var xbDEBUG = new xbDebug();
+
+window.onunload = function () {
+ xbDEBUG.close();
+}
+
+function xbDebugGetFunctionName(funcref)
+{
+
+ if (!funcref)
+ {
+ return '';
+ }
+
+ if (funcref.name)
+ return funcref.name;
+
+ var name = funcref + '';
+ name = name.substring(name.indexOf(' ') + 1, name.indexOf('('));
+ funcref.name = name;
+
+ if (!name) alert('name not defined');
+ return name;
+}
+
+// emulate functionref.apply for IE mac and IE win < 5.5
+function xbDebugApplyFunction(funcname, funcref, thisref, argumentsref)
+{
+ var rv;
+
+ if (!funcref)
+ {
+ alert('xbDebugApplyFunction: funcref is null');
+ }
+
+ if (typeof(funcref.apply) != 'undefined')
+ return funcref.apply(thisref, argumentsref);
+
+ var applyexpr = 'thisref.xbDebug_orig_' + funcname + '(';
+ var i;
+
+ for (i = 0; i < argumentsref.length; i++)
+ {
+ applyexpr += 'argumentsref[' + i + '],';
+ }
+
+ if (argumentsref.length > 0)
+ {
+ applyexpr = applyexpr.substring(0, applyexpr.length - 1);
+ }
+
+ applyexpr += ')';
+
+ return eval(applyexpr);
+}
+
+function xbDebugCreateFunctionWrapper(scopename, funcname, precall, postcall)
+{
+ var wrappedfunc;
+ var scopeobject = eval(scopename);
+ var funcref = scopeobject[funcname];
+
+ scopeobject['xbDebug_orig_' + funcname] = funcref;
+
+ wrappedfunc = function ()
+ {
+ var rv;
+
+ precall(scopename, funcname, arguments);
+ rv = xbDebugApplyFunction(funcname, funcref, scopeobject, arguments);
+ postcall(scopename, funcname, arguments, rv);
+ return rv;
+ };
+
+ if (typeof(funcref.constructor) != 'undefined')
+ wrappedfunc.constructor = funcref.constuctor;
+
+ if (typeof(funcref.prototype) != 'undefined')
+ wrappedfunc.prototype = funcref.prototype;
+
+ scopeobject[funcname] = wrappedfunc;
+}
+
+function xbDebugCreateMethodWrapper(contextname, classname, methodname, precall, postcall)
+{
+ var context = eval(contextname);
+ var methodref = context[classname].prototype[methodname];
+
+ context[classname].prototype['xbDebug_orig_' + methodname] = methodref;
+
+ var wrappedmethod = function ()
+ {
+ var rv;
+ // eval 'this' at method run time to pick up reference to the object's instance
+ var thisref = eval('this');
+ // eval 'arguments' at method run time to pick up method's arguments
+ var argsref = arguments;
+
+ precall(contextname + '.' + classname, methodname, argsref);
+ rv = xbDebugApplyFunction(methodname, methodref, thisref, argsref);
+ postcall(contextname + '.' + classname, methodname, argsref, rv);
+ return rv;
+ };
+
+ return wrappedmethod;
+}
+
+function xbDebugPersistToString(obj)
+{
+ var s = '';
+ var p;
+
+ if (obj == null)
+ return 'null';
+
+ switch (typeof(obj))
+ {
+ case 'number':
+ return obj;
+ case 'string':
+ return '"' + obj + '"';
+ case 'undefined':
+ return 'undefined';
+ case 'boolean':
+ return obj + '';
+ }
+
+ if (obj.constructor)
+ return '[' + xbDebugGetFunctionName(obj.constructor) + ']';
+
+ return null;
+}
+
+function xbDebugTraceBefore(scopename, funcname, funcarguments)
+{
+ var i;
+ var s = '';
+ var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
+ if (!execprofile)
+ execprofile = xbDEBUG.execprofile[scopename + '.' + funcname] = { started: 0, time: 0, count: 0 };
+
+ for (i = 0; i < funcarguments.length; i++)
+ {
+ s += xbDebugPersistToString(funcarguments[i]);
+ if (i < funcarguments.length - 1)
+ s += ', ';
+ }
+
+ xbDEBUG.dump('enter ' + scopename + '.' + funcname + '(' + s + ')');
+ execprofile.started = (new Date()).getTime();
+}
+
+function xbDebugTraceAfter(scopename, funcname, funcarguments, rv)
+{
+ var i;
+ var s = '';
+ var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
+ if (!execprofile)
+ xbDEBUG.dump('xbDebugTraceAfter: execprofile not created for ' + scopename + '.' + funcname);
+ else if (execprofile.started == 0)
+ xbDEBUG.dump('xbDebugTraceAfter: execprofile.started == 0 for ' + scopename + '.' + funcname);
+ else
+ {
+ execprofile.time += (new Date()).getTime() - execprofile.started;
+ execprofile.count++;
+ execprofile.started = 0;
+ }
+
+ for (i = 0; i < funcarguments.length; i++)
+ {
+ s += xbDebugPersistToString(funcarguments[i]);
+ if (i < funcarguments.length - 1)
+ s += ', ';
+ }
+
+ xbDEBUG.dump('exit ' + scopename + '.' + funcname + '(' + s + ')==' + xbDebugPersistToString(rv));
+}
+
+function xbDebugTraceFunction(scopename, funcname)
+{
+ xbDebugCreateFunctionWrapper(scopename, funcname, xbDebugTraceBefore, xbDebugTraceAfter);
+}
+
+function xbDebugTraceObject(contextname, classname)
+{
+ var classref = eval(contextname + '.' + classname);
+ var p;
+ var sp;
+
+ if (!classref || !classref.prototype)
+ return;
+
+ for (p in classref.prototype)
+ {
+ sp = p + '';
+ if (typeof(classref.prototype[sp]) == 'function' && (sp).indexOf('xbDebug_orig') == -1)
+ {
+ classref.prototype[sp] = xbDebugCreateMethodWrapper(contextname, classname, sp, xbDebugTraceBefore, xbDebugTraceAfter);
+ }
+ }
+}
+
+function xbDebugDumpProfile()
+{
+ var p;
+ var execprofile;
+ var avg;
+
+ for (p in xbDEBUG.execprofile)
+ {
+ execprofile = xbDEBUG.execprofile[p];
+ avg = Math.round(100 * execprofile.time / execprofile.count) / 100;
+ xbDEBUG.dump('Execution profile ' + p + ' called ' + execprofile.count + ' times. Total time=' + execprofile.time + 'ms. Avg Time=' + avg + 'ms.');
+ }
+}