mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Update web-platform-tests to revision 314de955a5102650136404f6439f22f8d838e0f4
This commit is contained in:
parent
521748c01e
commit
6b4094e2a4
133 changed files with 1609 additions and 628 deletions
|
@ -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=�></div>
|
||||
<div id=�></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>
|
|
@ -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=ÿ></div>
|
||||
<div id=></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>
|
|
@ -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();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
function expected(encoding) {
|
||||
return "?" + {
|
||||
"UTF-8": "%C3%BF",
|
||||
"windows-1251": "&%23255;",
|
||||
"windows-1251": "%26%23255%3B",
|
||||
"windows-1252": "%FF"
|
||||
}[encoding];
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ onload = function() {
|
|||
'utf-16be':'%C3%A5',
|
||||
'utf-16le':'%C3%A5',
|
||||
'windows-1252':'%E5',
|
||||
'windows-1251':'&%23229;'
|
||||
'windows-1251':'%26%23229%3B'
|
||||
};
|
||||
var expected_current = expected_obj[encoding];
|
||||
var expected_utf8 = expected_obj['utf-8'];
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<script src="/common/media.js"></script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
async_test(function(test)
|
||||
{
|
||||
var video = document.createElement("video");
|
||||
|
||||
// Create an out-of-band text track by adding a track element.
|
||||
var trackElement = document.createElement('track');
|
||||
|
||||
trackElement.addEventListener("error", test.step_func(function()
|
||||
{
|
||||
assert_unreached("'error' event on track element should not fire.")
|
||||
}));
|
||||
|
||||
video.appendChild(trackElement);
|
||||
trackElement.src = 'resources/webvtt-file.vtt';
|
||||
trackElement.track.mode = 'hidden';
|
||||
|
||||
assert_equals(video.textTracks.length, 1);
|
||||
var outOfBandTrack = video.textTracks[0];
|
||||
|
||||
// Load a media file with an inband text track.
|
||||
var inbandTrack = null;
|
||||
var url = "resources/vp8-vorbis-webvtt.webm"
|
||||
|
||||
var firstAddTrackHandler = test.step_func(function()
|
||||
{
|
||||
assert_equals(event.target, video.textTracks);
|
||||
assert_equals(event instanceof window.TrackEvent, true);
|
||||
if (event.track == outOfBandTrack) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert_equals(inbandTrack, null);
|
||||
assert_equals(video.textTracks.length, 2);
|
||||
assert_equals(event.track, video.textTracks[1]);
|
||||
inbandTrack = event.track;
|
||||
|
||||
video.textTracks.removeEventListener("addtrack", firstAddTrackHandler);
|
||||
|
||||
// Clear .src to force the inband track to get destroyed.
|
||||
video.src = "";
|
||||
|
||||
// Verify that the inband track was removed.
|
||||
assert_not_equals(inbandTrack, null);
|
||||
assert_equals(video.textTracks.length, 1);
|
||||
assert_equals(video.textTracks[0], outOfBandTrack);
|
||||
|
||||
// Load the URL again to trigger another 'addtrack' event to make sure
|
||||
// no 'removetrack' event was queued.
|
||||
video.src = url;
|
||||
video.textTracks.addEventListener("addtrack", test.step_func(function()
|
||||
{
|
||||
assert_equals(video.textTracks.length, 2);
|
||||
test.done();
|
||||
}));
|
||||
});
|
||||
video.textTracks.addEventListener("addtrack", firstAddTrackHandler);
|
||||
|
||||
video.textTracks.addEventListener("removetrack", test.step_func(function()
|
||||
{
|
||||
assert_unreached("'removetrack' event should not fire.")
|
||||
}));
|
||||
|
||||
video.src = url;
|
||||
}, "Tests that the 'removetrack' event is NOT fired for inband TextTrack on a failed load.");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -34,72 +34,6 @@
|
|||
video.removeChild(trackElement);
|
||||
video.textTracks.addEventListener("removetrack", test.step_func(trackRemoved));
|
||||
}, "Tests that the 'removetrack' event is fired when an out-of-band TextTrack is removed.");
|
||||
|
||||
async_test(function(test)
|
||||
{
|
||||
var video = document.createElement("video");
|
||||
|
||||
// Create an out-of-band text track by adding a track element.
|
||||
var trackElement = document.createElement('track');
|
||||
|
||||
trackElement.addEventListener("error", test.step_func(function()
|
||||
{
|
||||
assert_unreached("'error' event on track element should not fire.")
|
||||
}));
|
||||
|
||||
video.appendChild(trackElement);
|
||||
trackElement.src = 'resources/webvtt-file.vtt';
|
||||
trackElement.track.mode = 'hidden';
|
||||
|
||||
assert_equals(video.textTracks.length, 1);
|
||||
var outOfBandTrack = video.textTracks[0];
|
||||
|
||||
// Load a media file with an inband text track.
|
||||
var inbandTrack = null;
|
||||
var url = "resources/vp8-vorbis-webvtt.webm"
|
||||
|
||||
var firstAddTrackHandler = test.step_func(function()
|
||||
{
|
||||
assert_equals(event.target, video.textTracks);
|
||||
assert_equals(event instanceof window.TrackEvent, true);
|
||||
if (event.track == outOfBandTrack) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert_equals(inbandTrack, null);
|
||||
assert_equals(video.textTracks.length, 2);
|
||||
assert_equals(event.track, video.textTracks[1]);
|
||||
inbandTrack = event.track;
|
||||
|
||||
video.textTracks.removeEventListener("addtrack", firstAddTrackHandler);
|
||||
|
||||
// Clear .src to force the inband track to get destroyed.
|
||||
video.src = "";
|
||||
|
||||
// Verify that the inband track was removed.
|
||||
assert_not_equals(inbandTrack, null);
|
||||
assert_equals(video.textTracks.length, 1);
|
||||
assert_equals(video.textTracks[0], outOfBandTrack);
|
||||
|
||||
// Load the URL again to trigger another 'addtrack' event to make sure
|
||||
// no 'removetrack' event was queued.
|
||||
video.src = url;
|
||||
video.textTracks.addEventListener("addtrack", test.step_func(function()
|
||||
{
|
||||
assert_equals(video.textTracks.length, 2);
|
||||
test.done();
|
||||
}));
|
||||
});
|
||||
video.textTracks.addEventListener("addtrack", firstAddTrackHandler);
|
||||
|
||||
video.textTracks.addEventListener("removetrack", test.step_func(function()
|
||||
{
|
||||
assert_unreached("'removetrack' event should not fire.")
|
||||
}));
|
||||
|
||||
video.src = url;
|
||||
}, "Tests that the 'removetrack' event is NOT fired for inband TextTrack on a failed load.");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<iframe id="testframe" src="form-data-set-usv-form.html"></iframe>
|
||||
<iframe id="testframe2" src="form-data-set-usv-form.html"></iframe>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
async_test(t => {
|
||||
window.onload = t.step_func(() => {
|
||||
window.addEventListener("load", t.step_func(() => {
|
||||
const iframe = document.querySelector("#testframe");
|
||||
const form = iframe.contentWindow.document.querySelector("form");
|
||||
|
||||
|
@ -35,6 +36,17 @@ async_test(t => {
|
|||
});
|
||||
|
||||
form.submit();
|
||||
});
|
||||
});
|
||||
}));
|
||||
}, 'Strings from form controls should be converted to Unicode scalar values in form submission');
|
||||
|
||||
async_test(t => {
|
||||
window.addEventListener("load", t.step_func_done(() => {
|
||||
const iframe = document.querySelector("#testframe2");
|
||||
const formData = new FormData(iframe.contentWindow.document.querySelector("form"));
|
||||
assert_equals(formData.get("input1\uFFFD"), "input1\uFFFD");
|
||||
assert_equals(formData.get("input2\uFFFD"), "input2\uFFFD");
|
||||
assert_equals(formData.get("input3\uFFFD"), "input3\uFFFD");
|
||||
assert_equals(formData.get("input4\uFFFD"), "input4\uFFFD");
|
||||
}));
|
||||
}, 'Strings from form controls should be converted to Unicode scalar values in FormData');
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue