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,33 @@
support 001-1.html
support 001a.html
support 001b.html
001.html
support 002-1.html
support 002a.html
support 002b.html
002.html
support 003-1.html
support 003a.html
support 003b.html
003.html
support 004-1.html
support 004a.html
support 004b.html
004.html
support 005-1.html
support 005a.html
support 005b.html
005.html
base.html
support beforeunload-on-history-back-1.html
beforeunload-on-history-back.html
support beforeunload-on-navigation-of-parent-1.html
support beforeunload-on-navigation-of-parent-2.html
beforeunload-on-navigation-of-parent.html
support navigation-within-beforeunload-1.html
support navigation-within-beforeunload-2.html
navigation-within-beforeunload.html
support pagehide-on-history-forward-1.html
pagehide-on-history-forward.html
dir prompt
dir unload

View file

@ -0,0 +1,14 @@
<!doctype html>
Base
<script>
onpagehide = function() {
if(top.base_hide) {
top.base_hide();
}
}
onpageshow = function() {
if (top.base_show) {
top.base_show();
}
}
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
001-1
<script>
addEventListener("beforeunload", function() {top.t.step(function() {top.beforeunload_fired = true})}, false);
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<title>beforeunload event fires on history navigation back</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
var base_count = 0;
onload = function() {setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = t.step_func(function() {
iframe.onload = null;
history.go(-1);
});
iframe.src = "beforeunload-on-history-back-1.html";
}), 100)};
base_show = t.step_func(function() {
base_count++;
if (base_count > 1) {
assert_true(beforeunload_fired);
t.done();
}
});
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,2 @@
<!doctype html>
<iframe src="beforeunload-on-navigation-of-parent-2.html"></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("beforeunload", function() {parent.parent.beforeunload_fired=true}, false)
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<title>beforeunload in iframe on navigation of parent</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
var base_count = 0;
onload = function() {setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = t.step_func(function() {
iframe.onload = null;
history.go(-1);
});
iframe.src = "beforeunload-on-navigation-of-parent-1.html";
}), 100)};
base_show = t.step_func(function() {
base_count++;
if (base_count > 1) {
assert_true(beforeunload_fired);
t.done();
}
});
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,10 @@
<!doctype html>
004-1
<script>
addEventListener("beforeunload",
function() {
if (top.counter++ < 999) {
location = "navigation-within-beforeunload-2.html?" + top.counter;
}
}, false);
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
document.write(location)
</script>

View file

@ -0,0 +1,26 @@
<!doctype html>
<title>Triggering navigation from withing beforeunload event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
var base_count = 0;
var counter = 0;
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {iframe.contentWindow.location="navigation-within-beforeunload-2.html";}, 100);
iframe.onload = t.step_func(function() {assert_equals(counter, 1000); t.done()});
};
iframe.src = "navigation-within-beforeunload-1.html?" + Math.random();
}, 100)};
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,19 @@
<!doctype html>
<title>pagehide event fires on history navigation forward</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
onload = function() {setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.src = "pagehide-on-history-forward-1.html";
}), 100)};
base_hide = t.step_func(function() {
t.done()
});
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,10 @@
<script>
addEventListener("beforeunload",
function() {
parent.events.push("beforeunload");
}, false);
parent.events.push("before src change");
location.href = "001-2.html&pipe=trickle(d2)";
parent.events.push("after src change");
</script>

View file

@ -0,0 +1,14 @@
<!doctype html>
<title>beforeunload event order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
events = [];
onload = t.step_func(function() {
assert_array_equals(events, ["before src change", "beforeunload", "after src change"]);
t.done();
})
</script>
<iframe src="001-1.html"></iframe>

View file

