Update web-platform-tests to revision 33c263fb308d1c3f6ac6d2590d7292317262819d

This commit is contained in:
WPT Sync Bot 2019-08-23 10:24:44 +00:00
parent 5bf00c07c2
commit 482fda3a78
524 changed files with 14686 additions and 3270 deletions

View file

@ -18,9 +18,7 @@
function frameOnload() {
if (next) {
next();
dump("next \n");
} else {
dump("no next \n");
// The test does the following navigation steps for iframe
// 1. load page-with-fragment.html#fragment
// 2. load blank1

View file

@ -0,0 +1,12 @@
async_test(t => {
const frame = document.createElement("iframe");
t.add_cleanup(() => frame.remove());
frame.name = "foo";
frame.src = "/common/blank.html";
frame.onload = t.step_func(() => {
frame.onload = t.unreached_func();
t.step_timeout(() => t.done(), 500);
assert_equals(window[0], window.open(undefined, "foo"));
});
document.body.append(frame);
}, "window.open()'s url parameter default");

View file

@ -0,0 +1,85 @@
<!doctype html>
<html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
const SCOPE = new URL(location.href).pathname;
const SCRIPT =
'resources/sw.js?' +
`pipe=header(service-worker-allowed,${SCOPE})`;
function remote(path) {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
return new URL(path, REMOTE_ORIGIN + '/html/cross-origin-embedder-policy/');
}
promise_test(async (t) => {
const reg = await service_worker_unregister_and_register(t, SCRIPT, SCOPE);
add_completion_callback(() => {
reg.unregister();
});
await new Promise(resolve => {
navigator.serviceWorker.addEventListener('controllerchange', resolve);
});
}, 'setting up');
promise_test(async (t) => {
await fetch('resources/nothing-same-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: same-origin');
promise_test(async (t) => {
await fetch('/common/blank.html', {mode: 'no-cors'});
}, 'making a same-origin request for no CORP');
promise_test(async (t) => {
await fetch('resources/nothing-cross-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt'), {mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin');
promise_test(async (t) => {
await fetch(remote('/common/blank.html'), {mode: 'no-cors'});
}, 'making a cross-origin request for no CORP');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt?passthrough'),
{mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin [PASS THROUGH]');
promise_test(async (t) => {
await fetch(remote('/common/blank.html?passthrough'), {mode: 'no-cors'});
}, 'making a cross-origin request for no CORP [PASS THROUGH]');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt?passthrough'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin [PASS THROUGH]');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'cors'}));
}, 'making a cross-origin request with CORS without ACAO');
promise_test(async (t) => {
const URL = remote(
'/common/blank.html?pipe=header(access-control-allow-origin,*');
await fetch(URL, {mode: 'cors'});
}, 'making a cross-origin request with CORS');
</script>
</html>

View file

@ -0,0 +1,88 @@
<!doctype html>
<html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
const SCOPE = new URL(location.href).pathname;
const SCRIPT =
'resources/sw.js?' +
`pipe=header(service-worker-allowed,${SCOPE})`;
function remote(path) {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
return new URL(path, REMOTE_ORIGIN + '/html/cross-origin-embedder-policy/');
}
promise_test(async (t) => {
const reg = await service_worker_unregister_and_register(t, SCRIPT, SCOPE);
add_completion_callback(() => {
reg.unregister();
});
await new Promise(resolve => {
navigator.serviceWorker.addEventListener('controllerchange', resolve);
});
}, 'setting up');
promise_test(async (t) => {
await fetch('resources/nothing-same-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: same-origin');
promise_test(async (t) => {
await fetch('/common/blank.html', {mode: 'no-cors'});
}, 'making a same-origin request for no CORP');
promise_test(async (t) => {
await fetch('resources/nothing-cross-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt'), {mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'no-cors'}));
}, 'making a cross-origin request for no CORP');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt?passthrough'),
{mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin [PASS THROUGH]');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('/common/blank.html?passthrough'), {mode: 'no-cors'}));
}, 'making a cross-origin request for no CORP [PASS THROUGH]');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt?passthrough'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin [PASS THROUGH]');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'cors'}));
}, 'making a cross-origin request with CORS without ACAO');
promise_test(async (t) => {
const URL = remote(
'/common/blank.html?pipe=header(access-control-allow-origin,*');
await fetch(URL, {mode: 'cors'});
}, 'making a cross-origin request with CORS');
</script>
</html>

View file

@ -0,0 +1 @@
cross-origin-embedder-policy: require-corp

View file

