testing/web-platform/tests/longtask-timing/longtask-in-raf.html
author Sandor Molnar <smolnar@mozilla.com>
Fri, 11 Jul 2025 19:57:29 +0300 (6 hours ago)
changeset 796221 8ba6984a5604ac7dcf50325b1a0ebadf9e305d22
parent 658339 2e894e162a611f5fc183eed1bd6d382ce0a3c718
permissions -rw-r--r--
Revert "Bug 1972411 - give gnome-shell and pipewire more time to start, and retry the task if we time out. r=jmaher" for causing linux perma failures This reverts commit 2b905fe7199c9210434f7c7f8326b57025c91c55. Revert "Bug 1972411 - make /builds/worker/fetches a volume in the test docker image. r=releng-reviewers,Eijebong" This reverts commit 9d15aecaf6a08b98d3c47f2d0e644e35341b2520.
<!DOCTYPE HTML>
<head>
  <meta charset=utf-8>
  <title>LongTask Timing: long task in rAF</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="resources/utils.js"></script>
</head>
<body>
  <h1>Long Task: requestAnimationFrame</h1>
  <div id="log"></div>
  <script>
    promise_test(async () => {
      assert_implements(window.PerformanceLongTaskTiming, 'Longtasks are not supported.');
      await new Promise(resolve => {
        window.addEventListener('load', resolve);
      });

      let entries = await new Promise(resolve => {
        new PerformanceObserver(
          entryList => {
            const entries = entryList.getEntries().filter(
              e => e.name == 'self' && e.attribution[0].containerType == 'window');
            if (entries) {
              resolve(entries);
            }
          }).observe({ entryTypes: ['longtask'] });

        const script = document.createElement('script');
        script.src = 'resources/raflongtask.js';
        document.body.appendChild(script);
      });

      assert_equals(entries.length, 1,
        'Exactly one entry is expected.');
      const longtask = entries[0];
      checkLongTaskEntry(longtask);
      // Assert the TaskAttributionTiming entry in attribution.
      assert_equals(longtask.attribution.length, 1,
        'Exactly one attribution entry is expected');
      const attribution = longtask.attribution[0];
      assert_equals(attribution.entryType, 'taskattribution');
      assert_equals(attribution.name, 'unknown');
      assert_equals(attribution.duration, 0);
      assert_equals(attribution.startTime, 0);
      assert_equals(attribution.containerType, 'window');
      assert_equals(attribution.containerId, '');
      assert_equals(attribution.containerName, '');
      assert_equals(attribution.containerSrc, '');
    }, 'Performance longtask entries are observable.');
  </script>
</body>