Update web-platform-tests to revision 7da6acfd668e66adae5ab4e2d389810d3b1460be

This commit is contained in:
James Graham
2015-10-05 17:15:15 +01:00
parent 50db64a20e
commit bae87d193d
307 changed files with 35826 additions and 209 deletions

View File

@@ -0,0 +1,9 @@
<!doctype html>
1
<script>
onload = parent.t.step_func(function() {
setTimeout(function() {
location = location.toString().replace("assign_after_load-1.html", "assign_after_load-2.html");
}, 100);
});
</script>

View File

@@ -0,0 +1,7 @@
<!doctype html>
2
<script>
onload = parent.t.step_func(function() {
setTimeout(function() {parent.do_test()}, 100);
});
</script>

View File

@@ -0,0 +1,23 @@
<!doctype html>
<title>Assignment to location after document is completely loaded</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe></iframe>
<script>
var t = async_test();
var history_length;
onload = t.step_func(function() {
setTimeout(function() {
history_length = history.length;
document.getElementsByTagName("iframe")[0].src = "assign_after_load-1.html";
}, 100);
});
do_test = t.step_func(function() {
assert_equals(history.length, history_length + 2);
t.done();
});
</script>

View File

@@ -0,0 +1,7 @@
<!doctype html>
1
<script>
onload = parent.t.step_func(function() {
location = location.toString().replace("assign_before_load-1.html", "assign_before_load-2.html");
});
</script>

View File

@@ -0,0 +1,7 @@
<!doctype html>
2
<script>
onload = parent.t.step_func(function() {
setTimeout(function() {parent.do_test()}, 100);
});
</script>

View File

@@ -0,0 +1,23 @@
<!doctype html>
<title>Assignment to location before document is completely loaded</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe></iframe>
<script>
var t = async_test();
var history_length;
onload = t.step_func(function() {
setTimeout(function() {
history_length = history.length;
document.getElementsByTagName("iframe")[0].src = "assign_before_load-1.html";
}, 100);
});
do_test = t.step_func(function() {
assert_equals(history.length, history_length + 1);
t.done();
});
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>document.location</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var doc = document.implementation.createHTMLDocument("");
assert_equals(doc.location, null);
}, "document not in a browsing context");
test(function() {
assert_equals(document.location, location);
}, "document.location equals window.location");
</script>

View File

@@ -0,0 +1,24 @@
<!doctype html>
<title>location.assign with initial about:blank browsing context</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe></iframe>
<script>
var t = async_test();
var history_length;
onload = t.step_func(function() {
setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.onload = t.step_func(function() {
setTimeout(t.step_func(function() {
assert_equals(history.length, history_length);
t.done();
}), 100);
});
history_length = history.length;
iframe.src = "location_assign_about_blank-1.html"
}), 100);
});
</script>

View File

@@ -0,0 +1,7 @@
<!doctype html>
<script>
opener.history_length = history.length;
</script>
<a onclick="location = 'manual_click_assign_during_load-2.html'; return false;" href>Click Here</a>
<p>Filler image to keep the page loading:</p>
<img src="/media/2048x1360-random.jpg?pipe=trickle(d1:1:r2)">

View File

@@ -0,0 +1,7 @@
<!doctype html>
<p>This window should close itself and the test result appear in the original window
<script>
onload = function() {
setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
}
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>Assignment to location with click during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
setup({timeout:3600000});
var t = async_test(undefined, {timeout:3600000});
var win = window.open("manual_click_assign_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length + 1);
t.done();
});
</script>

View File

@@ -0,0 +1,10 @@
<!doctype html>
<script>
opener.history_length = history.length;
</script>
<a onclick="location.replace('manual_click_location_replace_during_load-2.html'); return false;" href>Click Here</a>
<p>Filler image to keep the page loading:</p>
<img>
<script>
document.images[0].src = "/media/2048x1360-random.jpg?pipe=trickle(d1:1:r2)&random=" + Math.random();
</script>

View File

