зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1493545 [wpt PR 13179] - [resource-timing] Add TAO test for multiple wildcards, a=testonly
Automatic update from web-platform-testsMerge pull request #13179 from yoavweiss/multiple_wildcard_test [resource-timing] Add TAO test for multiple wildcards -- wpt-commits: 3d117ae1266e6bd039a3a1ab92b27e82c3ccc92d wpt-pr: 13179
This commit is contained in:
Родитель
7146c61e9c
Коммит
e29cb99620
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Resource Timing TAO tests</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/>
|
||||
<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});
|
||||
|
||||
// explicitly test the namespace before we start testing
|
||||
test_namespace("getEntriesByType");
|
||||
|
||||
var d;
|
||||
var iframe;
|
||||
var iframeBody;
|
||||
var image;
|
||||
var random = Math.random();
|
||||
|
||||
function setup_iframe() {
|
||||
iframe = document.getElementById('frameContext');
|
||||
d = iframe.contentWindow.document;
|
||||
iframeBody = d.body;
|
||||
iframe.addEventListener('load', onload_test, false);
|
||||
}
|
||||
function onload_test() {
|
||||
if (window.performance.getEntriesByType === undefined) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
test_not_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should not be all returned as 0 when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma, i.e. TAO algorithm passes');
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
window.setup_iframe = setup_iframe;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that for a cross origin resource, the timing allow check algorithm will pass when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma.</p>
|
||||
<div id="log"></div>
|
||||
<iframe id="frameContext" src="resources/iframe_TAO_multi_wildcard.html"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ function onload_test() {
|
|||
var context = new PerformanceContext(iframe.contentWindow.performance);
|
||||
var entries = context.getEntriesByType('resource');
|
||||
|
||||
assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry.");
|
||||
if(entries.length > 0) {
|
||||
entry = entries[0];
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ def main(request, response):
|
|||
# more than one TAO values, seperated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', origin)
|
||||
response.headers.append('Timing-Allow-Origin', '*')
|
||||
elif tao == 'multi_wildcard':
|
||||
# multiple wildcards, seperated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', '*')
|
||||
response.headers.append('Timing-Allow-Origin', '*')
|
||||
elif tao == 'match_origin':
|
||||
# contains a match of origin, seperated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', origin)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<body>
|
||||
<script>
|
||||
function dirname(path) {
|
||||
return path.replace(/\/[^\/]*$/, '/');
|
||||
}
|
||||
|
||||
function request() {
|
||||
var dirName = dirname(location.href);
|
||||
// create a cross-origin request
|
||||
var url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=multi_wildcard';
|
||||
var img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
if(window.parent.setup_iframe) {
|
||||
window.parent.setup_iframe();
|
||||
request();
|
||||
}
|
||||
</script>
|
||||
</body>
|
Загрузка…
Ссылка в новой задаче