mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-testsNEL: Generate reports in HTTPNetworkTransaction Piece by piece, we are moving the Reporting and NEL processing code from URLRequest and friends into HTTPNetworkTransaction, to make sure that we produce reports for network requests as defined by the spec. This patch moves the generation of the actual NEL reports, and includes some new WPT test cases that verify that we create reports correctly for redirects and cached responses. [email protected] Bug: 895823 Change-Id: Ie8e17a2a2b3571a7cdfd39057da486f5ad2c9f6f Reviewed-on: https://chromium-review.googlesource.com/c/1318169 Commit-Queue: Douglas Creager <[email protected]> Reviewed-by: Misha Efimov <[email protected]> Cr-Commit-Position: refs/heads/master@{#606958} -- wpt-commits: 9902fbae9124fb565389983e49235d82cf429242 wpt-pr: 14007
43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>
|
|
Test that NEL reports are sent for cache validation requests
|
|
</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, but whose response requires
|
|
// validation. Do this *before* fetching the NEL policy for this origin,
|
|
// to ensure that we don't generate any report about this request.
|
|
await fetchValidatedCachedResource();
|
|
// Fetch the NEL policy for this origin.
|
|
await fetchResourceWithBasicPolicy();
|
|
// Fetch the now-cached resource again. Because the response requires
|
|
// validation, this will result in a network request.
|
|
await fetchValidatedCachedResource();
|
|
// We should receive a report about the cache validation request.
|
|
assert_true(await reportExists({
|
|
url: getURLForValidatedCachedResource(),
|
|
user_agent: navigator.userAgent,
|
|
type: "network-error",
|
|
body: {
|
|
method: "GET",
|
|
sampling_fraction: 1.0,
|
|
status_code: 304,
|
|
phase: "application",
|
|
type: "ok",
|
|
},
|
|
metadata: {
|
|
content_type: "application/reports+json",
|
|
},
|
|
}));
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|