sends-report-on-subdomain-dns-failure.https.html (1576B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title> 5 Test that include_subdomains policies report DNS failures for subdomains 6 </title> 7 <script src='/resources/testharness.js'></script> 8 <script src='/resources/testharnessreport.js'></script> 9 <script src='./support/nel.sub.js'></script> 10 </head> 11 <body> 12 <script> 13 nel_test(async t => { 14 // Make a request to a resource whose response headers include an 15 // include_subdomains NEL policy. 16 await fetchResourceWithIncludeSubdomainsPolicy(); 17 // Make a request to another resource on a nonexistent subdomain of the 18 // above. Since the subdomain doesn't exist, the request should fail with 19 // a DNS error. 20 await fetchResourceWithNoPolicy('nonexistent').then((response) => { 21 assert_unreached("Request to nonexistent domain should fail"); 22 }, (err) => { 23 // Silence the error, since it's expected. 24 }); 25 // The include_subdomains policy that we just received should cover the 26 // second request, since include_subdomains policies can report on DNS 27 // errors, so the collector should have received a report about it. 28 assert_true(await reportExists({ 29 url: getSanitizedURLForResourceWithNoPolicy('nonexistent'), 30 user_agent: navigator.userAgent, 31 type: "network-error", 32 body: { 33 sampling_fraction: 1.0, 34 phase: "dns", 35 type: "dns.name_not_resolved", 36 }, 37 metadata: { 38 content_type: "application/reports+json", 39 }, 40 })); 41 }); 42 </script> 43 </body> 44 </html>