DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (cf48e59e88de)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
<!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;
const redirect_url = 'common/redirect.py';
const url_prefix = redirect_url + '?location=/resource-timing/resources/';
const https_url_prefix = redirect_url + '?location=https://{{hosts[alt][]}}:{{ports[https][0]}}/resource-timing/resources/';
function setup_iframe() {
    const iframe_content =
        '<link rel="stylesheet" href="/' + url_prefix + 'resource_timing_test0.css"></link>' +
        '<img src="/' + url_prefix + 'blue.png"></img>' +
        '<iframe src="/' + url_prefix + 'blank_page_green.htm"></iframe>' +
        '<script src="/' + url_prefix + 'empty_script.js"></scr' + 'ipt>' +
        '<scr' + 'ipt>' +
        'const xhr = new XMLHttpRequest;' +
        'xhr.open("GET", "/' + url_prefix + 'blank_page_green.htm?id=xhr", false);' +
        'xhr.send();' +
        'const xhr2 = new XMLHttpRequest;' +
        'xhr2.open("GET", "/' + https_url_prefix + 'blank_page_green.htm?id=xhr", false);' +
        'xhr2.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) + url_prefix;
    const https_pathname = window.location.pathname.substring(0, index) + https_url_prefix;
    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';
    expected_entries[https_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>