@ -0,0 +1,87 @@
<!doctype html>
<html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
const SCOPE = new URL(location.href).pathname;
const SCRIPT =
'resources/sw.js?' +
`pipe=header(service-worker-allowed,${SCOPE})|` +
'header(cross-origin-embedder-policy,require-corp)';
function remote(path) {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
return new URL(path, REMOTE_ORIGIN + '/html/cross-origin-embedder-policy/');
}
promise_test(async (t) => {
const reg = await service_worker_unregister_and_register(t, SCRIPT, SCOPE);
add_completion_callback(() => {
reg.unregister();
});
await new Promise(resolve => {
navigator.serviceWorker.addEventListener('controllerchange', resolve);
});
}, 'setting up');
promise_test(async (t) => {
await fetch('resources/nothing-same-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: same-origin');
promise_test(async (t) => {
await fetch('/common/blank.html', {mode: 'no-cors'});
}, 'making a same-origin request for no CORP');
promise_test(async (t) => {
await fetch('resources/nothing-cross-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt'), {mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'no-cors'}));
}, 'making a cross-origin request for no CORP');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt?passthrough'),
{mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin [PASS THROUGH]');
promise_test(async (t) => {
await fetch(remote('/common/blank.html?passthrough'), {mode: 'no-cors'});
}, 'making a cross-origin request for no CORP [PASS THROUGH]');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt?passthrough'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin [PASS THROUGH]');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'cors'}));
}, 'making a cross-origin request with CORS without ACAO');
promise_test(async (t) => {
const URL = remote(
'/common/blank.html?pipe=header(access-control-allow-origin,*');
await fetch(URL, {mode: 'cors'});
}, 'making a cross-origin request with CORS');
</script>
</html>

View file

@ -0,0 +1,89 @@
<!doctype html>
<html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<script>
const SCOPE = new URL(location.href).pathname;
const SCRIPT =
'resources/sw.js?' +
`pipe=header(service-worker-allowed,${SCOPE})|` +
'header(cross-origin-embedder-policy,require-corp)';
function remote(path) {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
return new URL(path, REMOTE_ORIGIN + '/html/cross-origin-embedder-policy/');
}
promise_test(async (t) => {
const reg = await service_worker_unregister_and_register(t, SCRIPT, SCOPE);
add_completion_callback(() => {
reg.unregister();
});
await new Promise(resolve => {
navigator.serviceWorker.addEventListener('controllerchange', resolve);
});
}, 'setting up');
promise_test(async (t) => {
await fetch('resources/nothing-same-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: same-origin');
promise_test(async (t) => {
await fetch('/common/blank.html', {mode: 'no-cors'});
}, 'making a same-origin request for no CORP');
promise_test(async (t) => {
await fetch('resources/nothing-cross-origin-corp.txt', {mode: 'no-cors'});
}, 'making a same-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt'), {mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'no-cors'}));
}, 'making a cross-origin request for no CORP');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('resources/nothing-same-origin-corp.txt?passthrough'),
{mode: 'no-cors'}));
}, 'making a cross-origin request for CORP: same-origin [PASS THROUGH]');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(),
fetch(remote('/common/blank.html?passthrough'), {mode: 'no-cors'}));
}, 'making a cross-origin request for no CORP [PASS THROUGH]');
promise_test(async (t) => {
await fetch(
remote('resources/nothing-cross-origin-corp.txt?passthrough'),
{mode: 'no-cors'});
}, 'making a cross-origin request for CORP: cross-origin [PASS THROUGH]');
promise_test(async (t) => {
await promise_rejects(
t, TypeError(), fetch(remote('/common/blank.html'), {mode: 'cors'}));
}, 'making a cross-origin request with CORS without ACAO');
promise_test(async (t) => {
const URL = remote(
'/common/blank.html?pipe=header(access-control-allow-origin,*');
await fetch(URL, {mode: 'cors'});
}, 'making a cross-origin request with CORS');
</script>
</html>

View file

@ -0,0 +1 @@
cross-origin-embedder-policy: require-corp

View file

@ -0,0 +1,12 @@
self.addEventListener('activate', (e) => {
e.waitUntil(clients.claim());
});
self.addEventListener('fetch', (e) => {
const url = new URL(e.request.url);
if (url.searchParams.has('passthrough')) {
return;
}
e.respondWith(fetch(e.request));
});

View file

@ -31,4 +31,4 @@ test(function () {
}, "The hasFocus() method must return false if the Document has no browsing context");
</script>
<iframe id="fr" src="test.html" onload="frame_load()"></iframe>
<iframe id="fr" src="support/test.html" onload="frame_load()"></iframe>

