2 <title>SXG reporting test of sxg.failed for prefetch (zero success fraction)
</title>
3 <script src=
"/resources/testharness.js"></script>
4 <script src=
"/resources/testharnessreport.js"></script>
5 <script src=
"/common/get-host-info.sub.js"></script>
6 <script src=
"/network-error-logging/support/nel.sub.js"></script>
7 <script src=
"../resources/sxg-util.js"></script>
10 const alt_origin
= get_host_info().HTTPS_NOTSAMESITE_ORIGIN
;
11 const test_origin
= get_host_info().HTTPS_ORIGIN
;
14 await
fetchResourceWithZeroSuccessFractionPolicy();
16 alt_origin
+ '/signed-exchange/resources/sxg/sxg-cert-not-found.sxg?prefetch';
18 test_origin
+ '/signed-exchange/resources/not_found_certfile.cbor';
20 assert_true(await
reportExists(
23 user_agent
: navigator
.userAgent
,
24 type
: "network-error",
27 // The origin of this SXG's certURL is different from the reporting
28 // origin. So the report must be downgraded.
32 referrer
: location
.href
,
36 innerURLOrigin() + '/signed-exchange/resources/inner-url.html',
41 content_type
: "application/reports+json",
44 ), 'SXG error reporting must be downgraded when the cert URL is different ' +
45 'from the reporting origin');
46 assert_false(await
reportExists(
49 user_agent
: navigator
.userAgent
,
50 type
: "network-error",
55 referrer
: location
.href
,
58 content_type
: "application/reports+json",
61 ), 'Succeeded normal NEL report should not be sent when success fraction ' +
63 }, 'SXG error report must be downgraded when the cert URL is different from ' +
64 'the reporting origin. And succeeded normal NEL report should not be sent ' +
65 ' when success fraction is zero.');