GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: update hr-time web platform tests · nodejs/node@ba1915d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/fixtures/wpt
    • README.md
    • hr-time
      • clamped-time-origin-isolated.https.html.headers
      • clamped-time-origin-isolated.https.html
      • clamped-time-origin.html
      • cross-origin-isolated-timing-attack.https.html.headers
      • cross-origin-isolated-timing-attack.https.html
      • idlharness-shadowrealm.window.js
      • navigation-start-post-before-unload.html
      • resources
        • clamped-time-origin.js
        • post.html
        • timing-attack.js
      • timing-attack.html
    • versions.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/fixtures/wpt/README.md‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Last update:
1616
- dom/events: https://github.com/web-platform-tests/wpt/tree/f8821adb28/dom/events
1717
- encoding: https://github.com/web-platform-tests/wpt/tree/c1b24fce6e/encoding
1818
- FileAPI: https://github.com/web-platform-tests/wpt/tree/3b279420d4/FileAPI
19-
- hr-time: https://github.com/web-platform-tests/wpt/tree/9910784394/hr-time
19+
- hr-time: https://github.com/web-platform-tests/wpt/tree/34cafd797e/hr-time
2020
- html/webappapis/atob: https://github.com/web-platform-tests/wpt/tree/f267e1dca6/html/webappapis/atob
2121
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
2222
- html/webappapis/structured-clone: https://github.com/web-platform-tests/wpt/tree/47d3fb280c/html/webappapis/structured-clone
Collapse file

‎test/fixtures/wpt/hr-time/clamped-time-origin-isolated.https.html‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="resources/clamped-time-origin.js"></script>
7+
</head>
8+
<body>
9+
<script>
10+
// Isolated contexts should be clamped to 5 microseconds.
11+
run_test(/*isolated=*/true);
12+
</script>
13+
</body>
14+
</html>
Collapse file

‎test/fixtures/wpt/hr-time/clamped-time-origin-isolated.https.html.headers‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Cross-Origin-Embedder-Policy: require-corp
2+
Cross-Origin-Opener-Policy: same-origin
Collapse file

‎test/fixtures/wpt/hr-time/clamped-time-origin.html‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="resources/clamped-time-origin.js"></script>
7+
</head>
8+
<body>
9+
<script>
10+
// Non-isolated contexts should be clamped to 100 microseconds.
11+
run_test(/*isolated=*/false);
12+
</script>
13+
</body>
14+
</html>
Collapse file

‎test/fixtures/wpt/hr-time/cross-origin-isolated-timing-attack.https.html‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>window.performance.now should not enable timing attacks</title>
6+
<link rel="author" title="W3C" href="http://www.w3.org/" />
7+
<link rel="help" href="http://w3c.github.io/hr-time/#privacy-security"/>
8+
<script src="/resources/testharness.js"></script>
9+
<script src="/resources/testharnessreport.js"></script>
10+
<script src="resources/timing-attack.js"></script>
11+
<script>
12+
run_test(/*isolated=*/true);
13+
</script>
14+
</head>
15+
<body>
16+
<h1>Description</h1>
17+
<p>The recommended minimum resolution of the Performance interface should be set to 5 microseconds.</p>
18+
19+
<div id="log"></div>
20+
21+
</body>
22+
</html>
Collapse file

‎test/fixtures/wpt/hr-time/cross-origin-isolated-timing-attack.https.html.headers‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Cross-Origin-Embedder-Policy: require-corp
2+
Cross-Origin-Opener-Policy: same-origin
Collapse file

‎test/fixtures/wpt/hr-time/idlharness-shadowrealm.window.js‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// META: script=/resources/idlharness-shadowrealm.js
2+
idl_test_shadowrealm(["hr-time"], ["html", "dom"]);
Collapse file

‎test/fixtures/wpt/hr-time/navigation-start-post-before-unload.html‎

Copy file name to clipboard
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
</head>
7+
<body>
8+
<script>
9+
function busyWait(millis) {
10+
const start = performance.now();
11+
while (performance.now() < start + millis) {}
12+
}
13+
promise_test(async t => {
14+
const delay = 3000;
15+
const iframe = document.createElement('iframe');
16+
iframe.src = './resources/now_frame.html';
17+
document.body.appendChild(iframe);
18+
await new Promise(resolve => iframe.addEventListener('load', resolve));
19+
iframe.contentWindow.addEventListener('beforeunload', () => {
20+
busyWait(delay);
21+
});
22+
iframe.src = './resources/post.html';
23+
await new Promise(resolve => this.addEventListener('message', ({data}) => {
24+
if (data === 'done')
25+
resolve();
26+
}));
27+
28+
const entry = iframe.contentWindow.performance.getEntriesByType('navigation')[0];
29+
assert_less_than(entry.fetchStart, delay);
30+
}, 'timeOrigin should be set after beforeunload');
31+
</script>
32+
</body>
33+
</html>
Collapse file

‎test/fixtures/wpt/hr-time/resources/clamped-time-origin.js‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const run_test = isolated => {
2+
// Multiplier to convert the clamped timestamps to microseconds.
3+
const multiplier = 1000;
4+
const windowOrigin = performance.timeOrigin;
5+
// Clamp to at least 5 microseconds in isolated contexts and at least 100 in
6+
// non-isolated ones.
7+
const resolution = isolated ? 5 : 100;
8+
9+
const create_worker = () => {
10+
return new Promise(resolve => {
11+
const workerScript = 'postMessage({timeOrigin: performance.timeOrigin})';
12+
const blob = new Blob([workerScript]);
13+
const worker = new Worker(URL.createObjectURL(blob));
14+
worker.addEventListener('message', event => {
15+
resolve(event.data.timeOrigin);
16+
});
17+
});
18+
};
19+
promise_test(async t => {
20+
assert_equals(self.crossOriginIsolated, isolated,
21+
"crossOriginIsolated is properly set");
22+
let prev = windowOrigin;
23+
let current;
24+
for (let i = 1; i < 100; ++i) {
25+
current = await create_worker();
26+
assert_true(current === prev || current - prev > resolution / 1000);
27+
prev = current;
28+
}
29+
}, 'timeOrigins are clamped.');
30+
};
Collapse file

‎test/fixtures/wpt/hr-time/resources/post.html‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!DOCTYPE HTML>
2+
<script>
3+
window.parent.postMessage('done');
4+
</script>

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.