View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>We'll grab a frame from this page to test its tabIndex</title>
<frameset>
<frame></frame>
</frameset>

View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: tabIndex getter return value for frames</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- <frame> elements are harder to test than the rest so they get their own file -->
<body>
<script>
"use strict";
test(() => {
const frame = document.createElement("frame");
assert_equals(frame.tabIndex, 0);
}, "disconnected frame element .tabIndex should return 0 by default");
for (const setValue of [-1, 0, 1]) {
test(() => {
const frame = document.createElement("frame");
frame.setAttribute("tabindex", setValue);
assert_equals(frame.tabIndex, setValue);
}, `disconnected frame element .tabIndex should return ${setValue} when set to ${setValue}`);
}
promise_test(async t => {
const frame = await getFrame(t);
assert_equals(frame.tabIndex, 0);
}, "connected frame element inside frameset .tabIndex should return 0 by default");
for (const setValue of [-1, 0, 1]) {
promise_test(async t => {
const frame = await getFrame(t);
frame.setAttribute("tabindex", setValue);
assert_equals(frame.tabIndex, setValue);
}, `connected frame element inside frameset .tabIndex should return ${setValue} when set to ${setValue}`);
}
function getFrame(t) {
return new Promise((resolve, reject) => {
const iframe = document.createElement("iframe");
t.add_cleanup(() => iframe.remove());
iframe.src = "resources/frameset-using-page.html";
iframe.onload = () => {
resolve(iframe.contentDocument.querySelector("frame"));
};
iframe.onerror = () => reject(new Error("Could not load frameset page"));
document.body.append(iframe);
});
}
</script>

View file

@ -0,0 +1,96 @@
<!doctype html>
<title>HTML: default style for 'appearance'</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
// namespaces
const htmlns = 'http://www.w3.org/1999/xhtml';
const svgns = 'http://www.w3.org/2000/svg';
// auto
testAppearance(htmlns, 'input', null, 'auto');
testAppearance(htmlns, 'input', {type: 'text'}, 'auto');
testAppearance(htmlns, 'input', {type: 'TEXT'}, 'auto');
testAppearance(htmlns, 'input', {type: 'search'}, 'auto');
testAppearance(htmlns, 'input', {type: 'tel'}, 'auto');
testAppearance(htmlns, 'input', {type: 'url'}, 'auto');
testAppearance(htmlns, 'input', {type: 'email'}, 'auto');
testAppearance(htmlns, 'input', {type: 'password'}, 'auto');
testAppearance(htmlns, 'input', {type: 'date'}, 'auto');
testAppearance(htmlns, 'input', {type: 'month'}, 'auto');
testAppearance(htmlns, 'input', {type: 'week'}, 'auto');
testAppearance(htmlns, 'input', {type: 'time'}, 'auto');
testAppearance(htmlns, 'input', {type: 'datetime-local'}, 'auto');
testAppearance(htmlns, 'input', {type: 'number'}, 'auto');
testAppearance(htmlns, 'input', {type: 'range'}, 'auto');
testAppearance(htmlns, 'input', {type: 'color'}, 'auto');
testAppearance(htmlns, 'input', {type: 'checkbox'}, 'auto');
testAppearance(htmlns, 'input', {type: 'radio'}, 'auto');
testAppearance(htmlns, 'input', {type: 'submit'}, 'auto');
testAppearance(htmlns, 'input', {type: 'reset'}, 'auto');
testAppearance(htmlns, 'input', {type: 'button'}, 'auto');
testAppearance(htmlns, 'input', {type: 'unknowntype'}, 'auto');
testAppearance(htmlns, 'select', null, 'auto');
testAppearance(htmlns, 'select', {multiple: ''}, 'auto');
testAppearance(htmlns, 'select', {size: '2'}, 'auto');
testAppearance(htmlns, 'button', null, 'auto');
testAppearance(htmlns, 'textarea', null, 'auto');
testAppearance(htmlns, 'meter', null, 'auto');
testAppearance(htmlns, 'progress', null, 'auto');
// none
testAppearance(htmlns, 'input', {type: 'hidden'}, 'none');
testAppearance(htmlns, 'input', {type: 'HIDDEN'}, 'none');
testAppearance(htmlns, 'input', {type: 'file'}, 'none');
testAppearance(htmlns, 'input', {type: 'image'}, 'none');
testAppearance(htmlns, 'div', null, 'none');
testAppearance(htmlns, 'details', null, 'none');
testAppearance(htmlns, 'summary', null, 'none');
testAppearance(htmlns, 'video', null, 'none');
testAppearance(htmlns, 'video', {controls: ''}, 'none');
testAppearance(htmlns, 'menuitem', null, 'none');
testAppearance(htmlns, 'marquee', null, 'none');
testAppearance(htmlns, 'keygen', null, 'none');
testAppearance(null, 'input', null, 'none');
testAppearance(svgns, 'input', null, 'none');
test(t => {
assertAppearance(document.documentElement, 'none');
}, 'The html element');
test(t => {
assertAppearance(document.body, 'none');
}, 'The body element');
function testAppearance(ns, tag, attributes, expected) {
test(t => {
const elm = document.createElementNS(ns, tag);
for (const att in attributes) {
elm.setAttribute(att, attributes[att]);
}
document.body.appendChild(elm);
t.add_cleanup(() => elm.remove());
assertAppearance(elm, expected);
}, formatTestName(ns, tag, attributes));
}
function assertAppearance(elm, expected) {
const computedStyle = getComputedStyle(elm);
assert_equals(computedStyle.getPropertyValue('-webkit-appearance'), expected, '-webkit-appearance');
assert_equals(computedStyle.getPropertyValue('appearance'), expected, 'appearance (no prefix)');
}
function formatTestName(ns, tag, attributes) {
let s = `<${tag}`;
for (const att in attributes) {
s += ` ${att}="${attributes[att]}"`;
}
s += '>';
if (ns !== htmlns) {
s += ` (namespace: ${ns})`;
}
return s;
}
</script>

