Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<meta charset="utf-8" />
<title>This test validates that a failed cross-origin fetch creates an opaque network timing entry.
<link rel="author" title="Noam Rosenthal" href="">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/entry-invariants.js"></script>
const validDataURL = 'data:,Hello%2C%20World%21'
const {REMOTE_ORIGIN, ORIGINAL_HOST, HTTP_PORT} = get_host_info();
const validXmlUrl = '/common/dummy.xml';
`${REMOTE_ORIGIN}${validXmlUrl}`, null, `failed cross-origin requests`);
network_error_entry_test(`/common/${validDataURL}`, null, "non-HTTP redirect");
network_error_entry_test('//{{hosts[][nonexistent]}}/common/dummy.xml', null, "DNS failure");
network_error_entry_test(`http://${ORIGINAL_HOST}:${HTTP_PORT}/commo/dummy.xml`, null, "Mixed content");
network_error_entry_test('/common/dummy.xml', {cache: 'only-if-cached', mode: 'same-origin'},
"only-if-cached resource that was not cached");
null, "too many redirects");
// ORB ( will return network errors
// for certain cross-origin fetches. This tests that the same rules apply to
// these fetches. Since ORB (at least as presently implemented) doesn't return
// network errors for fetches, we have to load this case using an <img> element.
// This emulates a case previously tested in service-workers/service-worker/resource-timing.sub.https.html
const orb_loader = (url, _) => new Promise(resolve => {
const img = document.createElement("img");
img.src = url;
img.onerror = resolve;
} );
null, "network error for ORB-blocked response", orb_loader);