summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/event-timing/resources/crossiframe-childframe.html
blob: 6a8bc6b64240636dbc576aaa15b9c86b799dae8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCType html>
<html>
<body>
<script src=event-timing-test-utils.js></script>
<div style="width: 300px; height: 300px" id='iframe_div' onmousedown="mainThreadBusy(120)">
<script>
(async () => {
  const observerPromise = new Promise(resolve => {
    new PerformanceObserver(entryList => {
      const mouseDowns = entryList.getEntriesByName('mousedown');
      if (mouseDowns.length === 0)
        return;
      resolve(mouseDowns);
    }).observe({ type:'event' });
  });
  const entries = await observerPromise;
  const clickDone = performance.now();
  if (entries.length !== 1) {
    top.postMessage("failed", "*");
    return;
  }
  const entry = entries[0];
  top.postMessage({
    // Entry values (|entry| itself is not clonable)
    "name": entry.name,
    "cancelable": entry.cancelable,
    "entryType": entry.entryType,
    "startTime": entry.startTime,
    "processingStart": entry.processingStart,
    "processingEnd": entry.processingEnd,
    "duration": entry.duration,
    // Other values
    "clickDone" : clickDone,
    "target": entry.target.id,
  }, '*');
}) ();
</script>
</body>
</html>