View file

@ -0,0 +1,16 @@
async_test(t => {
const img = new Image();
t.add_cleanup(() => img.remove());
img.onloadstart = img.onprogress = img.onloadend = t.unreached_func("progress event fired");
img.onload = t.step_func_done(e => {
assert_true(e instanceof Event);
assert_false(e instanceof ProgressEvent);
});
img.src = "/images/rrgg-256x256.png";
document.body.append(img);
}, "<img> does not support ProgressEvent or loadstart/progress/loadend");
test(t => {
assert_equals(document.body.onloadend, undefined);
assert_equals(window.onloadend, undefined);
}, "onloadend is not exposed");

View file

@ -58,8 +58,6 @@
<img srcset='/images/green-1x1.png?e37a 50w, /images/green-16x16.png?e37a 51w' sizes='(min-width:0) min(1px, 100px)'>
<img srcset='/images/green-1x1.png?e37b 50w, /images/green-16x16.png?e37b 51w' sizes='(min-width:0) max(-100px, 1px)'>
<img srcset='/images/green-1x1.png?e38 50w, /images/green-16x16.png?e38 51w' sizes='(min-width:calc(0)) 1px'>
<img srcset='/images/green-1x1.png?e38a 50w, /images/green-16x16.png?e38a 51w' sizes='(min-width:min(0, 200vw)) 1px'>
<img srcset='/images/green-1x1.png?e38b 50w, /images/green-16x16.png?e38b 51w' sizes='(min-width:max(-200vw, 0)) 1px'>
<img srcset='/images/green-1x1.png?e39 50w, /images/green-16x16.png?e39 51w' sizes='(min-width:0) 1px, 100vw'>
<img srcset='/images/green-1x1.png?e40 50w, /images/green-16x16.png?e40 51w' sizes='(min-width:0) 1px, (min-width:0) 100vw, 100vw'>
<img srcset='/images/green-1x1.png?e41 50w, /images/green-16x16.png?e41 51w' sizes='(min-width:0) 1px'>

View file

@ -5,6 +5,7 @@
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<h1>Autofocus shouldn't work in cross-origin iframe.</h1>
@ -36,7 +37,7 @@
}
}));
document.getElementById("child").src =
"http://{{domains[www]}}:{{ports[http][0]}}/html/semantics/forms/autofocus/resources/child-autofocus.html";
get_host_info().HTTP_REMOTE_ORIGIN + "/html/semantics/forms/autofocus/resources/child-autofocus.html";
}, "Autofocus shouldn't work in cross-origin iframe");
</script>
</body>

View file

@ -3,12 +3,12 @@
for (const value of [null, true, false, "string"]) {
promise_test(async t => {
const result = await import(`./${value}.json`);
assert_equals(result, value);
assert_equals(result.default, value);
}, `Non-object: ${value}`);
}
promise_test(async t => {
const result = await import("./array.json");
assert_array_equals(result, ["en", "try"]);
assert_array_equals(result.default, ["en", "try"]);
}, "Non-object: array");