https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c952312a927eb56c33bf72d2062c6986cac96ff0 authored by Darwin Huang on 26 December 2018, 21:55:09 UTC
Async Clipboard Refactor: Update tests to use arrow functions
Tip revision: c952312
reports-are-not-observable.https.html
<!DOCTYPE HTML>
<html>
<head>
  <title>
    Test that NEL reports are not observable from JavaScript
  </title>
  <script src='/resources/testharness.js'></script>
  <script src='/resources/testharnessreport.js'></script>
  <script src='./support/nel.sub.js'></script>
</head>
<body>
  <script>
    nel_test(async t => {
      // Register an observer for NEL reports.
      var observer = new ReportingObserver((reports, _) => {
        assert_unreached("NEL reports should not be observable");
      }, {"types": ["network-error"]});
      observer.observe();
      // Make a request to a resource whose response headers include a NEL
      // policy.  If NEL reports are observable, this will queue a task that
      // calls the observer function above (which we don't want).
      await fetchResourceWithBasicPolicy();
      // Wait for one second to give any observer callback task a chance to
      // fire.
      await new Promise(resolve => t.step_timeout(resolve, 1000 /* msec */));
    });
  </script>
</body>
</html>
back to top