mirror of
https://github.com/servo/servo.git
synced 2025-09-04 03:58:23 +01:00
Update web-platform-tests to revision 26e8a76d7fbea0721468e791a325444ac9939a4f
This commit is contained in:
parent
1c2bed5a69
commit
6b4026ce2f
89 changed files with 889 additions and 258 deletions
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>This test validates resource timing information for a timing allowed cross-origin redirect chain.</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.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>
|
||||
setup({explicit_done: true});
|
||||
test_namespace('getEntriesByName');
|
||||
const pageOrigin = document.location.host;
|
||||
const crossOrigin = 'www.' + pageOrigin;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
const context = new PerformanceContext(performance);
|
||||
const entries = context.getEntriesByName(document.getElementById('frameContext').src, 'resource');
|
||||
test_equals(entries.length, 1, 'There should be one entry.');
|
||||
const entry = entries[0];
|
||||
|
||||
test_greater_than(entry.redirectStart, 0, 'redirectStart > 0 in timing allowed cross-origin redirect.');
|
||||
test_equals(entry.redirectStart, entry.startTime, 'redirectStart == startTime in timing allowed cross-origin redirect.');
|
||||
test_greater_than(entry.redirectEnd, entry.redirectStart, 'redirectEnd > redirectStart in timing allowed cross-origin redirect.');
|
||||
test_greater_or_equals(entry.fetchStart, entry.redirectEnd, 'fetchStart >= redirectEnd in timing allowed cross-origin redirect.');
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
|
||||
<script>
|
||||
let destUrl = 'http://' + crossOrigin + '/resource-timing/resources/multi_redirect.py?';
|
||||
destUrl += 'page_origin=' + 'http://' + pageOrigin;
|
||||
destUrl += '&cross_origin=' + 'http://' + crossOrigin;
|
||||
destUrl += '&timing_allow=1';
|
||||
const frameContext = document.getElementById('frameContext');
|
||||
frameContext.onload = onload_test;
|
||||
frameContext.src = destUrl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>This test validates resource timing information for a cross-origin redirect chain.</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.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>
|
||||
setup({explicit_done: true});
|
||||
test_namespace('getEntriesByName');
|
||||
const pageOrigin = document.location.host;
|
||||
const crossOrigin = 'www.' + pageOrigin;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
const context = new PerformanceContext(performance);
|
||||
const entries = context.getEntriesByName(document.getElementById('frameContext').src, 'resource');
|
||||
test_equals(entries.length, 1, 'There should be one entry.');
|
||||
const entry = entries[0];
|
||||
|
||||
test_equals(entry.redirectStart, 0, 'redirectStart == 0 in cross-origin redirect.');
|
||||
test_equals(entry.redirectEnd, 0, 'redirectEnd == 0 in cross-origin redirect.');
|
||||
test_greater_than(entry.fetchStart, 0, 'fetchStart > 0 in cross-origin redirect.');
|
||||
test_equals(entry.startTime, entry.fetchStart, 'startTime == fetchStart in cross-origin redirect.');
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
|
||||
<script>
|
||||
let destUrl = 'http://' + crossOrigin + '/resource-timing/resources/multi_redirect.py?';
|
||||
destUrl += 'page_origin=' + 'http://' + pageOrigin;
|
||||
destUrl += '&cross_origin=' + 'http://' + crossOrigin;
|
||||
const frameContext = document.getElementById('frameContext');
|
||||
frameContext.onload = onload_test;
|
||||
frameContext.src = destUrl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,40 @@
|
|||
def main(request, response):
|
||||
"""Handler that causes multiple redirections.
|
||||
The request has two mandatory and one optional query parameters:
|
||||
page_origin - The page origin, used for redirection and to set TAO. This is a mandatory parameter.
|
||||
cross_origin - The cross origin used to make this a cross-origin redirect. This is a mandatory parameter.
|
||||
timing_allow - Whether TAO should be set or not in the redirect chain. This is an optional parameter. Default: not set.
|
||||
Note that |step| is a parameter used internally for the multi-redirect. It's the step we're at in the redirect chain.
|
||||
"""
|
||||
step = 1
|
||||
if "step" in request.GET:
|
||||
try:
|
||||
step = int(request.GET.first("step"))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
page_origin = request.GET.first("page_origin")
|
||||
cross_origin = request.GET.first("cross_origin")
|
||||
timing_allow = "0"
|
||||
if "timing_allow" in request.GET:
|
||||
timing_allow = request.GET.first("timing_allow")
|
||||
|
||||
redirect_url = "/resource-timing/resources/multi_redirect.py?"
|
||||
redirect_url += "page_origin=" + page_origin
|
||||
redirect_url += "&cross_origin=" + cross_origin
|
||||
redirect_url += "&timing_allow=" + timing_allow
|
||||
redirect_url += "&step="
|
||||
|
||||
if step == 1:
|
||||
redirect_url = cross_origin + redirect_url + "2"
|
||||
if timing_allow != "0":
|
||||
response.headers.set("timing-allow-origin", page_origin)
|
||||
elif step == 2:
|
||||
redirect_url = page_origin + redirect_url + "3"
|
||||
if timing_allow != "0":
|
||||
response.headers.set("timing-allow-origin", page_origin)
|
||||
else:
|
||||
redirect_url = page_origin + "/resource-timing/resources/blank_page_green.htm"
|
||||
|
||||
response.status = 302
|
||||
response.headers.set("Location", redirect_url)
|
Loading…
Add table
Add a link
Reference in a new issue