@ -0,0 +1,7 @@
<script>
addEventListsner("beforeunload", parent.t.step_func(
function(e) {
parent.do_test(e);
}, false);
location.href = "001-2.html&pipe=trickle(d2)";
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>beforeunload event properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
function do_test(e) {
assert_equals(e.type, "beforeunload");
assert_false(e.bubbles, "bubbles");
assert_true(e.cancelable, "bubbles");
assert_equals(e.returnValue, "");
}
onload = t.step_func(function() {
t.done();
})
</script>
<iframe src="001-1.html"></iframe>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>beforeunload event in child frame for parent navigation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
function do_test(e) {
assert_equals(e.type, "beforeunload");
assert_false(e.bubbles, "bubbles");
assert_true(e.cancelable, "bubbles");
assert_equals(e.returnValue, "");
}
onload = t.step_func(function() {
t.done();
})
</script>
<iframe src="001-1.html"></iframe>

View file

@ -0,0 +1,14 @@
support 001-1.html
support 001-2.html
001.html
support 002-1.html
002.html
003.html
manual manual-001.html
manual manual-002.html
manual manual-003.html
manual manual-004.html
manual manual-005.html
manual manual-006.html
support next.html
support slice-and-dice.php

View file

@ -0,0 +1,9 @@
<!doctype html>
<title>Prompt when beforeunload is canceled</title>
<script>
addEventListener("beforeunload",
function(e) {e.preventDefault()},
false);
</script>
<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
<a href="next.html">Click here</a>

View file

@ -0,0 +1,9 @@
<!doctype html>
<title>Prompt when beforeunload has returnValue set</title>
<script>
addEventListener("beforeunload",
function(e) {e.returnValue = "PASS if you see this"},
false);
</script>
<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
<a href="next.html">Click here</a>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>Prompt when beforeunload is canceled</title>
<script>
addEventListener("beforeunload",
function(e) {e.preventDefault()},
false);
</script>
<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p>
<form method="get" action="next.html">
<input type="submit" value="Click here">
</form>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>Prompt on form submit</title>
<script>
addEventListener("beforeunload",
function(e) {e.preventDefault()},
false);
</script>
<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p>
<form method="get" action="next.html">
<input type="submit" value="Click here">
</form>

View file

@ -0,0 +1,22 @@
<!doctype html>
<title>Event loop pause for beforeunload</title>
<script>
var counter = 0;
onload = function count() {
document.getElementById("log").textContent = counter++
setTimeout(count, 200);
}
addEventListener("beforeunload",
function(e) {
e.preventDefault()
},
false);
</script>
<ul>
<li>Click on the link below. When the prompt appears the counter at the bottom must stop incrementing.
<li>Opt not to leave the page. The counter must start incrementing again
</ul>
<p><a href="">Click here</a>
<div id="log"></div>

View file

@ -0,0 +1,9 @@
<!doctype html>
<title>Prompt when beforeunload returns string value</title>
<script>
addEventListener("beforeunload",
function(e) {return "PASS if you see this"},
false);
</script>
<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
<a href="next.html">Click here</a>

View file

@ -0,0 +1,2 @@
<!doctype html>
<p>You should have seen a prompt asking you to unload the previous document

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("pagehide", parent.t.step_func(function() {parent.pagehide_fired = true}), false);
</script>

View file

@ -0,0 +1,2 @@
<!doctype html>
Filler

View file

@ -0,0 +1,25 @@
<!doctype html>
<title>pagehide event on unload</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
pagehide_fired = false;
var t = async_test();
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="001-2.html";
}, 100);
iframe.onload = t.step_func(function() {assert_true(pagehide_fired); t.done()});
};
iframe.src = "001-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("pagehide", parent.t.step_func(parent.do_test()), false);
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<title>pagehide event properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="001-2.html";
}, 100);
iframe.onload = t.step_func(function() {t.done()});
};
function do_test(e) {
assert_equals(e.type, "pagehide");
assert_equals(e.target, iframe.contentDocument);
assert_equals(e.currentTarget, iframe.contentWindow);
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
assert_true(e.persisted, "persisted");
}
iframe.src = "002-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("unload", parent.t.step_func(function(e) {parent.do_test(e)}), false);
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<title>unload event properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var do_test;
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="002-2.html";
}, 100);
iframe.onload = t.step_func(function() {t.done()});
};
do_test = function(e) {
assert_equals(e.type, "unload");
assert_equals(e.target, iframe.contentDocument);
assert_equals(e.currentTarget, iframe.contentWindow);
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}
iframe.src = "003-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,5 @@
<!doctype html>
<script>
addEventListener("pagehide", function() {parent.events.push("pagehide"); setTimeout(function() {parent.events.push("timeout")}, 0)}, false);
addEventListener("unload", function() {parent.events.push("unload")}, false);
</script>