@@ -0,0 +1,7 @@
<!doctype html>
<p>This window should close itself and the test result appear in the original window
<script>
onload = function() {
setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
}
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>location.replace with click during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
setup({timeout:3600000});
var t = async_test(undefined, {timeout:3600000});
var win = window.open("manual_click_location_replace_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length);
t.done();
});
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>Assignment to location with click during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
setup({timeout:3600000});
var t = async_test(undefined, {timeout:3600000});
var win = window.open("manual_click_replace_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length);
t.done();
});
</script>

View File

@@ -0,0 +1,9 @@
<!doctype html>
<script>
opener.history_length = history.length;
</script>
<form onsubmit="location = 'manual_form_submit_assign_during_load-2.html'; return false;">
<input type=submit value="Click Me">
</form>
<p>Filler image to keep the page loading:</p>
<img src="/media/2048x1360-random.jpg?pipe=trickle(d1:1:r2)">

View File

@@ -0,0 +1,7 @@
<!doctype html>
<p>This window should close itself and the test result appear in the original window
<script>
onload = function() {
setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
}
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>Assignment to location with form submit during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
setup({timeout:3600000});
var t = async_test(undefined, {timeout:3600000});
var win = window.open("manual_form_submit_assign_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length + 1);
t.done();
});
</script>

View File

@@ -0,0 +1,15 @@
<!doctype html>
<p>Resize this window. FAIL if the window doesn't close shortly afterwards.</p>
<script>
onload = opener.t.step_func(function() {
opener.load_count++;
if (opener.load_count > 1) {
opener.do_test();
}
})
onresize = opener.t.step_func(function() {
opener.flag_resized();
location.reload();
});
</script>

View File

@@ -0,0 +1,26 @@
<!doctype html>
<title>Reload called from resize event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>Resize the popup window. That window should then close and the result be presented here. If that window doesn't close after resize that's a FAIL.</p>
<div id="log"></div>
<script>
setup({timeout:3600000})
var t = async_test(undefined, {timeout:3600000});
var load_count = 0;
var resized = false;
var win = window.open("reload_in_resize-1.html")
flag_resized = t.step_func(function() {
resized = true;
setTimeout(do_test, 1000);
});
do_test = t.step_func(function() {
win.close();
assert_true(resized, "Resize event happened");
assert_equals(load_count, 1, "Number of load events");
t.done();
});
</script>

View File

@@ -0,0 +1,14 @@
<!doctype html>
1
<script>
function f() {
opener.postMessage("original", "*");
setTimeout(function () {
document.open();
document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>");
document.close();
}), 100;
}
window.onload = f
</script>

View File

@@ -0,0 +1,26 @@
<!doctype html>
<title>Reload document with document.open and document.written content</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var win = window.open("reload_document_open_write-1.html");
var t = async_test();
var data = [];
window.onmessage = t.step_func(function(e) {
data.push(e.data);
if (data.length < 3) {
win.location.reload();
} else {
setTimeout(t.step_func(function() {
assert_array_equals(data, ["original", "written", "written"]);
t.done();
}), 500);
}
});
add_completion_callback(function() {win.close()});
</script>

View File

@@ -0,0 +1,4 @@
<script>
document.write(Math.random());
opener.postMessage(document.body.innerHTML, "*");
</script>

View File

@@ -0,0 +1,21 @@
<!doctype html>
<title>Reload document with document.written content</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var win = window.open("reload_document_write-1.html");
var t = async_test();
window.onmessage = t.step_func(function(e) {
var initial_value = e.data;
win.location.reload();
window.onmessage = t.step_func(function(e) {
assert_true(e.data !== initial_value);
t.done();
});
});
add_completion_callback(function() {win.close()});
</script>

View File

@@ -0,0 +1,9 @@
<script>
function f() {
opener.postMessage("original", "*");
document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>");
document.close();
}
window.onload = f
</script>

View File

