https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 34dfe32379a4e905b318f825fd6eab4c96bfc8c4 authored by Luke Bjerring on 11 May 2018, 19:30:08 UTC
Merge branch 'master' into idlharness-dependencies
Tip revision: 34dfe32
idlharness.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Navigation Timing IDL tests</title>
<link rel="author" title="W3C" href="http://www.w3.org/" />
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"/>
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<h1>Navigation Timing IDL tests</h1>
<div id="log"></div>

<pre id='untested_idl' style='display:none'>
typedef double DOMHighResTimeStamp;

[Exposed=(Window,Worker)]
interface Performance {
};

[Exposed=(Window,Worker)]
interface PerformanceEntry {
    readonly attribute DOMString           name;
    readonly attribute DOMString           entryType;
    readonly attribute DOMHighResTimeStamp startTime;
    readonly attribute DOMHighResTimeStamp duration;
    [Default] object toJSON();
  };

[Exposed=(Window,Worker)]
interface PerformanceResourceTiming : PerformanceEntry {
    readonly attribute DOMString           initiatorType;
    readonly attribute DOMString           nextHopProtocol;
    readonly attribute DOMHighResTimeStamp workerStart;
    readonly attribute DOMHighResTimeStamp redirectStart;
    readonly attribute DOMHighResTimeStamp redirectEnd;
    readonly attribute DOMHighResTimeStamp fetchStart;
    readonly attribute DOMHighResTimeStamp domainLookupStart;
    readonly attribute DOMHighResTimeStamp domainLookupEnd;
    readonly attribute DOMHighResTimeStamp connectStart;
    readonly attribute DOMHighResTimeStamp connectEnd;
    readonly attribute DOMHighResTimeStamp secureConnectionStart;
    readonly attribute DOMHighResTimeStamp requestStart;
    readonly attribute DOMHighResTimeStamp responseStart;
    readonly attribute DOMHighResTimeStamp responseEnd;
    readonly attribute unsigned long long  transferSize;
    readonly attribute unsigned long long  encodedBodySize;
    readonly attribute unsigned long long  decodedBodySize;
    [Default] object toJSON();
  };
</pre>

<pre id='idl'>

[Exposed=Window]
interface PerformanceNavigationTiming : PerformanceResourceTiming {
        readonly        attribute DOMHighResTimeStamp unloadEventStart;
        readonly        attribute DOMHighResTimeStamp unloadEventEnd;
        readonly        attribute DOMHighResTimeStamp domInteractive;
        readonly        attribute DOMHighResTimeStamp domContentLoadedEventStart;
        readonly        attribute DOMHighResTimeStamp domContentLoadedEventEnd;
        readonly        attribute DOMHighResTimeStamp domComplete;
        readonly        attribute DOMHighResTimeStamp loadEventStart;
        readonly        attribute DOMHighResTimeStamp loadEventEnd;
        readonly        attribute NavigationType      type;
        readonly        attribute unsigned short      redirectCount;
        [Default] object toJSON();
};

enum NavigationType {
  "navigate",
  "reload",
  "back_forward",
  "prerender"
};


[Exposed=Window]
interface PerformanceTiming {
  readonly attribute unsigned long long navigationStart;
  readonly attribute unsigned long long unloadEventStart;
  readonly attribute unsigned long long unloadEventEnd;
  readonly attribute unsigned long long redirectStart;
  readonly attribute unsigned long long redirectEnd;
  readonly attribute unsigned long long fetchStart;
  readonly attribute unsigned long long domainLookupStart;
  readonly attribute unsigned long long domainLookupEnd;
  readonly attribute unsigned long long connectStart;
  readonly attribute unsigned long long connectEnd;
  readonly attribute unsigned long long secureConnectionStart;
  readonly attribute unsigned long long requestStart;
  readonly attribute unsigned long long responseStart;
  readonly attribute unsigned long long responseEnd;
  readonly attribute unsigned long long domLoading;
  readonly attribute unsigned long long domInteractive;
  readonly attribute unsigned long long domContentLoadedEventStart;
  readonly attribute unsigned long long domContentLoadedEventEnd;
  readonly attribute unsigned long long domComplete;
  readonly attribute unsigned long long loadEventStart;
  readonly attribute unsigned long long loadEventEnd;
  [Default] object toJSON();
};


[Exposed=Window]
interface PerformanceNavigation {
  const unsigned short TYPE_NAVIGATE = 0;
  const unsigned short TYPE_RELOAD = 1;
  const unsigned short TYPE_BACK_FORWARD = 2;
  const unsigned short TYPE_RESERVED = 255;
  readonly attribute unsigned short type;
  readonly attribute unsigned short redirectCount;
  [Default] object toJSON();
};


// [Exposed=Window]
partial interface Performance {
  [SameObject]
  readonly attribute PerformanceTiming timing;
  [SameObject]
  readonly attribute PerformanceNavigation navigation;
};
</pre>

<script>
(function() {
  var idl_array = new IdlArray();

  idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
  idl_array.add_idls(document.getElementById("idl").textContent);

  idl_array.add_objects({Performance: ["window.performance"],
                         PerformanceNavigation: ["window.performance.navigation"],
                         PerformanceTiming: ["window.performance.timing"],
                         PerformanceNavigationTiming: ["window.performance.getEntriesByType('navigation')[0]"] });

  idl_array.test();
})();
</script>
</body>
</html>
back to top