fune/testing/web-platform/tests/network-error-logging/reports-are-not-observable.https.html
Douglas Creager fffc55ec5f Bug 1472828 [wpt PR 11758] - Network Error Logging: Add web platform tests, a=testonly
Automatic update from web-platform-testsNetwork Error Logging: Add web platform tests

This adds web-platform-tests for Network Error Logging.  They should be
suitable to upstream into the cross-platform WPT repo.

Bug: 748549
Change-Id: I24098aeec8488c34a5f9239309264e9534dca6e4
Reviewed-on: https://chromium-review.googlesource.com/1106518
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Commit-Queue: Douglas Creager <dcreager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584093}

--

wpt-commits: d0b86dfcab07829407425bad98287757818f96c5
wpt-pr: 11758
2018-08-23 17:06:02 +00:00

29 lines
1 KiB
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>