aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/vendor/benchmark/test/index.html
blob: 9762fb69621cec61279f744f7cf7508c6e8574d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Benchmark.js Test Suite</title>
		<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
		<style>
			applet {
				position: absolute;
				left: -9999em;
			}
		</style>
	</head>
	<body>
		<div id="qunit"></div>
		<script src="../benchmark.js"></script>
		<script src="../vendor/platform.js/platform.js"></script>
		<script>
			(function() {
				var hasOwnProperty = function hasOwnProperty(key) {
					var parent = (this.constructor || Object).prototype;
					return key in this && !(key in parent && this[key] === parent[key]);
				};
				if (typeof {}.hasOwnProperty != 'function') {
					// redefine for Safari 2, else use the less accurate fallback for others
					if ({}.__proto__ == Object.prototype) {
						hasOwnProperty = function hasOwnProperty(key) {
							var result;
							this.__proto__ = [this.__proto__, this.__proto__ = null, result = key in this][0];
							return result;
						};
					}
					Object.prototype.hasOwnProperty = hasOwnProperty;
				}
			}());

			// load the nanosecond timer
			if (!/[?&]nojava=true(?:&|$)/.test(location.search)) {
				document.write('<applet code="nano" archive="../nano.jar"></applet>');
			}

			// avoid syntax errors for `QUnit.throws` in older Firefoxes
			document.write(platform.name == 'Firefox' && /^1\b/.test(platform.version)
				? '<script src="../vendor/qunit/qunit/qunit-1.8.0.js"><\/script>'
				: '<script src="../vendor/qunit/qunit/qunit.js"><\/script>'
			);
		</script>
		<script>
			// load test.js if not using require.js
			document.write(/[?&]norequire=true(?:&|$)/.test(location.search)
				? '<script src="test.js"><\/script>'
				: '<script src="../vendor/requirejs/require.js"><\/script>'
			);
		</script>
		<script>
			// load Benchmark as a module
			var Benchmark2;

			window.require && require({
				'baseUrl': '../vendor/requirejs/',
				'urlArgs': 't=' + (+new Date),
				'paths': {
					'benchmark': '../../benchmark',
					'platform': '../platform.js/platform'
				}
			},
			['benchmark', 'platform'], function(Benchmark, platform) {
				Benchmark2 = Benchmark;
				Benchmark2.platform = platform;
				require(['test.js']);
			});

			// set a more readable browser name
			window.onload = function() {
				var timeoutId = setInterval(function() {
					var ua = document.getElementById('qunit-userAgent');
					if (ua) {
						ua.innerHTML = platform;
						clearInterval(timeoutId);
					}
				}, 15);
			};
		</script>
	</body>
</html>