mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision a3b0fadc7f5001bbe52c65e0a354c454981423a3
This commit is contained in:
parent
6bb495338b
commit
3bbee99cdb
29 changed files with 730 additions and 4 deletions
|
@ -0,0 +1,112 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Parsing of meta refresh</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<style>
|
||||
iframe { display:none }
|
||||
</style>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
// failure to parse is []
|
||||
// success to parse is [time, url] where url is unresolved
|
||||
|
||||
var tests_arr = [
|
||||
{input: '', expected: []},
|
||||
{input: '1', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1 ', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1\t', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1\r', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1\n', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1\f', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1;', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1,', expected: [1, 'refresh.sub.html']},
|
||||
{input: '1; url=foo', expected: [1, 'foo']},
|
||||
{input: '1, url=foo', expected: [1, 'foo']},
|
||||
{input: '1 url=foo', expected: [1, 'foo']},
|
||||
{input: '1;\turl=foo', expected: [1, 'foo']},
|
||||
{input: '1,\turl=foo', expected: [1, 'foo']},
|
||||
{input: '1\turl=foo', expected: [1, 'foo']},
|
||||
{input: '1;\rurl=foo', expected: [1, 'foo']},
|
||||
{input: '1,\rurl=foo', expected: [1, 'foo']},
|
||||
{input: '1\rurl=foo', expected: [1, 'foo']},
|
||||
{input: '1;\nurl=foo', expected: [1, 'foo']},
|
||||
{input: '1,\nurl=foo', expected: [1, 'foo']},
|
||||
{input: '1\nurl=foo', expected: [1, 'foo']},
|
||||
{input: '1;\furl=foo', expected: [1, 'foo']},
|
||||
{input: '1,\furl=foo', expected: [1, 'foo']},
|
||||
{input: '1\furl=foo', expected: [1, 'foo']},
|
||||
{input: '1url=foo', expected: []},
|
||||
{input: '1x;url=foo', expected: []},
|
||||
{input: '1 x;url=foo', expected: [1, 'x;url=foo']},
|
||||
{input: '1;;url=foo', expected: [1, ';url=foo']},
|
||||
{input: ' 1 ; url = foo', expected: [1, 'foo']},
|
||||
{input: ' 1 , url = foo', expected: [1, 'foo']},
|
||||
{input: ' 1 ; foo', expected: [1, 'foo']},
|
||||
{input: ' 1 , foo', expected: [1, 'foo']},
|
||||
{input: ' 1 url = foo', expected: [1, 'foo']},
|
||||
{input: '1; url=foo ', expected: [1, 'foo']},
|
||||
{input: '1; url=f\to\no', expected: [1, 'foo']},
|
||||
{input: '1; url="foo"bar', expected: [1, 'foo']},
|
||||
{input: '1; url=\'foo\'bar', expected: [1, 'foo']},
|
||||
{input: '1; url="foo\'bar', expected: [1, 'foo\'bar']},
|
||||
{input: '1; url foo', expected: [1, 'url foo']},
|
||||
{input: '1; urlfoo', expected: [1, 'urlfoo']},
|
||||
{input: '1; urfoo', expected: [1, 'urfoo']},
|
||||
{input: '1; ufoo', expected: [1, 'ufoo']},
|
||||
{input: '1; "foo"bar', expected: [1, 'foo']},
|
||||
{input: '; foo', expected: []},
|
||||
{input: ', foo', expected: []},
|
||||
{input: 'foo', expected: []},
|
||||
{input: '+1; url=foo', expected: []},
|
||||
{input: '-1; url=foo', expected: []},
|
||||
{input: '+0; url=foo', expected: []},
|
||||
{input: '-0; url=foo', expected: []},
|
||||
{input: '0; url=foo', expected: [0, 'foo']},
|
||||
{input: '+1; foo', expected: []},
|
||||
{input: '-1; foo', expected: []},
|
||||
{input: '+0; foo', expected: []},
|
||||
{input: '-0; foo', expected: []},
|
||||
{input: '0; foo', expected: [0, 'foo']},
|
||||
{input: '+1', expected: []},
|
||||
{input: '-1', expected: []},
|
||||
{input: '+0', expected: []},
|
||||
{input: '-0', expected: []},
|
||||
{input: '0', expected: [0, 'refresh.sub.html']},
|
||||
{input: '1.9; url=foo', expected: [1, 'foo']},
|
||||
{input: '1.9..5.; url=foo', expected: [1, 'foo']},
|
||||
{input: '.9; url=foo', expected: []},
|
||||
];
|
||||
|
||||
tests_arr.forEach(function(test_obj) {
|
||||
async_test(function(t) {
|
||||
var iframe = document.createElement('iframe');
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(iframe);
|
||||
});
|
||||
iframe.src = 'support/refresh.sub.html?input=' + encodeURIComponent(test_obj.input);
|
||||
document.body.appendChild(iframe);
|
||||
var loadCount = 0;
|
||||
iframe.onload = t.step_func(function() {
|
||||
loadCount++;
|
||||
if (test_obj.expected.length === 0) {
|
||||
assert_equals(iframe.contentDocument.body.textContent, 'no redirect\n');
|
||||
if (loadCount === 1) {
|
||||
setTimeout(function() {
|
||||
t.done();
|
||||
}, 3000); // want to make sure it doesn't redirect when it shouldn't
|
||||
} else {
|
||||
assert_unreached('Got > 1 load events');
|
||||
}
|
||||
} else {
|
||||
if (loadCount === 2) {
|
||||
var path = iframe.contentWindow.location.pathname;
|
||||
assert_equals(decodeURIComponent(path.substr(path.lastIndexOf('/') + 1)), test_obj.expected[1]);
|
||||
t.done();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, format_value(test_obj.input));
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
<!doctype html><meta http-equiv=refresh content="{{GET[input]}}">no redirect
|
Loading…
Add table
Add a link
Reference in a new issue