Update web-platform-tests to revision 6fa9de7201cd41564d02c3edd62365aeb40e171b

This commit is contained in:
WPT Sync Bot 2019-07-20 10:25:14 +00:00
parent 60f1ffc5a7
commit dc1f7ba3ec
124 changed files with 2052 additions and 849 deletions

View file

@ -10,7 +10,12 @@
<iframe id="srcdoc-iframe"
srcdoc="<div style='height: 200vh'></div><div id='test'></div>"></iframe>
<script>
test(function () {
function resetHash() {
location.hash = "";
}
test(function (t) {
t.add_cleanup(resetHash);
window.history.pushState(1, document.title, '#x=1');
var hash = location.hash;
@ -30,6 +35,30 @@
assert_true(frameWin.scrollY > frameWin.innerHeight,
"Should have scrolled by more than one viewport height");
}));
test(function(t) {
t.add_cleanup(resetHash);
location.hash = "test";
assert_equals(location.hash, "#test");
}, "Setting hash should automatically include hash character");
test(function(t) {
t.add_cleanup(resetHash);
location.hash = "#not encoded";
assert_equals(location.hash, "#not%20encoded");
}, "Setting hash should encode incompatible characters");
test(function(t) {
t.add_cleanup(resetHash);
location.hash = "#already%20encoded";
assert_equals(location.hash, "#already%20encoded");
}, "Setting hash to an already encoded value should not double encode it");
test(function(t) {
t.add_cleanup(resetHash);
location.hash = "#mixed encoding%20here";
assert_equals(location.hash, "#mixed%20encoding%20here");
}, "Setting hash which is partially encoded should only encode incompatible characters");
</script>
</body>
</html>

View file

@ -6,6 +6,7 @@
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script> <!-- Use token() to allow running tests in parallel -->
<div id="log"></div>
@ -13,23 +14,19 @@
"use strict";
promise_test(t => {
const channelName = token();
return Promise.all([
createIFrame("resources/broadcastchannel-iframe.html"),
createIFrame("resources/broadcastchannel-iframe.html"),
createIFrame("resources/broadcastchannel-iframe.html")
createIFrame(`resources/broadcastchannel-iframe.html?channel=${channelName}&index=0`),
createIFrame(`resources/broadcastchannel-iframe.html?channel=${channelName}&index=1`),
createIFrame(`resources/broadcastchannel-iframe.html?channel=${channelName}&index=2`)
]).then(() => {
const sab = new SharedArrayBuffer(3);
const view = new Uint8Array(sab);
const channel = new BroadcastChannel("channel name");
const channel = new BroadcastChannel(channelName);
return new Promise(resolve => {
let soFar = 0;
channel.onmessage = t.step_func(({ data: { sab: broadcastSAB, i } }) => {
if (broadcastSAB) {
// We only care about "broadcasts" from the workers.
return;
}
channel.onmessage = t.step_func(({ data: { i } }) => {
assert_in_array(i, [0, 1, 2], "Any message events must come from expected sources");
++soFar;

View file

@ -0,0 +1,2 @@
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

View file

@ -4,10 +4,13 @@
<script>
"use strict";
const channel = new BroadcastChannel("channel name");
const query = new URLSearchParams(location.search);
const channel = new BroadcastChannel(query.get("channel"));
const i = Number(query.get("index"));
channel.onmessage = ({ data: { sab, i }, source }) => {
if (!sab) {
channel.onmessage = e => {
const sab = e.data.sab;
if (sab === undefined) {
// We only care about "broadcasts" from the window
return;
}

View file

@ -10,12 +10,20 @@ async_test(function(t) {
var img = document.getElementById("brokenurl");
img.src = "http://[";
var errorevent = false;
var loadendevent = false;
// The errors should be queued in the event loop, so they should only trigger
// after this block of code finishes, not during the img.src setter itself
img.addEventListener('error', t.step_func(function(){errorevent = true;}));
img.addEventListener('loadend', t.step_func_done(function() {
img.addEventListener('error', t.step_func(function() {
assert_false(loadendevent, "loadend should fire after error");
errorevent = true;
t.step_timeout(t.step_func_done(function() {
assert_true(loadendevent, "loadend event fired");
}), 0);
}));
img.addEventListener('loadend', t.step_func(function() {
assert_true(errorevent, "error event fired");
loadendevent = true;
}));
}, 'src="http://["');
@ -31,8 +39,8 @@ async_test(function(t) {
// Queue this check in the event loop to check there is no loadend event
// fired.
t.step_timeout(t.step_func_done(function() {
assert_false(loadendevent, "loadend event should not fired");
}), 0)
assert_false(loadendevent, "loadend event should not be fired");
}), 0);
}));
img.addEventListener('loadend', t.step_func(function() {
loadendevent = true;