thirdparty/jsdoctoolkit/app/t/TestDoc.js
author Lennard de Rijk <ljvderijk@gmail.com>
Sun, 25 Oct 2009 18:45:58 -0700
changeset 3052 6907a33ca0a2
parent 3041 c8f47f0b6697
permissions -rw-r--r--
Removed now unused method from Role Logic.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3041
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     1
var TestDoc = {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     2
	fails: 0,
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     3
	plans: 0,
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     4
	passes: 0,
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     5
	results: []
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     6
};
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     7
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     8
TestDoc.record = function(result) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     9
	TestDoc.results.push(result);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    10
	if (typeof result.verdict == "boolean") {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    11
		if (result.verdict === false) TestDoc.fails++;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    12
		if (result.verdict === true) TestDoc.passes++;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    13
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    14
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    15
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    16
TestDoc.prove = function(filePath) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    17
	if (typeof document != "undefined" && typeof document.write != "undefined") {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    18
		if (TestDoc.console) print = function(s) { TestDoc.console.appendChild(document.createTextNode(s+"\n")); }
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    19
		else print = function(s) { document.write(s+"<br />"); }
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    20
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    21
	TestDoc.run(TestDoc.readFile(filePath));
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    22
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    23
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    24
TestDoc.run = function(src) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    25
	try { eval(src); } catch(e) { print("# ERROR! "+e); }
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    26
	
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    27
	var chunks = src.split(/\/\*t:/);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    28
	
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    29
	var run = function(chunk) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    30
		// local shortcuts
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    31
		var is = TestDoc.assertEquals;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    32
		var isnt = TestDoc.assertNotEquals;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    33
		var plan = TestDoc.plan;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    34
		var requires = TestDoc.requires;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    35
		
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    36
		try { eval(chunk); } catch(e) { print("# ERROR! "+e); }
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    37
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    38
	for (var start = -1, end = 0; (start = src.indexOf("/*t:", end)) > end; start = end) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    39
		run(
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    40
			src.substring(
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    41
				start+4,
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    42
				(end = src.indexOf("*/", start))
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    43
			)
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    44
		);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    45
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    46
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    47
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    48
TestDoc.Result = function(verdict, message) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    49
	this.verdict = verdict;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    50
	this.message = message;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    51
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    52
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    53
TestDoc.Result.prototype.toString = function() {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    54
	if (typeof this.verdict == "boolean") {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    55
		return (this.verdict? "ok" : "not ok") + " " + (++TestDoc.report.counter) + " - " + this.message;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    56
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    57
	
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    58
	return "# " + this.message;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    59
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    60
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    61
TestDoc.requires = function(file) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    62
	if (!TestDoc.requires.loaded[file]) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    63
		load(file);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    64
		TestDoc.requires.loaded[file] = true;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    65
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    66
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    67
TestDoc.requires.loaded = {};
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    68
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    69
TestDoc.report = function() {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    70
	TestDoc.report.counter = 0;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    71
	print("1.."+TestDoc.plans);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    72
	for (var i = 0; i < TestDoc.results.length; i++) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    73
		print(TestDoc.results[i]);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    74
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    75
	print("----------------------------------------");
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    76
	if (TestDoc.fails == 0 && TestDoc.passes == TestDoc.plans) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    77
		print("All tests successful.");
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    78
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    79
	else {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    80
		print("Failed " + TestDoc.fails + "/" + TestDoc.plans + " tests, "+((TestDoc.plans == 0)? 0 : Math.round(TestDoc.passes/(TestDoc.passes+TestDoc.fails)*10000)/100)+"% okay. Planned to run "+TestDoc.plans+", did run "+(TestDoc.passes+TestDoc.fails)+".")
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    81
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    82
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    83
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    84
TestDoc.plan = function(n, message) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    85
	TestDoc.plans += n;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    86
	TestDoc.record(new TestDoc.Result(null, message+" ("+n+" tests)"));
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    87
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    88
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    89
TestDoc.assertEquals = function(a, b, message) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    90
	var result = (a == b);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    91
	if (!result) message += "\n#\n# " + a + " does not equal " + b + "\n#";
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    92
	TestDoc.record(new TestDoc.Result(result, message));
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    93
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    94
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    95
TestDoc.assertNotEquals = function(a, b, message) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    96
	var result = (a != b);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    97
	if (!result) message += "\n#\n# " + a + " equals " + b + "\n#";
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    98
	TestDoc.record(new TestDoc.Result(result, message));
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    99
}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   100
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   101
TestDoc.readFile = (function(){
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   102
	// rhino
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   103
	if (typeof readFile == "function") {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   104
		return function(url) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   105
			var text = readFile(url);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   106
			return text || "";
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   107
		}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   108
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   109
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   110
	// a web browser
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   111
	else {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   112
		return function(url) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   113
			var httpRequest;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   114
		
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   115
			if (window.XMLHttpRequest) { // Mozilla, Safari, etc
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   116
				httpRequest = new XMLHttpRequest();
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   117
			} 
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   118
			else if (window.ActiveXObject) { // IE
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   119
				try {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   120
					httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   121
				} 
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   122
				catch (e) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   123
				   try {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   124
						httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   125
					} 
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   126
					catch (e) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   127
					}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   128
				}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   129
			}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   130
		
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   131
			if (!httpRequest) { throw "Cannot create HTTP Request."; }
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   132
			
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   133
			httpRequest.open('GET', url, false);
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   134
			httpRequest.send('');
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   135
			if (httpRequest.readyState == 4) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   136
				if (httpRequest.status >= 400) {
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   137
					throw "The HTTP Request returned an error code: "+httpRequest.status;
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   138
				}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   139
			}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   140
			
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   141
			return httpRequest.responseText || "";
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   142
		}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   143
	}
c8f47f0b6697 JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   144
})();