Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="timeout" content="long">
<title>This test validates the response status of resources for Same-Origin Requests.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/entry-invariants.js"></script>
<script src="resources/resource-loaders.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<script>
const {ORIGIN} = get_host_info();
const status_codes = [
200, 203,
400, 401, 403, 404,
500, 501, 502, 503,
];
// Response status for same origin resources is exposed.
for(const loader of [
load.font,
load.image,
load.script,
load.stylesheet,
load.xhr_sync,
load.xhr_async,
load.iframe,
load.image_object,
load.frame_object,
load.null_object
]) {
for(const status of status_codes) {
let path = (loader == load.font) ? '/fonts/pass.woff' :
'/resource-timing/resources/empty.js';
path += `?pipe=status(${status})`;
attribute_test(
loader, new URL(path, ORIGIN),
entry => {
assert_equals(entry.responseStatus, status,
`response status for ${entry.name} should be ${status}`);
}
);
}
}
</script>
</body>
</html>