Update web-platform-tests to revision 314de955a5102650136404f6439f22f8d838e0f4

This commit is contained in:
WPT Sync Bot 2018-05-23 21:10:23 -04:00
parent 521748c01e
commit 6b4094e2a4
133 changed files with 1609 additions and 628 deletions

View file

@ -0,0 +1,41 @@
<!doctype html>
<meta charset=windows-1252>
<title>Fragment navigation: encoding</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div style=height:10000px></div>
<div id=&#xFFFD;></div>
<div id=&#xFEFF;&#xFFFD;></div>
<script>
function goToTop() {
location.hash = "top";
assert_equals(self.scrollY, 0, "#top");
}
test(() => {
assert_equals(location.hash, "", "Page must be loaded with no hash");
location.hash = "%C2";
assert_equals(location.hash, "#%C2");
assert_greater_than(self.scrollY, 1000, "#%C2");
}, "Invalid percent-encoded UTF-8 byte should decode as U+FFFD");
test(() => {
goToTop();
location.hash = "%EF%BB%BF%C2";
assert_equals(location.hash, "#%EF%BB%BF%C2");
assert_greater_than(self.scrollY, 1000, "#%EF%BB%BF%C2");
}, "Percent-encoded UTF-8 BOM followed by invalid UTF-8 byte should decode as U+FEFF U+FFFD");
test(() => {
goToTop();
location.hash = "%EF%BF%BD";
assert_equals(location.hash, "#%EF%BF%BD");
assert_greater_than(self.scrollY, 1000, "#%EF%BF%BD");
goToTop();
}, "Percent-encoded UTF-8 byte sequence for U+FFFD should decode as U+FFFD");
</script>

View file

@ -0,0 +1,37 @@
<!doctype html>
<meta charset=windows-1252>
<title>Fragment navigation: encoding</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div style=height:10000px></div>
<div id=&#xFF;></div>
<div id=&#xFEFF;></div>
<script>
function goToTop() {
location.hash = "top";
assert_equals(self.scrollY, 0, "#top");
}
test(() => {
assert_equals(location.hash, "", "Page must be loaded with no hash");
location.hash = "\u00FF";
assert_equals(location.hash, "#%C3%BF");
assert_greater_than(self.scrollY, 1000, "#%C3%BF");
}, "U+00FF should find U+00FF");
test(() => {
goToTop();
location.hash = "%EF%BB%BF";
assert_greater_than(self.scrollY, 1000, "#%EF%BB%BF");
}, "Percent-encoded UTF-8 BOM should find U+FEFF as BOM is not stripped when decoding");
test(() => {
goToTop();
location.hash = "%FF";
assert_equals(self.scrollY, 0, "#%FF");
}, "%FF should not find U+00FF as decoding it gives U+FFFD");
</script>

View file

@ -15,7 +15,10 @@ onload = function() {setTimeout(function() {
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()});
// Step 4 of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents
// doesn't seem to allow navigation within a beforeunload handler,
// so the counter should not go beyond 1.
iframe.onload = t.step_func(function() {assert_equals(counter, 1); t.done()});
};
iframe.src = "navigation-within-beforeunload-1.html?" + Math.random();