Bug 1719855 - Take over preventDefaulted infomation for long-tap events to the origin...
[gecko.git] / dom / performance / tests / test_performance_server_timing_plain_http.html
blob7dcb8bd38d316f3bb0471d75a551dd76931e033e
1 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <!DOCTYPE html>
6 <html>
7 <head>
8 <meta charset=utf-8>
9 <title>Plain HTTP Test for PerformanceServerTiming</title>
10 <script src="/resources/testharness.js"></script>
11 <script src="/resources/testharnessreport.js"></script>
12 </head>
13 <body>
14 <div id="log"></div>
15 <script>
16 function makeXHR(aUrl) {
17 var xmlhttp = new XMLHttpRequest();
18 xmlhttp.open("get", aUrl, true);
19 xmlhttp.send();
22 promise_test(t => {
23 var promise = new Promise(resolve => {
24 performance.clearResourceTimings();
26 var observer = new PerformanceObserver(list => resolve(list));
27 observer.observe({entryTypes: ['resource']});
28 t.add_cleanup(() => observer.disconnect());
29 });
31 makeXHR("serverTiming.sjs");
33 return promise.then(list => {
34 assert_equals(list.getEntries().length, 1);
35 assert_equals(list.getEntries()[0].serverTiming, undefined);
36 assert_equals(list.getEntries()[0].toJSON().serverTiming, undefined,
37 "toJSON should not pick up properties that aren't on the object");
38 });
39 }, "server-timing test");
41 </script>
42 </body>