• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html>
3    <head>
4        <meta charset="UTF-8" />
5        <title>window.performance User Timing mark() method is throwing the proper exceptions</title>
6        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
7        <link rel="help" href="http://w3c.github.io/user-timing/#dom-performance-mark"/>
8        <script src="/resources/testharness.js"></script>
9        <script src="/resources/testharnessreport.js"></script>
10        <script src="resources/webperftestharness.js"></script>
11
12    <script>
13function test_exception(attrName) {
14    test(function () {
15        assert_throws_dom("SyntaxError", function () {
16            window.performance.mark(attrName);
17        })
18    }, "window.performance.mark(\"" + attrName + "\") throws a SyntaxError exception.");
19}
20
21test(() => {
22    assert_throws_js(TypeError, function() {
23        window.performance.mark();
24    });
25}, 'window.performance.mark() throws a TypeError exception.')
26
27// loop through mark scenarios
28for (var i in timingAttributes) {
29    test_exception(timingAttributes[i]);
30}
31    </script>
32    </head>
33    <body>
34        <h1>Description</h1>
35        <p>This test validates that the performance.mark() method throws a SYNTAX_ERR exception whenever a navigation
36           timing attribute is provided for the name parameter.
37        </p>
38
39        <div id="log"></div>
40    </body>
41</html>
42