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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>window.performance User Timing mark() method is throwing the proper exceptions</title>
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#dom-performance-mark"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script type="text/javascript">
// navigation timing attributes
var timingAttributes = [
'connectEnd',
'connectStart',
'domComplete',
'domContentLoadedEventEnd',
'domContentLoadedEventStart',
'domInteractive',
'domLoading',
'domainLookupEnd',
'domainLookupStart',
'fetchStart',
'loadEventEnd',
'loadEventStart',
'navigationStart',
'redirectEnd',
'redirectStart',
'requestStart',
'responseEnd',
'responseStart',
'unloadEventEnd',
'unloadEventStart'
];
// test data
var markExceptionThrown = false;
setup({explicit_done: true});
test_namespace();
function onload_test()
{
// test for existance of User Timing and Performance Timeline interface
if (window.performance.mark == undefined ||
window.performance.clearMarks == undefined ||
window.performance.measure == undefined ||
window.performance.clearMeasures == undefined ||
window.performance.getEntriesByName == undefined ||
window.performance.getEntriesByType == undefined ||
window.performance.getEntries == undefined)
{
test_true(false,
"The User Timing and Performance Timeline interfaces, which are required for this test, " +
"are defined.");
done();
}
else
{
test_mark_exceptions();
}
}
function test_mark_exceptions()
{
// loop through mark scenarios
for (var i in timingAttributes)
{
try
{
// create the mark
window.performance.mark(timingAttributes[i]);
test_true(false,
"window.performance.mark(\"" + timingAttributes[i] + "\") threw an exception.");
}
catch(e)
{
test_true(true,
"window.performance.mark(\"" + timingAttributes[i] + "\") threw an exception.");
// confirm that a SYNTAX_ERR exception is thrown and not any other exception
test_equals(e.code,
e.SYNTAX_ERR,
"window.performance.mark(\"" + timingAttributes[i] + "\") threw a SYNTAX_ERR " +
"exception.");
}
}
done();
}
</script>
</head>
<body onload="onload_test();">
<h1>Description</h1>
<p>This test validates that the performance.mark() method throws a SYNTAX_ERR exception whenever a navigation
timing attribute is provided for the name parameter.
</p>
<div id="log"></div>
</body>
</html>
|