Revision b4cdc8ff4bda43c826fe7911e6d8e035390b90fd authored by Marcos Cáceres on 16 April 2018, 07:19:19 UTC, committed by GitHub on 16 April 2018, 07:19:19 UTC
1 parent fa62ac0
resource_redirects.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resource Timing redirect names</title>
<link rel="author" title="Google" href="http://www.google.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
let iframe;
function setup_iframe() {
const iframe_content =
'<link rel="stylesheet" href="/common/redirect.py?location=/resource-timing/resources/resource_timing_test0.css"></link>' +
'<img src="/common/redirect.py?location=/resource-timing/resources/blue.png"></img>' +
'<iframe src="/common/redirect.py?location=/resource-timing/resources/blank_page_green.htm"></iframe>' +
'<script src="/common/redirect.py?location=/resource-timing/resources/empty_script.js"></scr' + 'ipt>' +
'<scr' + 'ipt>' +
'const xhr = new XMLHttpRequest;' +
'xhr.open("GET", "/common/redirect.py?location=/resource-timing/resources/blank_page_green.htm?id=xhr", false);' +
'xhr.send();' +
'</scr' + 'ipt>';
iframe = document.getElementById('frameContext');
iframe.contentWindow.document.write(iframe_content);
}
function onload_test() {
const context = new PerformanceContext(iframe.contentWindow.performance);
const entries = context.getEntriesByType('resource');
const index = window.location.pathname.lastIndexOf('resource-timing');
const pathname = window.location.pathname.substring(0, index) +
'common/redirect.py?location=/resource-timing/resources/';
let expected_entries = {};
expected_entries[pathname + 'resource_timing_test0.css'] = 'link';
expected_entries[pathname + 'blue.png'] = 'img';
expected_entries[pathname + 'blank_page_green.htm'] = 'iframe';
expected_entries[pathname + 'empty_script.js'] = 'script';
expected_entries[pathname + 'blank_page_green.htm?id=xhr'] = 'xmlhttprequest';
test_resource_entries(entries, expected_entries);
}
window.setup_iframe = setup_iframe;
</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates that redirects do not alter the URL.</p>
<div id="log"></div>
<iframe id="frameContext" onload="onload_test();" src="resources/inject_resource_test.html"></iframe>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...