summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/network-error-logging/no-report-on-unexpired-cached-response.https.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/network-error-logging/no-report-on-unexpired-cached-response.https.html')
-rw-r--r--testing/web-platform/tests/network-error-logging/no-report-on-unexpired-cached-response.https.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/testing/web-platform/tests/network-error-logging/no-report-on-unexpired-cached-response.https.html b/testing/web-platform/tests/network-error-logging/no-report-on-unexpired-cached-response.https.html
new file mode 100644
index 0000000000..8248aa52ec
--- /dev/null
+++ b/testing/web-platform/tests/network-error-logging/no-report-on-unexpired-cached-response.https.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>
+ Test that NEL reports are not sent for cached responses that don't hit the
+ network
+ </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 => {
+ // Fetch a resource that can be cached without validation. Do this
+ // *before* fetching the NEL policy for this origin, to ensure that we
+ // don't generate any report about this request.
+ await fetchCachedResource();
+ // Fetch the NEL policy for this origin.
+ await fetchResourceWithBasicPolicy();
+ // Fetch the now-cached resource again. This should not generate a new
+ // network request.
+ await fetchCachedResource();
+ // Because the cached request did not generate a network request, we
+ // should never receive a report about the request.
+ assert_false(await reportExists({
+ url: getURLForCachedResource(),
+ type: "network-error",
+ }));
+ });
+ </script>
+</body>
+</html>