@@ -0,0 +1,26 @@
<!doctype html>
<title>Reload document with document.written content written in load event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var win = window.open("reload_document_write_onload-1.html");
var t = async_test();
var data = [];
window.onmessage = t.step_func(function(e) {
data.push(e.data);
if (data.length < 3) {
win.location.reload();
} else {
setTimeout(t.step_func(function() {
assert_array_equals(data, ["original", "written", "written"]);
t.done();
}), 500);
}
});
add_completion_callback(function() {win.close()});
</script>

View File

@@ -0,0 +1,10 @@
<script>
onload = function() {opener.next()}
document.write(Math.random());
</script>
<form method="POST" action="">
<input type=hidden name=test value=test>
<input type=submit>
</form>
<button onclick="location.reload()">Reload</button>

View File

@@ -0,0 +1,27 @@
<!doctype html>
<title>Reload document with POST</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var win = window.open("reload_post_1-1.html");
var t = async_test();
var posted = false;
var reloaded = false;
next = t.step_func(function() {
if (posted && !reloaded) {
reloaded = true;
win.location.reload();
} else if (posted && reloaded) {
t.done();
} else {
posted = true;
win.document.forms[0].submit();
}
});
add_completion_callback(function() {win.close()});
</script>

View File

@@ -0,0 +1,10 @@
<!doctype html>
<script>
opener.history_length = history.length;
</script>
<a onclick="location = 'scripted_click_assign_during_load-2.html'; return false;" href>Click Here</a>
<script>
document.links[0].click()
</script>
<p>Filler image to keep the page loading:</p>
<img src="/media/2048x1360-random.jpg?pipe=trickle(d1:1:r2)">

View File

@@ -0,0 +1,7 @@
<!doctype html>
<p>This window should close itself and the test result appear in the original window
<script>
onload = function() {
setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
}
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>Assignment to location with click during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
setup({timeout:3600000});
var t = async_test(undefined, {timeout:3600000});
var win = window.open("scripted_click_assign_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length);
t.done();
});
</script>

View File

@@ -0,0 +1,13 @@
<!doctype html>
<script>
opener.history_length = history.length;
</script>
<a onclick="location.assign('scripted_click_location_assign_during_load-2.html'); return false;" href>Click Here</a>
<script>
document.links[0].click()
</script>
<p>Filler image to keep the page loading:</p>
<img>
<script>
document.images[0].src = "/media/2048x1360-random.jpg?pipe=trickle(d1:1:r2)&random=" + Math.random()
</script>

View File

@@ -0,0 +1,7 @@
<!doctype html>
<p>This window should close itself and the test result appear in the original window
<script>
onload = function() {
setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
}
</script>

View File

@@ -0,0 +1,16 @@
<!doctype html>
<title>location.assign with click during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
var t = async_test();
var win = window.open("scripted_click_location_assign_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length + 1);
t.done();
});
</script>

View File

@@ -0,0 +1,12 @@
<!doctype html>
<script>
opener.history_length = history.length;
</script>
<form onsubmit="location = 'scripted_form_submit_assign_during_load-2.html'; return false;">
<input type=submit value="Click Me">
</form>
<script>
document.forms[0].elements[0].click()
</script>
<p>Filler image to keep the page loading:</p>
<img src="/media/2048x1360-random.jpg?pipe=trickle(d1:1:r2)">

View File

@@ -0,0 +1,7 @@
<!doctype html>
<p>This window should close itself and the test result appear in the original window
<script>
onload = function() {
setTimeout(function() {opener.do_test(history.length); window.close();}, 100);
}
</script>

View File

@@ -0,0 +1,17 @@
<!doctype html>
<title>Assignment to location with form submit during load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>The popup blocker must be disabled for this test</p>
<div id="log"></div>
<script>
setup({timeout:3600000});
var t = async_test(undefined, {timeout:3600000});
var win = window.open("scripted_form_submit_assign_during_load-1.html");
var history_length;
do_test = t.step_func(function(new_length) {
assert_equals(new_length, history_length);
t.done();
});
</script>