2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
9 <title>Plain HTTP Test for PerformanceServerTiming
</title>
10 <script src=
"/resources/testharness.js"></script>
11 <script src=
"/resources/testharnessreport.js"></script>
16 function makeXHR(aUrl
) {
17 var xmlhttp
= new XMLHttpRequest();
18 xmlhttp
.open("get", aUrl
, true);
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());
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");
39 }, "server-timing test");