View file

@ -0,0 +1,28 @@
<!doctype html>
<title>pagehide / unload event order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var events = [];
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="001-2.html";
}, 100);
iframe.onload = t.step_func(function() {
assert_array_equals(events, ["pagehide", "unload"])
t.done()});
};
iframe.src = "004-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,20 @@
<!doctype html>
006-1
<script>
onpagehide = function() {
onpagehide = null;
setTimeout(function() {
parent.t.done()
}, 1000);
}
onload = function() {
if (!parent.loaded) {
parent.loaded = true;
setTimeout(parent.t.step_func(
function() {
location="006-2.html?" + Math.random();
}
), 100);
}
}
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
006-2
<script>
onload = function() {setTimeout(parent.t.step_func(function() {history.go(-1)}), 100)}
</script>

View file

@ -0,0 +1,18 @@
<!doctype html>
<title>salvagable state of document after setting pagehide listener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var loaded = false;
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
onload = null;
iframe.src="006-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,21 @@
<!doctype html>
007-1
<script>
onunload = function() {
onunload = null;
parent.unload_fired = true;
setTimeout(function() {
parent.timeout_fired = true;
}, 100);
}
onload = function() {
if (!parent.loaded) {
parent.loaded = true;
setTimeout(parent.t.step_func(
function() {
location="007-2.html?" + Math.random();
}
), 100);
}
}
</script>

View file

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

View file

@ -0,0 +1,28 @@
<!doctype html>
<title>salvagable state of document after setting unload listener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test(undefined, {timeout:2000});
var loaded = false;
var unload_fired = false;
var timeout_fired = false;
function start_test() {
setTimeout(t.step_func(function() {
assert_true(unload_fired);
assert_false(timeout_fired);
t.done()
}), 1000);
}
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
onload = null;
iframe.src="007-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
onpagehide = parent.t.step_func(function() {parent.t.done()});
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>pagehide IDL attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var iframe;
var t = async_test();
onload = setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.src="about:blank";
setTimeout(t.step_func(function() {assert_unreached();}), 1000)
}, 100)
</script>
<iframe src="008-1.html"></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
onunload = parent.t.step_func(function() {parent.t.done()});
</script>

View file

@ -0,0 +1,15 @@
<!doctype html>
<title>unload IDL attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var iframe;
var t = async_test();
onload = setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0];
iframe.src="about:blank";
setTimeout(t.step_func(function() {assert_unreached();}), 1000)
}, 100)
</script>
<iframe src="009-1.html"></iframe>

View file

@ -0,0 +1,21 @@
support 001-1.html
support 001-2.html
001.html
support 002-1.html
002.html
support 003-1.html
003.html
support 004-1.html
004.html
support 006-1.html
support 006-2.html
006.html
support 007-1.html
support 007-2.html
007.html
support 008-1.html
008.html
support 009-1.html
009.html
manual manual-001-1.html
manual manual-001.html

View file

@ -0,0 +1,2 @@
<!doctype html>
<p>Now go back. PASS should be displayed after a short pause

View file

@ -0,0 +1,5 @@
<!doctype html>
<title>Document salvagable state after setting pagehide handler</title>
<script>onpagehide = function() {setTimeout(function(){document.body.innerHTML = "PASS"}, 100)}</script>
<p>Click the link below then navigate back to this page. Shortly after returning you should see the text "PASS"</p>
<p><A href="manual-001-1.html">Click here</a>