mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision b'9b5719f9756aba6e4aa3c855db9cc54648df815f' (#32214)
This commit is contained in:
parent
0df79b939a
commit
60613e77c5
149 changed files with 5315 additions and 3178 deletions
|
@ -1,3 +1,6 @@
|
||||||
[starting-style-size-container.html]
|
[starting-style-size-container.html]
|
||||||
[Triggered transition from first style update based on up-to-date container query]
|
[Triggered transition from first style update based on up-to-date container query]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[Triggered transition from the display change inside the up-to-date container query]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[focus-preserve.html]
|
||||||
|
[when reparenting an element, don't automatically reset the document focus]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[when reparenting a focused element into an inert parent, reset the document focus]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[when reparenting a focused element into a hidden parent, reset the document focus]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[when reparenting an ancestor of an focused element into a hidden parent, reset the document focus]
|
||||||
|
expected: FAIL
|
|
@ -10,6 +10,3 @@
|
||||||
|
|
||||||
[load event does not fire on window.open('about:blank?foo')]
|
[load event does not fire on window.open('about:blank?foo')]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[load event does not fire on window.open('about:blank')]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[traverse_the_history_2.html]
|
||||||
|
[Multiple history traversals, last would be aborted]
|
||||||
|
expected: FAIL
|
|
@ -2,4 +2,4 @@
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
[Check that popups from a sandboxed iframe do not escape the sandbox]
|
[Check that popups from a sandboxed iframe do not escape the sandbox]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,6 @@
|
||||||
[starting-style-size-container.html]
|
[starting-style-size-container.html]
|
||||||
[Triggered transition from first style update based on up-to-date container query]
|
[Triggered transition from first style update based on up-to-date container query]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[Triggered transition from the display change inside the up-to-date container query]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[MediaQueryList-extends-EventTarget-interop.html]
|
||||||
|
[listener added with addListener and addEventListener is called once]
|
||||||
|
expected: FAIL
|
|
@ -0,0 +1,12 @@
|
||||||
|
[focus-preserve.html]
|
||||||
|
[when reparenting an element, don't automatically reset the document focus]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[when reparenting a focused element into an inert parent, reset the document focus]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[when reparenting a focused element into a hidden parent, reset the document focus]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[when reparenting an ancestor of an focused element into a hidden parent, reset the document focus]
|
||||||
|
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
||||||
[navigation-unload-same-origin.window.html]
|
|
||||||
[Same-origin navigation started from unload handler must be ignored]
|
|
||||||
expected: FAIL
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[traverse_the_history_3.html]
|
||||||
|
[Multiple history traversals, last would be aborted]
|
||||||
|
expected: FAIL
|
|
@ -1,4 +1,4 @@
|
||||||
[iframe_sandbox_popups_escaping-1.html]
|
[iframe_sandbox_popups_escaping-1.html]
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
|
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[iframe_sandbox_popups_escaping-3.html]
|
[iframe_sandbox_popups_escaping-3.html]
|
||||||
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
|
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[iframe_sandbox_popups_nonescaping-2.html]
|
[iframe_sandbox_popups_nonescaping-2.html]
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
[Check that popups from a sandboxed iframe do not escape the sandbox]
|
[Check that popups from a sandboxed iframe do not escape the sandbox]
|
||||||
expected: FAIL
|
expected: NOTRUN
|
||||||
|
|
4
tests/wpt/meta/webmessaging/without-ports/017.html.ini
Normal file
4
tests/wpt/meta/webmessaging/without-ports/017.html.ini
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[017.html]
|
||||||
|
expected: TIMEOUT
|
||||||
|
[origin of the script that invoked the method, about:blank]
|
||||||
|
expected: TIMEOUT
|
|
@ -13,7 +13,7 @@
|
||||||
let open_rq = createdb(t);
|
let open_rq = createdb(t);
|
||||||
open_rq.onupgradeneeded = function(e) {
|
open_rq.onupgradeneeded = function(e) {
|
||||||
let db = e.target.result;
|
let db = e.target.result;
|
||||||
let objStore = db.createObjectStore("test", { keyPath:"pKey" });
|
let objStore = db.createObjectStore("test");
|
||||||
|
|
||||||
let sab = new SharedArrayBuffer(256);
|
let sab = new SharedArrayBuffer(256);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<meta name=timeout content=long>
|
||||||
|
<meta name=variant content="?method=a">
|
||||||
|
<meta name=variant content="?method=a&noreferrer">
|
||||||
|
<meta name=variant content="?method=img">
|
||||||
|
<meta name=variant content="?method=img&noreferrer">
|
||||||
|
<meta name=variant content="?method=open">
|
||||||
|
<meta name=variant content="?method=open&noreferrer">
|
||||||
|
<meta name=variant content="?method=script">
|
||||||
|
<meta name=variant content="?method=script&noreferrer">
|
||||||
|
<script src="/resources/testdriver.js"></script>
|
||||||
|
<script src="/resources/testdriver-vendor.js"></script>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="resources/helpers.js"></script>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
const waitForRequest = async () => {
|
||||||
|
const url = blankURL();
|
||||||
|
url.searchParams.set('get-requests', 'true');
|
||||||
|
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
const resp = await fetch(url);
|
||||||
|
const payload = await resp.json();
|
||||||
|
if (payload !== null && payload.length > 0) {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
await delay(100);
|
||||||
|
}
|
||||||
|
throw new Error('Timeout polling requests');
|
||||||
|
};
|
||||||
|
|
||||||
|
const searchParams = new URLSearchParams(location.search);
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const noreferrer = searchParams.has('noreferrer');
|
||||||
|
|
||||||
|
await registerAttributionSrc({
|
||||||
|
method: 'variant',
|
||||||
|
extraQueryParams: {'store-request': 'true'},
|
||||||
|
referrerPolicy: noreferrer ? 'no-referrer' : '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const requests = await waitForRequest();
|
||||||
|
assert_equals(requests.length, 1);
|
||||||
|
|
||||||
|
if (noreferrer) {
|
||||||
|
assert_not_own_property(requests[0], 'referer');
|
||||||
|
} else {
|
||||||
|
assert_own_property(requests[0], 'referer');
|
||||||
|
assert_equals(requests[0].referer, location.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 'attributionsrc referrer policy is propagated.');
|
||||||
|
</script>
|
|
@ -53,9 +53,7 @@ promise_test(async t => {
|
||||||
} else {
|
} else {
|
||||||
assert_not_own_property(requests[0], 'attribution-reporting-eligible');
|
assert_not_own_property(requests[0], 'attribution-reporting-eligible');
|
||||||
}
|
}
|
||||||
assert_equals(requests[0].referer, location.toString());
|
|
||||||
|
|
||||||
// TODO(apaseltiner): Test various referrer policies.
|
|
||||||
// TODO(apaseltiner): Test cookie propagation.
|
// TODO(apaseltiner): Test cookie propagation.
|
||||||
|
|
||||||
const expectedURL = blankURL();
|
const expectedURL = blankURL();
|
||||||
|
|
|
@ -171,6 +171,7 @@ const registerAttributionSrc = async ({
|
||||||
extraQueryParams = {},
|
extraQueryParams = {},
|
||||||
reportingOrigin,
|
reportingOrigin,
|
||||||
extraHeaders = [],
|
extraHeaders = [],
|
||||||
|
referrerPolicy = '',
|
||||||
}) => {
|
}) => {
|
||||||
const searchParams = new URLSearchParams(location.search);
|
const searchParams = new URLSearchParams(location.search);
|
||||||
|
|
||||||
|
@ -201,7 +202,6 @@ const registerAttributionSrc = async ({
|
||||||
headers.push({name, value: cookie});
|
headers.push({name, value: cookie});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let credentials;
|
let credentials;
|
||||||
if (method === 'fetch') {
|
if (method === 'fetch') {
|
||||||
const params = getFetchParams(reportingOrigin, cookie);
|
const params = getFetchParams(reportingOrigin, cookie);
|
||||||
|
@ -219,6 +219,7 @@ const registerAttributionSrc = async ({
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case 'img':
|
case 'img':
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
|
img.referrerPolicy = referrerPolicy;
|
||||||
if (eligible === null) {
|
if (eligible === null) {
|
||||||
img.attributionSrc = url;
|
img.attributionSrc = url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,6 +237,7 @@ const registerAttributionSrc = async ({
|
||||||
return 'event';
|
return 'event';
|
||||||
case 'script':
|
case 'script':
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
|
script.referrerPolicy = referrerPolicy;
|
||||||
if (eligible === null) {
|
if (eligible === null) {
|
||||||
script.attributionSrc = url;
|
script.attributionSrc = url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -249,6 +251,7 @@ const registerAttributionSrc = async ({
|
||||||
return 'event';
|
return 'event';
|
||||||
case 'a':
|
case 'a':
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
|
a.referrerPolicy = referrerPolicy;
|
||||||
a.target = '_blank';
|
a.target = '_blank';
|
||||||
a.textContent = 'link';
|
a.textContent = 'link';
|
||||||
if (eligible === null) {
|
if (eligible === null) {
|
||||||
|
@ -263,12 +266,13 @@ const registerAttributionSrc = async ({
|
||||||
return 'navigation';
|
return 'navigation';
|
||||||
case 'open':
|
case 'open':
|
||||||
await test_driver.bless('open window', () => {
|
await test_driver.bless('open window', () => {
|
||||||
|
const feature = referrerPolicy === 'no-referrer' ? 'noreferrer' : '';
|
||||||
if (eligible === null) {
|
if (eligible === null) {
|
||||||
open(
|
open(
|
||||||
blankURL(), '_blank',
|
blankURL(), '_blank',
|
||||||
`attributionsrc=${encodeURIComponent(url)}`);
|
`attributionsrc=${encodeURIComponent(url)} ${feature}`);
|
||||||
} else {
|
} else {
|
||||||
open(url, '_blank', 'attributionsrc');
|
open(url, '_blank', `attributionsrc ${feature}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return 'navigation';
|
return 'navigation';
|
||||||
|
@ -277,7 +281,7 @@ const registerAttributionSrc = async ({
|
||||||
if (eligible !== null) {
|
if (eligible !== null) {
|
||||||
attributionReporting = JSON.parse(eligible);
|
attributionReporting = JSON.parse(eligible);
|
||||||
}
|
}
|
||||||
await fetch(url, {credentials, attributionReporting});
|
await fetch(url, {credentials, attributionReporting, referrerPolicy});
|
||||||
return 'event';
|
return 'event';
|
||||||
}
|
}
|
||||||
case 'xhr':
|
case 'xhr':
|
||||||
|
|
|
@ -4,18 +4,18 @@
|
||||||
|
|
||||||
test(() => {
|
test(() => {
|
||||||
// Compute Pressure should support at least "cpu"
|
// Compute Pressure should support at least "cpu"
|
||||||
const sources = PressureObserver.supportedSources;
|
const sources = PressureObserver.knownSources;
|
||||||
assert_in_array('cpu', sources);
|
assert_in_array('cpu', sources);
|
||||||
}, 'PressureObserver should support at least "cpu"');
|
}, 'PressureObserver should support at least "cpu"');
|
||||||
|
|
||||||
test(() => {
|
test(() => {
|
||||||
// Compute Pressure should be frozen array
|
// Compute Pressure should be frozen array
|
||||||
const sources = PressureObserver.supportedSources;
|
const sources = PressureObserver.knownSources;
|
||||||
assert_equals(sources, PressureObserver.supportedSources);
|
assert_equals(sources, PressureObserver.knownSources);
|
||||||
}, 'PressureObserver must return always the same array');
|
}, 'PressureObserver must return always the same array');
|
||||||
|
|
||||||
test(() => {
|
test(() => {
|
||||||
// Compute Pressure should be frozen array
|
// Compute Pressure should be frozen array
|
||||||
let sources = PressureObserver.supportedSources;
|
let sources = PressureObserver.knownSources;
|
||||||
assert_equals(Object.isFrozen(), true);
|
assert_equals(Object.isFrozen(sources), true);
|
||||||
}, 'PressureObserver must return a frozen array');
|
}, 'PressureObserver must return a frozen array');
|
|
@ -1,37 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<link rel="stylesheet" href="/fonts/ahem.css">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font: 20px/1 Ahem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#placefiller-above-anchor {
|
|
||||||
height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#placefiller-before-anchor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#inner-anchored {
|
|
||||||
color: green;
|
|
||||||
position: fixed;
|
|
||||||
left: 70px;
|
|
||||||
top: 180px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#outer-anchored {
|
|
||||||
color: yellow;
|
|
||||||
position: fixed;
|
|
||||||
left: 70px;
|
|
||||||
top: 220px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div id="placefiller-above-anchor"></div>
|
|
||||||
<div id="placefiller-before-anchor"></div>
|
|
||||||
<span id="anchor">anchor</span>
|
|
||||||
<div id="inner-anchored">inner-anchored</div>
|
|
||||||
<div id="outer-anchored">outer-anchored</div>
|
|
|
@ -1,67 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<title>Basic of anchor positioned scrolling: anchored elements should be "pinned" to the anchor when anchor is scrolled in overflow:hidden</title>
|
|
||||||
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/">
|
|
||||||
<link rel="match" href="anchor-scroll-overflow-hidden-ref.html">
|
|
||||||
<link rel="stylesheet" href="/fonts/ahem.css">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font: 20px/1 Ahem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scroll-container {
|
|
||||||
width: 400px;
|
|
||||||
height: 400px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scroll-contents {
|
|
||||||
width: 1000px;
|
|
||||||
height: 1000px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#placefiller-above-anchor {
|
|
||||||
height: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#placefiller-before-anchor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 500px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#anchor {
|
|
||||||
anchor-name: --anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
#inner-anchored {
|
|
||||||
color: green;
|
|
||||||
position: absolute;
|
|
||||||
left: anchor(--anchor left);
|
|
||||||
bottom: anchor(--anchor top);
|
|
||||||
position-anchor: --anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
#outer-anchored {
|
|
||||||
color: yellow;
|
|
||||||
position: absolute;
|
|
||||||
left: anchor(--anchor left);
|
|
||||||
top: anchor(--anchor bottom);
|
|
||||||
position-anchor: --anchor;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div id="scroll-container">
|
|
||||||
<div id="scroll-contents">
|
|
||||||
<div id="placefiller-above-anchor"></div>
|
|
||||||
<div id="placefiller-before-anchor"></div>
|
|
||||||
<span id="anchor">anchor</span>
|
|
||||||
<div id="inner-anchored">inner-anchored</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="outer-anchored">outer-anchored</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const scroller = document.getElementById('scroll-container');
|
|
||||||
scroller.scrollTop = 300;
|
|
||||||
scroller.scrollLeft = 450;
|
|
||||||
</script>
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
width: 100px;
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="flex">
|
||||||
|
<div>
|
||||||
|
<div style="background: green; width: 150px; height: 50px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto">
|
||||||
|
<link rel="match" href="min-size-auto-overflow-clip-ref.html">
|
||||||
|
<title>overflow: visible and clip behave the same for min-size purposes</title>
|
||||||
|
<style>
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
width: 100px;
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="flex">
|
||||||
|
<div style="overflow: clip">
|
||||||
|
<div style="background: green; width: 150px; height: 50px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
flex-basis: 20px;
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="grid">
|
||||||
|
<div style="height: 50px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-grid/#min-size-auto">
|
||||||
|
<link rel="match" href="min-size-auto-overflow-clip-ref.html">
|
||||||
|
<title>overflow: visible and clip behave the same for min-size purposes</title>
|
||||||
|
<style>
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
flex-basis: 20px;
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="grid" style="overflow: clip">
|
||||||
|
<div style="height: 50px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,47 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Repeating linear gradients in HSL and OKLCH space</title>
|
||||||
|
<link rel="author" title="Ashley Hale" href="mailto:ahale@mozilla.com">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
hsl(180 50% 70%) 0px 20px,
|
||||||
|
hsl(0 50% 50%) 20px 40px,
|
||||||
|
hsl(180 50% 70%) 40px 60px,
|
||||||
|
hsl(0 50% 50%) 60px 80px,
|
||||||
|
hsl(180 50% 70%) 80px 100px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.b {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
oklch(70% 50% 180) 0px 20px,
|
||||||
|
oklch(50% 50% 0) 20px 40px,
|
||||||
|
oklch(70% 50% 180) 40px 60px,
|
||||||
|
oklch(50% 50% 0) 60px 80px,
|
||||||
|
oklch(70% 50% 180) 80px 100px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>repeating-linear-gradient with HSL</p>
|
||||||
|
<div class="a"></div>
|
||||||
|
<p>repeating-linear-gradient with OKLCH</p>
|
||||||
|
<div class="b"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,44 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<meta name=fuzzy content="maxDifference=0-1;totalPixels=0-2000">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Repeating linear gradients in HSL and OKLCH space</title>
|
||||||
|
<link rel="author" title="Ashley Hale" href="mailto:ahale@mozilla.com">
|
||||||
|
<link rel="help" href="https://www.w3.org/TR/css-color-4/#interpolation">
|
||||||
|
<meta name="assert" content="Tests that a multi-stop shorter hue gradient and a single-stop longer hue (wrapping) gradient match in appearance">
|
||||||
|
<link rel="match" href="repeating-gradient-hsl-and-oklch-ref.html">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
hsl(180 50% 70%) 0px 20px,
|
||||||
|
hsl(0 50% 50%) 20px 40px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.b {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
oklch(70% 50% 180) 0px 20px,
|
||||||
|
oklch(50% 50% 0) 20px 40px
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>repeating-linear-gradient with HSL</p>
|
||||||
|
<div class="a"></div>
|
||||||
|
<p>repeating-linear-gradient with OKLCH</p>
|
||||||
|
<div class="b"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
32
tests/wpt/tests/css/css-page/fixedpos-009-print-ref.html
Normal file
32
tests/wpt/tests/css/css-page/fixedpos-009-print-ref.html
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.pencil {
|
||||||
|
background-color: black;
|
||||||
|
mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTMgMTcuMjVWMjFoMy43NUwxNy44MSA5Ljk0bC0zLjc1LTMuNzVMMyAxNy4yNXpNMjAuNzEgNy4wNGEuOTk2Ljk5NiAwIDAgMCAwLTEuNDFsLTIuMzQtMi4zNGEuOTk2Ljk5NiAwIDAgMC0xLjQxIDBsLTEuODMgMS44MyAzLjc1IDMuNzUgMS44My0xLjgzeiIvPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48L3N2Zz4=);
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.fakepage {
|
||||||
|
position: relative;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="fakepage">
|
||||||
|
<div style="position:absolute; bottom:0; right:0;">
|
||||||
|
<div class="pencil"></div>
|
||||||
|
</div>
|
||||||
|
When printed, there should be two pages. There should be a black pencil in the
|
||||||
|
bottom right corner on both pages.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fakepage">
|
||||||
|
<div style="position:absolute; bottom:0; right:0;">
|
||||||
|
<div class="pencil"></div>
|
||||||
|
</div>
|
||||||
|
Page 2.
|
||||||
|
</div>
|
24
tests/wpt/tests/css/css-page/fixedpos-009-print.html
Normal file
24
tests/wpt/tests/css/css-page/fixedpos-009-print.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
|
||||||
|
<link rel="help" href="http://crbug.com/337791467">
|
||||||
|
<link rel="match" href="fixedpos-009-print-ref.html">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.pencil {
|
||||||
|
background-color: black;
|
||||||
|
mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTMgMTcuMjVWMjFoMy43NUwxNy44MSA5Ljk0bC0zLjc1LTMuNzVMMyAxNy4yNXpNMjAuNzEgNy4wNGEuOTk2Ljk5NiAwIDAgMCAwLTEuNDFsLTIuMzQtMi4zNGEuOTk2Ljk5NiAwIDAgMC0xLjQxIDBsLTEuODMgMS44MyAzLjc1IDMuNzUgMS44My0xLjgzeiIvPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz48L3N2Zz4=);
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div style="position:fixed; bottom:0; right:0;">
|
||||||
|
<div class="pencil"></div>
|
||||||
|
</div>
|
||||||
|
When printed, there should be two pages. There should be a black pencil in the
|
||||||
|
bottom right corner on both pages.
|
||||||
|
<div style="break-before:page;">
|
||||||
|
Page 2.
|
||||||
|
</div>
|
28
tests/wpt/tests/css/css-page/fixedpos-010-print-ref.html
Normal file
28
tests/wpt/tests/css/css-page/fixedpos-010-print-ref.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
|
||||||
|
<style>
|
||||||
|
@page {
|
||||||
|
size: 400px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
@page large {
|
||||||
|
size: 500px 400px;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
This page should <em>not</em> have a blue box.
|
||||||
|
<div style="page:large;">
|
||||||
|
<div style="float:right; margin-top:300px; width:100px; height:100px; background:blue;"></div>
|
||||||
|
<div style="width:400px;">
|
||||||
|
This page should have a blue box in the bottom right corner.
|
||||||
|
</div>
|
||||||
|
<div style="break-before:page;">
|
||||||
|
<div style="float:right; margin-top:300px; width:100px; height:100px; background:blue;"></div>
|
||||||
|
<div style="width:400px;">
|
||||||
|
This page should have a blue box in the bottom right corner.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
This page should <em>not</em> have a blue box.
|
25
tests/wpt/tests/css/css-page/fixedpos-010-print.html
Normal file
25
tests/wpt/tests/css/css-page/fixedpos-010-print.html
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-position-3/#valdef-position-fixed">
|
||||||
|
<link rel="match" href="fixedpos-010-print-ref.html">
|
||||||
|
<style>
|
||||||
|
@page {
|
||||||
|
size: 400px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
@page large {
|
||||||
|
size: 500px 400px;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div style="position:fixed; right:-100px; bottom:0; width:100px; height:100px; background:blue;"></div>
|
||||||
|
This page should <em>not</em> have a blue box.
|
||||||
|
<div style="page:large; width:400px;">
|
||||||
|
This page should have a blue box in the bottom right corner.
|
||||||
|
<div style="break-before:page;">
|
||||||
|
This page should have a blue box in the bottom right corner.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
This page should <em>not</em> have a blue box.
|
|
@ -5,32 +5,58 @@
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script src="/css/css-transitions/support/helper.js"></script>
|
<script src="/css/css-transitions/support/helper.js"></script>
|
||||||
<div id="container" style="width: 200px">
|
<body>
|
||||||
<div id="target" style="display: none"></div>
|
</body>
|
||||||
</div>
|
|
||||||
<style>
|
<style>
|
||||||
#container {
|
#container {
|
||||||
container-type: inline-size;
|
container-type: inline-size;
|
||||||
|
width: 100px;
|
||||||
}
|
}
|
||||||
#target {
|
#target {
|
||||||
transition-property: background-color;
|
transition-property: background-color;
|
||||||
transition-duration: 100s;
|
transition-duration: 100s;
|
||||||
transition-timing-function: steps(2, start);
|
transition-timing-function: steps(2, start);
|
||||||
background-color: lime;
|
background-color: lime;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
@container (width > 300px) {
|
@container (width > 300px) {
|
||||||
@starting-style {
|
@starting-style {
|
||||||
#target { background-color: white; }
|
#target { background-color: white; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@container (width < 300px) {
|
@container ((width > 200px) and (width < 300px)) {
|
||||||
|
#target {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
@starting-style {
|
||||||
|
#target { background-color: white; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@container (width < 200px) {
|
||||||
@starting-style {
|
@starting-style {
|
||||||
#target { background-color: red; }
|
#target { background-color: red; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
function setup(test) {
|
||||||
|
let container = document.createElement("div");
|
||||||
|
container.id = "container";
|
||||||
|
document.body.appendChild(container);
|
||||||
|
|
||||||
|
let target = document.createElement("div");
|
||||||
|
target.id = "target";
|
||||||
|
container.appendChild(target);
|
||||||
|
|
||||||
|
test.add_cleanup(() => {
|
||||||
|
target.remove();
|
||||||
|
container.remove();
|
||||||
|
});
|
||||||
|
return [container, target];
|
||||||
|
}
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
|
let [container, target] = setup(t);
|
||||||
await waitForAnimationFrames(2);
|
await waitForAnimationFrames(2);
|
||||||
assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)",
|
assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)",
|
||||||
"No transition while display:none");
|
"No transition while display:none");
|
||||||
|
@ -38,6 +64,21 @@
|
||||||
target.style.display = "block";
|
target.style.display = "block";
|
||||||
await waitForAnimationFrames(2);
|
await waitForAnimationFrames(2);
|
||||||
assert_equals(getComputedStyle(target).backgroundColor, "rgb(128, 255, 128)",
|
assert_equals(getComputedStyle(target).backgroundColor, "rgb(128, 255, 128)",
|
||||||
"@starting-style based on the size query evaluation from the same frame");
|
"@starting-style based on the size query evaluation from " +
|
||||||
}, "Triggered transition from first style update based on up-to-date container query");
|
"the same frame");
|
||||||
|
}, "Triggered transition from first style update based on up-to-date " +
|
||||||
|
"container query");
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
let [container, target] = setup(t);
|
||||||
|
await waitForAnimationFrames(2);
|
||||||
|
assert_equals(getComputedStyle(target).backgroundColor, "rgb(0, 255, 0)",
|
||||||
|
"No transition while display:none");
|
||||||
|
container.style.width = "250px";
|
||||||
|
await waitForAnimationFrames(2);
|
||||||
|
assert_equals(getComputedStyle(target).backgroundColor, "rgb(128, 255, 128)",
|
||||||
|
"@starting-style based on the size query evaluation from " +
|
||||||
|
"the same frame");
|
||||||
|
}, "Triggered transition from the display change inside the up-to-date " +
|
||||||
|
"container query");
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<!doctype HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
background: lightpink;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
position: relative;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.outer {
|
||||||
|
background-color: blue;
|
||||||
|
box-shadow: -50px -50px 0px 0px rgba(0,0,0,1);
|
||||||
|
left: 100px;
|
||||||
|
top: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inner {
|
||||||
|
background-color: red;
|
||||||
|
left: 50px;
|
||||||
|
top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
<div class="outer">
|
||||||
|
<div class="inner"></div>
|
||||||
|
</div>
|
||||||
|
</html>
|
|
@ -0,0 +1,50 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class=reftest-wait>
|
||||||
|
<title>View transitions: capture opacity elements</title>
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
|
||||||
|
<link rel="author" href="mailto:mattwoodrow@apple.com">
|
||||||
|
<link rel="match" href="new-content-ancestor-clipped-ref.html">
|
||||||
|
<script src="/common/reftest-wait.js"></script>
|
||||||
|
<style>
|
||||||
|
.outer {
|
||||||
|
background-color: blue;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: -50px -50px 0px 0px rgba(0,0,0,1);
|
||||||
|
position: relative;
|
||||||
|
left: 100px;
|
||||||
|
top: 100px;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
view-transition-name: outer;
|
||||||
|
}
|
||||||
|
.inner {
|
||||||
|
background-color: red;
|
||||||
|
position: relative;
|
||||||
|
left: 50px;
|
||||||
|
top: 50px;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
view-transition-name: inner;
|
||||||
|
}
|
||||||
|
/* We're verifying what we capture, so just display the new contents for 5 minutes. */
|
||||||
|
html::view-transition-group(*) { animation-duration: 300s; }
|
||||||
|
html::view-transition-new(*) { animation: unset; opacity: 1; }
|
||||||
|
html::view-transition-old(*) { animation: unset; opacity: 0; }
|
||||||
|
/* hide the root so we show transition background to ensure we're in a transition */
|
||||||
|
html::view-transition-group(root) { animation: unset; opacity: 0; }
|
||||||
|
html::view-transition { background: lightpink; }
|
||||||
|
</style>
|
||||||
|
<div class="outer">
|
||||||
|
<div class="inner"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
|
||||||
|
|
||||||
|
async function runTest() {
|
||||||
|
let t = document.startViewTransition(() => {
|
||||||
|
requestAnimationFrame(() => requestAnimationFrame(takeScreenshot));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<div style="font-size: 4em; line-height: 4lh">ABC</div>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||||
|
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||||
|
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1892676">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
|
||||||
|
<link rel="match" href="relative-units-from-parent-ref.html">
|
||||||
|
<!--
|
||||||
|
The font-size and line-height use the parent sizes, but should still
|
||||||
|
multiply by our own zoom.
|
||||||
|
-->
|
||||||
|
<div style="zoom: 2; font-size: 2em; line-height: 2lh">ABC</div>
|
42
tests/wpt/tests/css/css-viewport/zoom/relative-units.html
Normal file
42
tests/wpt/tests/css/css-viewport/zoom/relative-units.html
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||||
|
<link rel="author" title="Mozilla" href="https://mozilla.org">
|
||||||
|
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1892676">
|
||||||
|
<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<style>
|
||||||
|
:root,
|
||||||
|
#zoomed {
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 10px;
|
||||||
|
zoom: 2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="outside"></div>
|
||||||
|
<div id="zoomed">
|
||||||
|
<div id="inside"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function test_unit(unit, outside, zoomed, inside = zoomed) {
|
||||||
|
test(function() {
|
||||||
|
let values = { outside, zoomed, inside };
|
||||||
|
for (let id of ["outside", "zoomed", "inside"]) {
|
||||||
|
let el = document.getElementById(id);
|
||||||
|
el.style.height = "1" + unit;
|
||||||
|
// approx_equals is needed because innerHeight / innerWidth round.
|
||||||
|
assert_approx_equals(el.getBoundingClientRect().height, values[id], 1, `${unit} in ${id}`);
|
||||||
|
el.style.height = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
test_unit("em", 20, 40);
|
||||||
|
test_unit("rem", 20, 40);
|
||||||
|
test_unit("lh", 20, 40);
|
||||||
|
test_unit("rlh", 20, 40);
|
||||||
|
test_unit("vh", 2 * innerHeight / 100, 4 * innerHeight / 100);
|
||||||
|
test_unit("vw", 2 * innerWidth / 100, 4 * innerWidth / 100);
|
||||||
|
</script>
|
|
@ -24,7 +24,6 @@
|
||||||
margin: 1px;
|
margin: 1px;
|
||||||
top:10x;
|
top:10x;
|
||||||
left: 10x;
|
left: 10x;
|
||||||
|
|
||||||
}
|
}
|
||||||
.one {
|
.one {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -36,7 +35,7 @@
|
||||||
top: 20px;
|
top: 20px;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
zoom: 2;
|
zoom: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.three {
|
.three {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -54,18 +53,18 @@
|
||||||
<div id="unzoomed_two" class="square two"></div>
|
<div id="unzoomed_two" class="square two"></div>
|
||||||
<div id="unzoomed_three" class="square three"></div>
|
<div id="unzoomed_three" class="square three"></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="zoom:3" class=outer_div>
|
<div style="zoom:3" class="outer_div">
|
||||||
<div id="zoomed_one" class="square one"></div>
|
<div id="zoomed_one" class="square one"></div>
|
||||||
<div id="zoomed_two" class="square two"></div>
|
<div id="zoomed_two" class="square two"></div>
|
||||||
<div id="zoomed_three" class="square three"></div>
|
<div id="zoomed_three" class="square three"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class ="outer_div" style="margin: 30px;" id="outer_div">
|
<div class="outer_div" style="margin: 30px;" id="outer_div">
|
||||||
<div id="zoomed_middle" style="margin: 10px; zoom:2">
|
<div id="zoomed_middle" style="margin: 10px; zoom:2">
|
||||||
<div class="square" id="unzoomed_inner"></div>
|
<div class="square" id="unzoomed_inner"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class = outer_div style="margin: 30px;">
|
<div class="outer_div" style="margin: 30px;">
|
||||||
<div id="unzoomed_middle">
|
<div id="unzoomed_middle">
|
||||||
<div class="square" id="zoomed_inner" style="zoom:2; width: 100px; height: 100px; border: 1px solid black;"></div>
|
<div class="square" id="zoomed_inner" style="zoom:2; width: 100px; height: 100px; border: 1px solid black;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,12 +89,12 @@ test(() => {
|
||||||
assert_equals(unzoomed_inner.offsetLeft, 11, 'unzoomed_inner.offsetLeft');
|
assert_equals(unzoomed_inner.offsetLeft, 11, 'unzoomed_inner.offsetLeft');
|
||||||
assert_equals(zoomed_inner.offsetTop, 0, 'zoomed_inner.offsetTop');
|
assert_equals(zoomed_inner.offsetTop, 0, 'zoomed_inner.offsetTop');
|
||||||
assert_equals(zoomed_inner.offsetLeft, 1, 'zoomed_inner.offsetLeft');
|
assert_equals(zoomed_inner.offsetLeft, 1, 'zoomed_inner.offsetLeft');
|
||||||
|
}, 'Verifies that offsetTop and offsetLeft find the right OffsetParent and return values excluding the target zoom');
|
||||||
|
|
||||||
// check that offset is equal between elements when one of them has css zoom
|
test(() => {
|
||||||
assert_equals(unzoomed_one.offsetWidth, zoomed_one.offsetWidth, "offsetWidth");
|
assert_equals(unzoomed_one.offsetWidth, zoomed_one.offsetWidth, "offsetWidth");
|
||||||
assert_equals(unzoomed_one.offsetHeight, zoomed_one.offsetHeight, "offsetHeight");
|
assert_equals(unzoomed_one.offsetHeight, zoomed_one.offsetHeight, "offsetHeight");
|
||||||
assert_equals(zoomed_inner.offsetWidth, outer_div.offsetWidth, "offsetWidth for nested element");
|
assert_equals(zoomed_inner.offsetWidth, outer_div.offsetWidth, "offsetWidth for nested element");
|
||||||
assert_equals(zoomed_inner.offsetHeight, outer_div.offsetHeight, "offsetHeight for nested element");
|
assert_equals(zoomed_inner.offsetHeight, outer_div.offsetHeight, "offsetHeight for nested element");
|
||||||
|
}, 'check that offset is equal between elements when one of them has css zoom');
|
||||||
}, 'Verifies that offsetTop and offsetLeft find the right OffsetParent and return values excluding the target zoom');
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel="help" href="https://crbug.com/338071841">
|
||||||
|
<div id="p"><span></span><!-- comment --></div>
|
||||||
|
<script>
|
||||||
|
p.moveBefore(p.lastChild, p.firstChild);
|
||||||
|
</script>
|
|
@ -0,0 +1,85 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<title>moveBefore should not automatically clear focus</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<body>
|
||||||
|
<section id="old_parent">
|
||||||
|
<button id="button" tabindex="1">Button</button>
|
||||||
|
</section>
|
||||||
|
<section id="new_parent">
|
||||||
|
</section>
|
||||||
|
<section id="inert_parent" inert>
|
||||||
|
</section>
|
||||||
|
<section id="hidden_parent" hidden>
|
||||||
|
</section>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function eventually_blurred(t, item, timeout = 1000) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
function onblur() {
|
||||||
|
resolve();
|
||||||
|
item.removeEventListener("blur", onblur);
|
||||||
|
}
|
||||||
|
item.addEventListener("blur", onblur);
|
||||||
|
t.step_timeout(reject, timeout);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
test(t => {
|
||||||
|
const old_parent = document.querySelector("#old_parent");
|
||||||
|
const button = document.querySelector("#button");
|
||||||
|
t.add_cleanup(() => old_parent.append(button));
|
||||||
|
button.focus();
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
new_parent.moveBefore(button, null);
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
}, "when reparenting an element, don't automatically reset the document focus");
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const old_parent = document.querySelector("#old_parent");
|
||||||
|
const button = document.querySelector("#button");
|
||||||
|
t.add_cleanup(() => old_parent.append(button));
|
||||||
|
const inert_parent = document.querySelector("#inert_parent");
|
||||||
|
button.focus();
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
inert_parent.moveBefore(button, null);
|
||||||
|
|
||||||
|
// The button will still be considered the active element. It will blur asynchronously.
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
await eventually_blurred(t, button);
|
||||||
|
assert_equals(document.activeElement, document.body);
|
||||||
|
}, "when reparenting a focused element into an inert parent, reset the document focus");
|
||||||
|
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const old_parent = document.querySelector("#old_parent");
|
||||||
|
const button = document.querySelector("#button");
|
||||||
|
t.add_cleanup(() => old_parent.append(button));
|
||||||
|
const hidden_parent = document.querySelector("#hidden_parent");
|
||||||
|
button.focus();
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
hidden_parent.moveBefore(button, null);
|
||||||
|
|
||||||
|
// The button will still be considered the active element. It will blur asynchronously.
|
||||||
|
// This is similar to other operations that can cause a blur due to change in inert trees,
|
||||||
|
// e.g. a style change that makes an ancestor `display: none`.
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
await eventually_blurred(t, button);
|
||||||
|
assert_equals(document.activeElement, document.body);
|
||||||
|
}, "when reparenting a focused element into a hidden parent, reset the document focus");
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const old_parent = document.querySelector("#old_parent");
|
||||||
|
const button = document.querySelector("#button");
|
||||||
|
t.add_cleanup(() => document.body.append(old_parent));
|
||||||
|
const hidden_parent = document.querySelector("#hidden_parent");
|
||||||
|
button.focus();
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
hidden_parent.moveBefore(old_parent, null);
|
||||||
|
|
||||||
|
// The button will still be considered the active element. It will blur asynchronously.
|
||||||
|
assert_equals(document.activeElement, button);
|
||||||
|
await eventually_blurred(t, button);
|
||||||
|
assert_equals(document.activeElement, document.body);
|
||||||
|
}, "when reparenting an ancestor of an focused element into a hidden parent, reset the document focus");
|
||||||
|
</script>
|
|
@ -0,0 +1,57 @@
|
||||||
|
// META: script=/resources/testdriver.js
|
||||||
|
// META: script=/common/utils.js
|
||||||
|
// META: script=resources/fledge-util.sub.js
|
||||||
|
// META: script=/common/subset-tests.js
|
||||||
|
// META: timeout=long
|
||||||
|
|
||||||
|
"use strict;"
|
||||||
|
|
||||||
|
// These tests focus on the browserSignals argument passed to scoreAd().
|
||||||
|
|
||||||
|
subsetTest(promise_test, async test => {
|
||||||
|
const uuid = generateUuid(test);
|
||||||
|
|
||||||
|
let biddingLogicURL = createBiddingScriptURL(
|
||||||
|
{
|
||||||
|
generateBid:
|
||||||
|
`
|
||||||
|
return {
|
||||||
|
bid: 1,
|
||||||
|
render: { url: interestGroup.ads[0].renderURL,
|
||||||
|
width: '100sw',
|
||||||
|
height: '50px' }
|
||||||
|
};
|
||||||
|
`
|
||||||
|
});
|
||||||
|
|
||||||
|
let decisionLogicURL = createDecisionScriptURL(uuid,
|
||||||
|
{
|
||||||
|
scoreAd:
|
||||||
|
`
|
||||||
|
if (!browserSignals.hasOwnProperty('renderSize')) {
|
||||||
|
throw 'Missing renderSize member in browserSignals.';
|
||||||
|
}
|
||||||
|
if (browserSignals.renderSize.width !== '100sw' ||
|
||||||
|
browserSignals.renderSize.height !== '50px') {
|
||||||
|
throw 'Incorrect renderSize width or height.';
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
await joinGroupAndRunBasicFledgeTestExpectingWinner(
|
||||||
|
test,
|
||||||
|
{
|
||||||
|
uuid: uuid,
|
||||||
|
interestGroupOverrides: {
|
||||||
|
name: uuid,
|
||||||
|
biddingLogicURL: biddingLogicURL,
|
||||||
|
ads: [{ renderURL: createRenderURL(uuid), sizeGroup: 'group1' }],
|
||||||
|
adSizes: { 'size1': { width: '100sw', height: '50px' } },
|
||||||
|
sizeGroups: { 'group1': ['size1'] }
|
||||||
|
},
|
||||||
|
auctionConfigOverrides: {
|
||||||
|
decisionLogicURL: decisionLogicURL
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 'ScoreAd browserSignals renderSize test.');
|
28
tests/wpt/tests/inert/inert-and-find-flat-tree.html
Normal file
28
tests/wpt/tests/inert/inert-and-find-flat-tree.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<link rel=author href="mailto:jarhar@chromium.org">
|
||||||
|
<link rel=help href="https://html.spec.whatwg.org/#inert-subtrees">
|
||||||
|
<link rel=help href="https://issues.chromium.org/issues/336832613">
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
|
||||||
|
<div id=host>
|
||||||
|
<template shadowrootmode=open>
|
||||||
|
<dialog>
|
||||||
|
<div>inside shadowroot</div>
|
||||||
|
<slot></slot>
|
||||||
|
</dialog>
|
||||||
|
</template>
|
||||||
|
<div>slotted</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById('host').shadowRoot.querySelector('dialog').showModal();
|
||||||
|
|
||||||
|
test(() => {
|
||||||
|
assert_true(window.find('inside shadowroot'));
|
||||||
|
}, 'Text inside a dialog inside a shadowroot should be findable.');
|
||||||
|
|
||||||
|
test(() => {
|
||||||
|
assert_true(window.find('slotted'));
|
||||||
|
}, 'Text slotted into a dialog which is inside a shadowroot should be findable.');
|
||||||
|
</script>
|
|
@ -2,3 +2,4 @@
|
||||||
[TestDriver click on a document in an iframe]
|
[TestDriver click on a document in an iframe]
|
||||||
expected:
|
expected:
|
||||||
if product == "chrome": [PASS, FAIL] # https://github.com/web-platform-tests/wpt/issues/26295
|
if product == "chrome": [PASS, FAIL] # https://github.com/web-platform-tests/wpt/issues/26295
|
||||||
|
if os == "mac" and product == "firefox": [PASS, FAIL] # https://github.com/web-platform-tests/wpt/issues/45987
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface PressureObserver {
|
||||||
undefined disconnect();
|
undefined disconnect();
|
||||||
sequence<PressureRecord> takeRecords();
|
sequence<PressureRecord> takeRecords();
|
||||||
|
|
||||||
[SameObject] static readonly attribute FrozenArray<PressureSource> supportedSources;
|
[SameObject] static readonly attribute FrozenArray<PressureSource> knownSources;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext]
|
[Exposed=(DedicatedWorker,SharedWorker,Window), SecureContext]
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
Tentative; contingent on merge of:
|
||||||
|
https://github.com/w3c/pointerevents/pull/495
|
||||||
|
|
||||||
|
This manual test validates the behavior of PointerEvent.deviceProperties.uniqueId.
|
||||||
|
Specifically, this test ensures that pointing devices get their own unique id, and
|
||||||
|
that the unique id is persistent over the session.
|
||||||
|
|
||||||
|
In order to run this test, it is necessary to have multiple pointing devices; such as a
|
||||||
|
pen and a mouse. Please follow the instructions exactly as written in order to ensure
|
||||||
|
the correct results are obtained.
|
||||||
|
-->
|
||||||
|
<title>DeviceProperties.uniqueId is unique for pointer events from different devices</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<style>
|
||||||
|
#instructions {
|
||||||
|
display: inline-block;
|
||||||
|
border-right: 1px solid black;
|
||||||
|
padding-right: 10px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
#testcontainer {
|
||||||
|
display: inline-block;
|
||||||
|
width: 300px;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#currentuniqueid {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point1 {
|
||||||
|
height: 50px;
|
||||||
|
width: 50px;
|
||||||
|
background-color: #00eeee;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.point2 {
|
||||||
|
height: 50px;
|
||||||
|
width: 50px;
|
||||||
|
background-color: #aa33aa;
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testarea {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
margin-bottom: 50px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<html>
|
||||||
|
<div id="instructions">
|
||||||
|
<h2>Instructions</h2>
|
||||||
|
<p>1. With one pointing device (pointing device #1), drag the pointer from A to B</p>
|
||||||
|
<p>2. With another pointing device (pointing device #2), drag the pointer from C to D</p>
|
||||||
|
<p>3. Repeat step 1.</p>
|
||||||
|
<p>4. Repeat step 2.</p>
|
||||||
|
<p>5. Click finish and verify the test passes. There should be 4 passing test cases. </p>
|
||||||
|
</div>
|
||||||
|
<div id="testcontainer">
|
||||||
|
<div>
|
||||||
|
Current pointer's unique id: <p id="currentuniqueid"></p>
|
||||||
|
</div>
|
||||||
|
<div class="testarea" id="device1">
|
||||||
|
<div class="point1">A</div>
|
||||||
|
<div class="point2">B</div>
|
||||||
|
</div>
|
||||||
|
<div class="testarea" id="device2">
|
||||||
|
<div class="point1">C</div>
|
||||||
|
<div class="point2">D</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>Click on the button below after completing. If a "PASS" result appears the test
|
||||||
|
passes, otherwise it fails</p>
|
||||||
|
<button onclick="Finish()">Finish Test</button>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let device1Ids = [];
|
||||||
|
let device2Ids = [];
|
||||||
|
|
||||||
|
setup({explicit_timeout: true, explicit_done: true});
|
||||||
|
|
||||||
|
function LogDeviceId(event, list) {
|
||||||
|
if (event.deviceProperties) {
|
||||||
|
const uniqueId = event.deviceProperties.uniqueId;
|
||||||
|
currentuniqueid.innerText = uniqueId ? uniqueId : "Unknown";
|
||||||
|
if (!uniqueId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
list.push(uniqueId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function LogDeviceId1(event) {
|
||||||
|
LogDeviceId(event, device1Ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LogDeviceId2(event) {
|
||||||
|
LogDeviceId(event, device2Ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Finish() {
|
||||||
|
let device1UniqueIds = new Set(device1Ids);
|
||||||
|
let device2UniqueIds = new Set(device2Ids);
|
||||||
|
|
||||||
|
test(function () {
|
||||||
|
assert_greater_than(device1Ids.length, 1, "Events from Device 1 have uniqueIds.");
|
||||||
|
assert_equals(device1UniqueIds.size, 1, "Device 1 has a consistent uniqueId.");
|
||||||
|
}, "uniqueId is consistent for device 1");
|
||||||
|
test(function () {
|
||||||
|
assert_greater_than(device2Ids.length, 1, "Events from Device 2 have uniqueIds.");
|
||||||
|
assert_equals(device2UniqueIds.size, 1, "Device 2 has a consistent uniqueId.");
|
||||||
|
}, "uniqueId is consistent for device 2");
|
||||||
|
test(function () {
|
||||||
|
// Ensure the two sets are different.
|
||||||
|
assert_equals(device1UniqueIds.intersection(device2UniqueIds).size, 0, "Device 1 and 2 have different uniqueIds.");
|
||||||
|
}, "uniqueId is unique to device 1 and device 2");
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
|
||||||
|
device1.addEventListener("pointerdown", LogDeviceId1, false);
|
||||||
|
device1.addEventListener("pointermove", LogDeviceId1, false);
|
||||||
|
device1.addEventListener("pointerup", LogDeviceId1, false);
|
||||||
|
|
||||||
|
device2.addEventListener("pointerdown", LogDeviceId2, false);
|
||||||
|
device2.addEventListener("pointermove", LogDeviceId2, false);
|
||||||
|
device2.addEventListener("pointerup", LogDeviceId2, false);
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,19 @@
|
||||||
|
async_test(t => {
|
||||||
|
const i = document.createElement('iframe');
|
||||||
|
i.src = "/common/blank.html";
|
||||||
|
i.onload = t.step_func_done(_ => {
|
||||||
|
assert_equals('undefined', typeof i.contentWindow.navigator.mediaDevices.getAllScreensMedia);
|
||||||
|
});
|
||||||
|
document.body.appendChild(i);
|
||||||
|
}, "No CSP, no exposure.");
|
||||||
|
|
||||||
|
async_test(t => {
|
||||||
|
const i = document.createElement('iframe');
|
||||||
|
i.src = "/content-security-policy/support/echo-policy.py?policy=" +
|
||||||
|
encodeURIComponent("script-src 'none'; object-src 'none'; base-uri 'none'; require-trusted-types-for 'script'");
|
||||||
|
i.onload = t.step_func_done(_ => {
|
||||||
|
assert_equals("function", typeof i.contentWindow.navigator.mediaDevices.getAllScreensMedia);
|
||||||
|
});
|
||||||
|
document.body.appendChild(i);
|
||||||
|
}, "Strict CSP + TT, exposure.");
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
const TEST_CACHE_NAME = 'v1';
|
const TEST_CACHE_NAME = 'v1';
|
||||||
|
const MAX_CONDITION_DEPTH = 10;
|
||||||
|
|
||||||
const routerRules = {
|
const routerRules = {
|
||||||
'condition-urlpattern-constructed-source-network': [{
|
'condition-urlpattern-constructed-source-network': [{
|
||||||
condition: {urlPattern: new URLPattern({pathname: '/**/direct.txt'})},
|
condition: {urlPattern: new URLPattern({pathname: '/**/direct.txt'})},
|
||||||
source: 'network'
|
source: 'network'
|
||||||
}],
|
}],
|
||||||
|
'condition-urlpattern-not-source-network': [{
|
||||||
|
condition: {not: {urlPattern: new URLPattern({pathname: '/**/not.txt'})}},
|
||||||
|
source: 'network'
|
||||||
|
}],
|
||||||
'condition-urlpattern-constructed-match-all-source-cache': [
|
'condition-urlpattern-constructed-match-all-source-cache': [
|
||||||
{condition: {urlPattern: new URLPattern({})}, source: 'cache'},
|
{condition: {urlPattern: new URLPattern({})}, source: 'cache'},
|
||||||
],
|
],
|
||||||
|
@ -43,14 +48,19 @@ const routerRules = {
|
||||||
[{condition: {requestMethod: 'PUT'}, source: 'network'}],
|
[{condition: {requestMethod: 'PUT'}, source: 'network'}],
|
||||||
'condition-request-method-delete-network':
|
'condition-request-method-delete-network':
|
||||||
[{condition: {requestMethod: 'DELETE'}, source: 'network'}],
|
[{condition: {requestMethod: 'DELETE'}, source: 'network'}],
|
||||||
|
'condition-lack-of-condition': [{
|
||||||
|
source: 'network'
|
||||||
|
}],
|
||||||
|
'condition-lack-of-source': [{
|
||||||
|
condition: {requestMode: 'no-cors'},
|
||||||
|
}],
|
||||||
'condition-invalid-request-method': [{
|
'condition-invalid-request-method': [{
|
||||||
condition: {requestMethod: String.fromCodePoint(0x3042)},
|
condition: {requestMethod: String.fromCodePoint(0x3042)},
|
||||||
source: 'network'
|
source: 'network'
|
||||||
}],
|
}],
|
||||||
'condition-invalid-or-condition-depth': (() => {
|
'condition-invalid-or-condition-depth': (() => {
|
||||||
const max = 10;
|
|
||||||
const addOrCondition = (obj, depth) => {
|
const addOrCondition = (obj, depth) => {
|
||||||
if (depth > max) {
|
if (depth > MAX_CONDITION_DEPTH) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -60,6 +70,17 @@ const routerRules = {
|
||||||
};
|
};
|
||||||
return {condition: addOrCondition({}, 0), source: 'network'};
|
return {condition: addOrCondition({}, 0), source: 'network'};
|
||||||
})(),
|
})(),
|
||||||
|
'condition-invalid-not-condition-depth': (() => {
|
||||||
|
const generateNotCondition = (depth) => {
|
||||||
|
if (depth > MAX_CONDITION_DEPTH) {
|
||||||
|
return {
|
||||||
|
urlPattern: '/**/example.txt',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {not: generateNotCondition(depth + 1)};
|
||||||
|
};
|
||||||
|
return {condition: generateNotCondition(0), source: 'network'};
|
||||||
|
})(),
|
||||||
'condition-invalid-router-size': [...Array(512)].map((val, i) => {
|
'condition-invalid-router-size': [...Array(512)].map((val, i) => {
|
||||||
return {
|
return {
|
||||||
condition: {urlPattern: `/foo-${i}`},
|
condition: {urlPattern: `/foo-${i}`},
|
||||||
|
|
|
@ -17,8 +17,14 @@ const ROUTER_RULE_KEY_INVALID_REQUEST_METHOD =
|
||||||
'condition-invalid-request-method';
|
'condition-invalid-request-method';
|
||||||
const ROUTER_RULE_KEY_INVALID_OR_CONDITION_DEPTH =
|
const ROUTER_RULE_KEY_INVALID_OR_CONDITION_DEPTH =
|
||||||
'condition-invalid-or-condition-depth';
|
'condition-invalid-or-condition-depth';
|
||||||
|
const ROUTER_RULE_KEY_INVALID_NOT_CONDITION_DEPTH =
|
||||||
|
'condition-invalid-not-condition-depth';
|
||||||
const ROUTER_RULE_KEY_INVALID_ROUTER_SIZE =
|
const ROUTER_RULE_KEY_INVALID_ROUTER_SIZE =
|
||||||
'condition-invalid-router-size';
|
'condition-invalid-router-size';
|
||||||
|
const ROUTER_RULE_KEY_LACK_OF_CONDITION =
|
||||||
|
'condition-lack-of-condition';
|
||||||
|
const ROUTER_RULE_KEY_LACK_OF_SOURCE =
|
||||||
|
'condition-lack-of-source';
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_REQUEST_METHOD);
|
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_REQUEST_METHOD);
|
||||||
|
@ -34,6 +40,13 @@ promise_test(async t => {
|
||||||
assert_equals(errors.length, 1);
|
assert_equals(errors.length, 1);
|
||||||
}, 'addRoutes should raise if or condition exceeds the depth limit');
|
}, 'addRoutes should raise if or condition exceeds the depth limit');
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_NOT_CONDITION_DEPTH);
|
||||||
|
t.add_cleanup(() => {reset_info_in_worker(worker)});
|
||||||
|
const {errors} = await get_info_from_worker(worker);
|
||||||
|
assert_equals(errors.length, 1);
|
||||||
|
}, 'addRoutes should raise if not condition exceeds the depth limit');
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_ROUTER_SIZE);
|
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_ROUTER_SIZE);
|
||||||
t.add_cleanup(() => {reset_info_in_worker(worker)});
|
t.add_cleanup(() => {reset_info_in_worker(worker)});
|
||||||
|
@ -41,5 +54,20 @@ promise_test(async t => {
|
||||||
assert_equals(errors.length, 1);
|
assert_equals(errors.length, 1);
|
||||||
}, 'addRoutes should raise if the number of router rules exceeds the length limit');
|
}, 'addRoutes should raise if the number of router rules exceeds the length limit');
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_LACK_OF_CONDITION);
|
||||||
|
t.add_cleanup(() => {reset_info_in_worker(worker)});
|
||||||
|
const {errors} = await get_info_from_worker(worker);
|
||||||
|
assert_equals(errors.length, 1);
|
||||||
|
}, 'addRoutes should raise if the conditon does not exist in the rule');
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_LACK_OF_SOURCE);
|
||||||
|
t.add_cleanup(() => {reset_info_in_worker(worker)});
|
||||||
|
const {errors} = await get_info_from_worker(worker);
|
||||||
|
assert_equals(errors.length, 1);
|
||||||
|
}, 'addRoutes should raise if the source does not exiswt in the rule');
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
const ROUTER_RULE_KEY = 'condition-urlpattern-constructed-source-network';
|
const ROUTER_RULE_KEY = 'condition-urlpattern-constructed-source-network';
|
||||||
|
const ROUTER_RULE_NOT_KEY = 'condition-urlpattern-not-source-network';
|
||||||
const ROUTER_RULE_KEY_IGNORE_CASE =
|
const ROUTER_RULE_KEY_IGNORE_CASE =
|
||||||
'condition-urlpattern-constructed-ignore-case-source-network';
|
'condition-urlpattern-constructed-ignore-case-source-network';
|
||||||
const ROUTER_RULE_KEY_RESPECT_CASE =
|
const ROUTER_RULE_KEY_RESPECT_CASE =
|
||||||
|
@ -23,6 +24,7 @@ const ROUTER_RULE_KEY_URLPATTERN_CACHE_WITH_NAME =
|
||||||
const REGISTERED_ROUTE = 'resources/direct.txt';
|
const REGISTERED_ROUTE = 'resources/direct.txt';
|
||||||
const CACHED_ROUTE = 'resources/cache.txt';
|
const CACHED_ROUTE = 'resources/cache.txt';
|
||||||
const NON_REGISTERED_ROUTE = 'resources/simple.html';
|
const NON_REGISTERED_ROUTE = 'resources/simple.html';
|
||||||
|
const NOT_ROUTE = 'resources/not.txt';
|
||||||
const host_info = get_host_info();
|
const host_info = get_host_info();
|
||||||
const path = new URL(".", window.location).pathname;
|
const path = new URL(".", window.location).pathname;
|
||||||
|
|
||||||
|
@ -72,5 +74,20 @@ iframeTest(CACHED_ROUTE, ROUTER_RULE_KEY_URLPATTERN_CACHE_WITH_NAME, async (t, i
|
||||||
assert_equals(requests.length, 0);
|
assert_equals(requests.length, 0);
|
||||||
assert_equals(iwin.document.body.innerText, "From cache");
|
assert_equals(iwin.document.body.innerText, "From cache");
|
||||||
}, 'Main resource load matched with the cache source, with specifying the cache name');
|
}, 'Main resource load matched with the cache source, with specifying the cache name');
|
||||||
|
|
||||||
|
iframeTest(NOT_ROUTE, ROUTER_RULE_NOT_KEY, async (t, iwin, worker) => {
|
||||||
|
const {requests} = await get_info_from_worker(worker);
|
||||||
|
assert_equals(requests.length, 1);
|
||||||
|
assert_equals(
|
||||||
|
requests[0].url,
|
||||||
|
`${host_info['HTTPS_ORIGIN']}${path}${NOT_ROUTE}`);
|
||||||
|
assert_equals(requests[0].mode, 'navigate');
|
||||||
|
}, 'Main resource load should not match the condition with not');
|
||||||
|
|
||||||
|
iframeTest(REGISTERED_ROUTE, ROUTER_RULE_NOT_KEY, async (t, iwin, worker) => {
|
||||||
|
const {requests} = await get_info_from_worker(worker);
|
||||||
|
assert_equals(requests.length, 0);
|
||||||
|
assert_equals(iwin.document.body.innerText, "Network\n");
|
||||||
|
}, 'Main resource load should match the condition without not');
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -27,10 +27,12 @@ const ROUTER_RULE_KEY_URL_PATTERN_CONSTRUCTED_MATCH_ALL_CACHE =
|
||||||
const ROUTER_RULE_KEY_URLPATTERN_CACHE_WITH_NAME =
|
const ROUTER_RULE_KEY_URLPATTERN_CACHE_WITH_NAME =
|
||||||
'condition-urlpattern-string-source-cache-with-name';
|
'condition-urlpattern-string-source-cache-with-name';
|
||||||
const ROUTER_RULE_KEY_OR = 'condition-or-source-network'
|
const ROUTER_RULE_KEY_OR = 'condition-or-source-network'
|
||||||
|
const ROUTER_RULE_KEY_NOT = 'condition-urlpattern-not-source-network';
|
||||||
const SCOPE = 'resources/';
|
const SCOPE = 'resources/';
|
||||||
const HTML_FILE = 'resources/simple.html';
|
const HTML_FILE = 'resources/simple.html';
|
||||||
const TXT_FILE = 'resources/direct.txt';
|
const TXT_FILE = 'resources/direct.txt';
|
||||||
const CSV_FILE = 'resources/simple.csv';
|
const CSV_FILE = 'resources/simple.csv';
|
||||||
|
const NOT_FILE = 'resources/not.txt';
|
||||||
// Warning: please prepare the corresponding `*.text.headers` files, otherwise
|
// Warning: please prepare the corresponding `*.text.headers` files, otherwise
|
||||||
// iframeTest() fails to load the following files due to MIME mismatches.
|
// iframeTest() fails to load the following files due to MIME mismatches.
|
||||||
const OR_TEST_FILES = [
|
const OR_TEST_FILES = [
|
||||||
|
@ -184,5 +186,17 @@ iframeTest(HTML_FILE, ROUTER_RULE_KEY_URLPATTERN_CACHE_WITH_NAME, async (t, iwin
|
||||||
assert_equals(response_with_param.status, 404);
|
assert_equals(response_with_param.status, 404);
|
||||||
}, 'Subresource load matched with the cache source, with specifying the cache name');
|
}, 'Subresource load matched with the cache source, with specifying the cache name');
|
||||||
|
|
||||||
|
iframeTest(TXT_FILE, ROUTER_RULE_KEY_NOT, async (t, iwin) => {
|
||||||
|
const rnd = randomString();
|
||||||
|
const response = await iwin.fetch(`${NOT_FILE}?nonce=${rnd}`);
|
||||||
|
assert_equals(await response.text(), rnd);
|
||||||
|
}, 'Subresource load should not match with the not condition');
|
||||||
|
|
||||||
|
iframeTest(TXT_FILE, ROUTER_RULE_KEY_NOT, async (t, iwin) => {
|
||||||
|
const rnd = randomString();
|
||||||
|
const response = await iwin.fetch('?nonce=' + rnd);
|
||||||
|
assert_equals(await response.text(), "Network\n");
|
||||||
|
}, 'Subresource load should match with a file other than not');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
<meta name="timeout" content="long">
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script src="/resources/testdriver.js"></script>
|
<script src="/resources/testdriver.js"></script>
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html class="reftest-wait">
|
||||||
|
<title><marker> element added after first paint</title>
|
||||||
|
<script src="/common/reftest-wait.js"></script>
|
||||||
|
<script src="/common/rendering-utils.js"></script>
|
||||||
|
<link rel="match" href="../../struct/reftests/reference/green-100x100.html">
|
||||||
|
<svg>
|
||||||
|
<path d="M0,0h100" marker-start="url(#m)"/>
|
||||||
|
</svg>
|
||||||
|
<script>
|
||||||
|
function createSvgElement(name, attrData) {
|
||||||
|
const svgNs = 'http://www.w3.org/2000/svg';
|
||||||
|
const element = document.createElementNS(svgNs, name);
|
||||||
|
attrData.forEach(([name, value]) => element.setAttribute(name, value));
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
waitForAtLeastOneFrame().then(() => {
|
||||||
|
const svgNs = 'http://www.w3.org/2000/svg';
|
||||||
|
const markerElement = createSvgElement('marker', [
|
||||||
|
['id', 'm'], ['orient', '0'], ['overflow', 'visible']
|
||||||
|
]);
|
||||||
|
markerElement.appendChild(createSvgElement('rect', [
|
||||||
|
['width', '100'], ['height', '100'], ['fill', 'green']
|
||||||
|
]));
|
||||||
|
const svg = document.querySelector('svg');
|
||||||
|
svg.insertBefore(markerElement, svg.firstElementChild);
|
||||||
|
takeScreenshot();
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -1,6 +1,6 @@
|
||||||
steps:
|
steps:
|
||||||
# The conflicting google-chrome and chromedriver casks are first uninstalled.
|
# The conflicting google-chrome and chromedriver casks are first uninstalled.
|
||||||
# The raw google-chrome-dev cask URL is used to bypass caching.
|
# The raw google-chrome@dev.rb cask URL is used to bypass caching.
|
||||||
- script: |
|
- script: |
|
||||||
set -eux -o pipefail
|
set -eux -o pipefail
|
||||||
HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall --cask google-chrome || true
|
HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall --cask google-chrome || true
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
steps:
|
steps:
|
||||||
# This is equivalent to `Homebrew/homebrew-cask-versions/firefox-nightly`,
|
# The raw firefox@nightly.rb cask URL is used to bypass caching.
|
||||||
# but the raw URL is used to bypass caching.
|
|
||||||
- script: |
|
- script: |
|
||||||
set -eux -o pipefail
|
set -eux -o pipefail
|
||||||
curl https://raw.githubusercontent.com/Homebrew/homebrew-cask-versions/master/Casks/firefox-nightly.rb > firefox-nightly.rb
|
curl https://raw.githubusercontent.com/Homebrew/homebrew-cask/HEAD/Casks/f/firefox@nightly.rb > firefox@nightly.rb
|
||||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask firefox-nightly.rb
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask firefox@nightly.rb
|
||||||
displayName: 'Install Firefox Nightly'
|
displayName: 'Install Firefox Nightly'
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
||||||
|
|
|
@ -829,7 +829,8 @@ def start_http_server(logger, host, port, paths, routes, bind_address, config, *
|
||||||
key_file=None,
|
key_file=None,
|
||||||
certificate=None,
|
certificate=None,
|
||||||
latency=kwargs.get("latency"))
|
latency=kwargs.get("latency"))
|
||||||
except Exception:
|
except Exception as error:
|
||||||
|
logger.critical(f"start_http_server: Caught exception from wptserve.WebTestHttpd: {error}")
|
||||||
startup_failed(logger)
|
startup_failed(logger)
|
||||||
|
|
||||||
|
|
||||||
|
@ -847,7 +848,8 @@ def start_https_server(logger, host, port, paths, routes, bind_address, config,
|
||||||
certificate=config.ssl_config["cert_path"],
|
certificate=config.ssl_config["cert_path"],
|
||||||
encrypt_after_connect=config.ssl_config["encrypt_after_connect"],
|
encrypt_after_connect=config.ssl_config["encrypt_after_connect"],
|
||||||
latency=kwargs.get("latency"))
|
latency=kwargs.get("latency"))
|
||||||
except Exception:
|
except Exception as error:
|
||||||
|
logger.critical(f"start_https_server: Caught exception from wptserve.WebTestHttpd: {error}")
|
||||||
startup_failed(logger)
|
startup_failed(logger)
|
||||||
|
|
||||||
|
|
||||||
|
@ -868,7 +870,8 @@ def start_http2_server(logger, host, port, paths, routes, bind_address, config,
|
||||||
encrypt_after_connect=config.ssl_config["encrypt_after_connect"],
|
encrypt_after_connect=config.ssl_config["encrypt_after_connect"],
|
||||||
latency=kwargs.get("latency"),
|
latency=kwargs.get("latency"),
|
||||||
http2=True)
|
http2=True)
|
||||||
except Exception:
|
except Exception as error:
|
||||||
|
logger.critical(f"start_http2_server: Caught exception from wptserve.WebTestHttpd: {error}")
|
||||||
startup_failed(logger)
|
startup_failed(logger)
|
||||||
|
|
||||||
|
|
||||||
|
@ -935,7 +938,8 @@ def start_ws_server(logger, host, port, paths, routes, bind_address, config, **k
|
||||||
config.paths["ws_doc_root"],
|
config.paths["ws_doc_root"],
|
||||||
bind_address,
|
bind_address,
|
||||||
ssl_config=None)
|
ssl_config=None)
|
||||||
except Exception:
|
except Exception as error:
|
||||||
|
logger.critical(f"start_ws_server: Caught exception from WebSocketDomain: {error}")
|
||||||
startup_failed(logger)
|
startup_failed(logger)
|
||||||
|
|
||||||
|
|
||||||
|
@ -947,7 +951,8 @@ def start_wss_server(logger, host, port, paths, routes, bind_address, config, **
|
||||||
config.paths["ws_doc_root"],
|
config.paths["ws_doc_root"],
|
||||||
bind_address,
|
bind_address,
|
||||||
config.ssl_config)
|
config.ssl_config)
|
||||||
except Exception:
|
except Exception as error:
|
||||||
|
logger.critical(f"start_wss_server: Caught exception from WebSocketDomain: {error}")
|
||||||
startup_failed(logger)
|
startup_failed(logger)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
html5lib==1.1
|
html5lib==1.1
|
||||||
mozdebug==0.3.0
|
mozdebug==0.3.1
|
||||||
mozinfo==1.2.3 # https://bugzilla.mozilla.org/show_bug.cgi?id=1621226
|
mozinfo==1.2.3 # https://bugzilla.mozilla.org/show_bug.cgi?id=1621226
|
||||||
mozlog==8.0.0
|
mozlog==8.0.0
|
||||||
mozprocess==1.3.1
|
mozprocess==1.3.1
|
||||||
|
@ -7,4 +7,4 @@ packaging==24.0
|
||||||
pillow==9.5.0
|
pillow==9.5.0
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
six==1.16.0
|
six==1.16.0
|
||||||
urllib3==2.0.7
|
urllib3==2.2.1
|
||||||
|
|
|
@ -6,5 +6,5 @@ mozleak==0.2
|
||||||
mozprofile==3.0.0
|
mozprofile==3.0.0
|
||||||
mozrunner==8.3.1
|
mozrunner==8.3.1
|
||||||
mozversion==2.4.0
|
mozversion==2.4.0
|
||||||
psutil==5.9.5
|
psutil==5.9.8
|
||||||
redo==2.0.4
|
redo==2.0.4
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
psutil==5.9.5
|
psutil==5.9.8
|
||||||
|
|
9
tests/wpt/tests/trusted-types/support/resolve-spv.js
Normal file
9
tests/wpt/tests/trusted-types/support/resolve-spv.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// Returns a promise that resolves with a Security Policy Violation (spv)
|
||||||
|
// even when it is received.
|
||||||
|
function promise_spv() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
window.addEventListener("securitypolicyviolation", e => {
|
||||||
|
resolve(e);
|
||||||
|
}, { once: true });
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="./support/resolve-spv.js"></script>
|
||||||
|
<meta http-equiv="Content-Security-Policy"
|
||||||
|
content="require-trusted-types-for 'script'">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="log"></div>
|
||||||
|
<svg id="svg"><script id="script">"some script text";</script></svg>
|
||||||
|
<script>
|
||||||
|
const policy = trustedTypes.createPolicy("policy", {
|
||||||
|
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
assert_throws_js(TypeError, _ => {
|
||||||
|
elem.href.baseVal = "about:blank";
|
||||||
|
});
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
return promise_spv();
|
||||||
|
}, "Assign string to SVGScriptElement.href.baseVal.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
elem.href.baseVal = policy.createScriptURL("about:blank");
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign TrustedScriptURL to SVGScriptElement.href.baseVal.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
assert_throws_js(TypeError, _ => {
|
||||||
|
elem.setAttribute("href", "about:blank");
|
||||||
|
});
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
return promise_spv();
|
||||||
|
}, "Assign string to non-attached SVGScriptElement.href via setAttribute.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
elem.setAttribute("href", policy.createScriptURL("about:blank"));
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign TrustedScriptURL to non-attached SVGScriptElement.href via setAttribute.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
assert_throws_js(TypeError, _ => {
|
||||||
|
elem.setAttribute("href", "about:blank");
|
||||||
|
});
|
||||||
|
return promise_spv();
|
||||||
|
}, "Assign string to attached SVGScriptElement.href via setAttribute.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
elem.setAttribute("href", policy.createScriptURL("about:blank"));
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign TrustedScriptURL to attached SVGScriptElement.href via setAttribute.");
|
||||||
|
|
||||||
|
// Default policy test: We repate the string assignment tests above,
|
||||||
|
// but now expect all of them to pass.
|
||||||
|
promise_test(t => {
|
||||||
|
trustedTypes.createPolicy("default", {
|
||||||
|
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Setup default policy");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
document.getElementById("script").innerHTML = "'modified via innerHTML';";
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign String to SVGScriptElement.innerHTML w/ default policy.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
elem.href.baseVal = "about:blank";
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign string to SVGScriptElement.href.baseVal w/ default policy.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
elem.setAttribute("href", "about:blank");
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign string to non-attached SVGScriptElement.href via setAttribute w/ default policy.");
|
||||||
|
|
||||||
|
promise_test(t => {
|
||||||
|
const elem = document.createElementNS(
|
||||||
|
"http://www.w3.org/2000/svg", "script");
|
||||||
|
document.getElementById("svg").appendChild(elem);
|
||||||
|
elem.setAttribute("href", "about:blank");
|
||||||
|
return Promise.resolve();
|
||||||
|
}, "Assign string to attached SVGScriptElement.href via setAttribute w/ default policy.");
|
||||||
|
</script>
|
||||||
|
</body>
|
|
@ -2,6 +2,7 @@
|
||||||
<head>
|
<head>
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
<script src="./support/resolve-spv.js"></script>
|
||||||
<meta http-equiv="Content-Security-Policy"
|
<meta http-equiv="Content-Security-Policy"
|
||||||
content="require-trusted-types-for 'script'">
|
content="require-trusted-types-for 'script'">
|
||||||
</head>
|
</head>
|
||||||
|
@ -9,16 +10,6 @@
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<svg id="svg"><script id="script">"some script text";</script></svg>
|
<svg id="svg"><script id="script">"some script text";</script></svg>
|
||||||
<script>
|
<script>
|
||||||
// Returns a promise that resolves with a Security Policy Violation (spv)
|
|
||||||
// even when it is received.
|
|
||||||
function promise_spv() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
window.addEventListener("securitypolicyviolation", e => {
|
|
||||||
resolve(e);
|
|
||||||
}, { once: true });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const policy = trustedTypes.createPolicy("policy", {
|
const policy = trustedTypes.createPolicy("policy", {
|
||||||
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
|
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
|
||||||
|
|
||||||
|
@ -49,96 +40,5 @@
|
||||||
document.getElementById("svg").appendChild(elem);
|
document.getElementById("svg").appendChild(elem);
|
||||||
return promise_spv();
|
return promise_spv();
|
||||||
}, "Modify SVGScriptElement via DOM manipulation.");
|
}, "Modify SVGScriptElement via DOM manipulation.");
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
assert_throws_js(TypeError, _ => {
|
|
||||||
elem.href.baseVal = "about:blank";
|
|
||||||
});
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
return promise_spv();
|
|
||||||
}, "Assign string to SVGScriptElement.href.baseVal.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
elem.href.baseVal = policy.createScriptURL("about:blank");
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign TrustedScriptURL to SVGScriptElement.href.baseVal.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
assert_throws_js(TypeError, _ => {
|
|
||||||
elem.setAttribute("href", "about:blank");
|
|
||||||
});
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
return promise_spv();
|
|
||||||
}, "Assign string to non-attached SVGScriptElement.href via setAttribute.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
elem.setAttribute("href", policy.createScriptURL("about:blank"));
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign TrustedScriptURL to non-attached SVGScriptElement.href via setAttribute.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
assert_throws_js(TypeError, _ => {
|
|
||||||
elem.setAttribute("href", "about:blank");
|
|
||||||
});
|
|
||||||
return promise_spv();
|
|
||||||
}, "Assign string to attached SVGScriptElement.href via setAttribute.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
elem.setAttribute("href", policy.createScriptURL("about:blank"));
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign TrustedScriptURL to attached SVGScriptElement.href via setAttribute.");
|
|
||||||
|
|
||||||
// Default policy test: We repate the string assignment tests above,
|
|
||||||
// but now expect all of them to pass.
|
|
||||||
promise_test(t => {
|
|
||||||
trustedTypes.createPolicy("default", {
|
|
||||||
createScript: x => x, createHTML: x => x, createScriptURL: x => x });
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Setup default policy");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
document.getElementById("script").innerHTML = "'modified via innerHTML';";
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign String to SVGScriptElement.innerHTML w/ default policy.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
elem.href.baseVal = "about:blank";
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign string to SVGScriptElement.href.baseVal w/ default policy.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
elem.setAttribute("href", "about:blank");
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign string to non-attached SVGScriptElement.href via setAttribute w/ default policy.");
|
|
||||||
|
|
||||||
promise_test(t => {
|
|
||||||
const elem = document.createElementNS(
|
|
||||||
"http://www.w3.org/2000/svg", "script");
|
|
||||||
document.getElementById("svg").appendChild(elem);
|
|
||||||
elem.setAttribute("href", "about:blank");
|
|
||||||
return Promise.resolve();
|
|
||||||
}, "Assign string to attached SVGScriptElement.href via setAttribute w/ default policy.");
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API argMin/Max operations
|
// META: title=test WebNN API argMin/Max operations
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-argminmax
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-argminmax
|
||||||
|
|
||||||
testWebNNOperation(['argMin', 'argMax'], buildOperationWithSingleInput);
|
runWebNNConformanceTests(['argMin', 'argMax'], buildOperationWithSingleInput);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API batchNormalization operation
|
// META: title=test WebNN API batchNormalization operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-batchnorm
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-batchnorm
|
||||||
|
|
||||||
testWebNNOperation('batchNormalization', buildBatchNorm);
|
runWebNNConformanceTests('batchNormalization', buildBatchNorm);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API buffer operations
|
// META: title=test WebNN API buffer operations
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,10 +9,11 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlbuffer
|
// https://webmachinelearning.github.io/webnn/#api-mlbuffer
|
||||||
|
|
||||||
testCreateWebNNBuffer("create", 4);
|
if (navigator.ml) {
|
||||||
|
testCreateWebNNBuffer('create', 4);
|
||||||
testDestroyWebNNBuffer('destroyTwice');
|
testDestroyWebNNBuffer('destroyTwice');
|
||||||
|
testReadWebNNBuffer('read');
|
||||||
testReadWebNNBuffer('read');
|
testWriteWebNNBuffer('write');
|
||||||
|
} else {
|
||||||
testWriteWebNNBuffer('write');
|
test(() => assert_implements(navigator.ml, 'missing navigator.ml'));
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API cast operation
|
// META: title=test WebNN API cast operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-cast
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-cast
|
||||||
|
|
||||||
testWebNNOperation('cast', buildCast);
|
runWebNNConformanceTests('cast', buildCast);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API clamp operation
|
// META: title=test WebNN API clamp operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-clamp
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-clamp
|
||||||
|
|
||||||
testWebNNOperation('clamp', buildOperationWithSingleInput);
|
runWebNNConformanceTests('clamp', buildOperationWithSingleInput);
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
// META: title=test WebNN MLContext.compute() for ArrayBufferView created from bigger ArrayBuffer
|
||||||
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?gpu
|
||||||
|
// META: script=../resources/utils.js
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// These tests are used to reproduce the Chromium issue:
|
||||||
|
// https://issues.chromium.org/issues/332151809
|
||||||
|
|
||||||
|
if (navigator.ml) {
|
||||||
|
const variant = location.search.substring(1);
|
||||||
|
const contextOptions = kContextOptionsForVariant[variant];
|
||||||
|
|
||||||
|
let context;
|
||||||
|
let builder;
|
||||||
|
|
||||||
|
promise_setup(async () => {
|
||||||
|
let supported = false;
|
||||||
|
try {
|
||||||
|
context = await navigator.ml.createContext(contextOptions);
|
||||||
|
supported = true;
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
assert_implements(
|
||||||
|
supported, `Unable to create context for ${variant} variant`);
|
||||||
|
builder = new MLGraphBuilder(context);
|
||||||
|
});
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const a = builder.input('a', {dataType: 'float32', dimensions: [2]});
|
||||||
|
const b = builder.relu(a);
|
||||||
|
const graph = await builder.build({b});
|
||||||
|
const arraybuffer = new ArrayBuffer(100);
|
||||||
|
const aBuffer =
|
||||||
|
new Float32Array(arraybuffer, /*byteOffset*/ 4, /*length*/ 2)
|
||||||
|
aBuffer.set([1, -1]);
|
||||||
|
const bBuffer = new Float32Array(2);
|
||||||
|
const results =
|
||||||
|
await context.compute(graph, {'a': aBuffer}, {'b': bBuffer});
|
||||||
|
assert_array_approx_equals_ulp(
|
||||||
|
results.outputs.b, [1, 0], /*nulp*/ 0, 'float32');
|
||||||
|
}, 'Test compute() working for input ArrayBufferView created from bigger ArrayBuffer');
|
||||||
|
|
||||||
|
promise_test(async t => {
|
||||||
|
const a = builder.input('a', {dataType: 'float32', dimensions: [2]});
|
||||||
|
const b = builder.relu(a);
|
||||||
|
const graph = await builder.build({b});
|
||||||
|
const aBuffer = new Float32Array(2);
|
||||||
|
aBuffer.set([1, -1]);
|
||||||
|
const arraybuffer = new ArrayBuffer(100);
|
||||||
|
const bBuffer =
|
||||||
|
new Float32Array(arraybuffer, /*byteOffset*/ 8, /*length*/ 2);
|
||||||
|
const results =
|
||||||
|
await context.compute(graph, {'a': aBuffer}, {'b': bBuffer});
|
||||||
|
assert_array_approx_equals_ulp(
|
||||||
|
results.outputs.b, [1, 0], /*nulp*/ 0, 'float32');
|
||||||
|
}, 'Test compute() working for output ArrayBufferView created from bigger ArrayBuffer');
|
||||||
|
} else {
|
||||||
|
test(() => assert_implements(navigator.ml, 'missing navigator.ml'));
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API concat operation
|
// META: title=test WebNN API concat operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-concat
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-concat
|
||||||
|
|
||||||
testWebNNOperation('concat', buildConcat);
|
runWebNNConformanceTests('concat', buildConcat);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API constant
|
// META: title=test WebNN API constant
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-constant-range
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-constant-range
|
||||||
|
|
||||||
testWebNNOperation('constant', buildConstantRange);
|
runWebNNConformanceTests('constant', buildConstantRange);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API conv2d operation
|
// META: title=test WebNN API conv2d operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-conv2d
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-conv2d
|
||||||
|
|
||||||
testWebNNOperation('conv2d', buildConv2d);
|
runWebNNConformanceTests('conv2d', buildConv2d);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API convTranspose2d operation
|
// META: title=test WebNN API convTranspose2d operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-convtranspose2d
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-convtranspose2d
|
||||||
|
|
||||||
testWebNNOperation('convTranspose2d', buildConvTranspose2d);
|
runWebNNConformanceTests('convTranspose2d', buildConvTranspose2d);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API element-wise binary operations
|
// META: title=test WebNN API element-wise binary operations
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,6 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary
|
||||||
|
|
||||||
testWebNNOperation(['add', 'sub', 'mul', 'div', 'max', 'min', 'pow'], buildOperationWithTwoInputs);
|
runWebNNConformanceTests(
|
||||||
|
['add', 'sub', 'mul', 'div', 'max', 'min', 'pow'],
|
||||||
|
buildOperationWithTwoInputs);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API element-wise logical operations
|
// META: title=test WebNN API element-wise logical operations
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,14 +9,17 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-logical
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-logical
|
||||||
|
|
||||||
testWebNNOperation(
|
if (navigator.ml) {
|
||||||
[
|
testWebNNOperation(
|
||||||
'equal',
|
[
|
||||||
'greater',
|
'equal',
|
||||||
'greaterOrEqual',
|
'greater',
|
||||||
'lesser',
|
'greaterOrEqual',
|
||||||
'lesserOrEqual',
|
'lesser',
|
||||||
],
|
'lesserOrEqual',
|
||||||
buildOperationWithTwoInputs
|
],
|
||||||
);
|
buildOperationWithTwoInputs);
|
||||||
testWebNNOperation('logicalNot', buildOperationWithSingleInput);
|
testWebNNOperation('logicalNot', buildOperationWithSingleInput);
|
||||||
|
} else {
|
||||||
|
test(() => assert_implements(navigator.ml, 'missing navigator.ml'));
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API element-wise unary operations
|
// META: title=test WebNN API element-wise unary operations
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,7 +9,9 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-unary
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-unary
|
||||||
|
|
||||||
testWebNNOperation(
|
runWebNNConformanceTests(
|
||||||
['abs', 'ceil', 'cos', 'erf', 'exp', 'floor', 'identity', 'log', 'neg', 'reciprocal', 'sin', 'sqrt', 'tan'],
|
[
|
||||||
buildOperationWithSingleInput
|
'abs', 'ceil', 'cos', 'erf', 'exp', 'floor', 'identity', 'log', 'neg',
|
||||||
);
|
'reciprocal', 'sin', 'sqrt', 'tan'
|
||||||
|
],
|
||||||
|
buildOperationWithSingleInput);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API elu operation
|
// META: title=test WebNN API elu operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-elu
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-elu
|
||||||
|
|
||||||
testWebNNOperation('elu', buildOperationWithSingleInput);
|
runWebNNConformanceTests('elu', buildOperationWithSingleInput);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API expand operation
|
// META: title=test WebNN API expand operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,5 +9,5 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-expand
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-expand
|
||||||
|
|
||||||
// reuse buildReshape method
|
// Reuse buildReshape method
|
||||||
testWebNNOperation('expand', buildReshape);
|
runWebNNConformanceTests('expand', buildReshape);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API gather operation
|
// META: title=test WebNN API gather operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gather
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gather
|
||||||
|
|
||||||
testWebNNOperation('gather', buildOperationWithTwoInputs);
|
runWebNNConformanceTests('gather', buildOperationWithTwoInputs);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// META: title=test WebNN API gemm operation
|
// META: title=test WebNN API gemm operation
|
||||||
// META: global=window,dedicatedworker
|
// META: global=window,dedicatedworker
|
||||||
|
// META: variant=?cpu
|
||||||
|
// META: variant=?gpu
|
||||||
// META: script=../resources/utils.js
|
// META: script=../resources/utils.js
|
||||||
// META: timeout=long
|
// META: timeout=long
|
||||||
|
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gemm
|
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gemm
|
||||||
|
|
||||||
testWebNNOperation('gemm', buildGemm);
|
runWebNNConformanceTests('gemm', buildGemm);
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API argMin/Max operations
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-argminmax
|
|
||||||
|
|
||||||
testWebNNOperation(['argMin', 'argMax'], buildOperationWithSingleInput, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API batchNormalization operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-batchnorm
|
|
||||||
|
|
||||||
testWebNNOperation('batchNormalization', buildBatchNorm, 'gpu');
|
|
|
@ -1,16 +0,0 @@
|
||||||
// META: title=test WebNN API buffer operations
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlbuffer
|
|
||||||
|
|
||||||
testCreateWebNNBuffer("create", 4, 'gpu');
|
|
||||||
|
|
||||||
testDestroyWebNNBuffer('destroyTwice', 'gpu');
|
|
||||||
|
|
||||||
testReadWebNNBuffer('read', 'gpu');
|
|
||||||
|
|
||||||
testWriteWebNNBuffer('write', 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API cast operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-cast
|
|
||||||
|
|
||||||
testWebNNOperation('cast', buildCast, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API clamp operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-clamp
|
|
||||||
|
|
||||||
testWebNNOperation('clamp', buildOperationWithSingleInput, 'gpu');
|
|
|
@ -1,37 +0,0 @@
|
||||||
// META: title=test WebNN MLContext.compute() for ArrayBufferView created from bigger ArrayBuffer
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// These tests are used to reproduce the Chromium issue:
|
|
||||||
// https://issues.chromium.org/issues/332151809
|
|
||||||
promise_test(async t => {
|
|
||||||
const context = await navigator.ml.createContext({deviceType: 'gpu'});
|
|
||||||
const builder = new MLGraphBuilder(context);
|
|
||||||
const a = builder.input('a', {dataType: 'float32', dimensions: [2]});
|
|
||||||
const b = builder.relu(a);
|
|
||||||
const graph = await builder.build({b});
|
|
||||||
const arraybuffer = new ArrayBuffer(100);
|
|
||||||
const aBuffer = new Float32Array(arraybuffer, /*byteOffset*/ 4, /*length*/ 2)
|
|
||||||
aBuffer.set([1, -1]);
|
|
||||||
const bBuffer = new Float32Array(2);
|
|
||||||
const results = await context.compute(graph, {'a': aBuffer}, {'b': bBuffer});
|
|
||||||
assert_array_approx_equals_ulp(
|
|
||||||
results.outputs.b, [1, 0], /*nulp*/ 0, 'float32');
|
|
||||||
}, 'Test compute() working for input ArrayBufferView created from bigger ArrayBuffer');
|
|
||||||
|
|
||||||
promise_test(async t => {
|
|
||||||
const context = await navigator.ml.createContext({deviceType: 'gpu'});
|
|
||||||
const builder = new MLGraphBuilder(context);
|
|
||||||
const a = builder.input('a', {dataType: 'float32', dimensions: [2]});
|
|
||||||
const b = builder.relu(a);
|
|
||||||
const graph = await builder.build({b});
|
|
||||||
const aBuffer = new Float32Array(2);
|
|
||||||
aBuffer.set([1, -1]);
|
|
||||||
const arraybuffer = new ArrayBuffer(100);
|
|
||||||
const bBuffer = new Float32Array(arraybuffer, /*byteOffset*/ 8, /*length*/ 2);
|
|
||||||
const results = await context.compute(graph, {'a': aBuffer}, {'b': bBuffer});
|
|
||||||
assert_array_approx_equals_ulp(
|
|
||||||
results.outputs.b, [1, 0], /*nulp*/ 0, 'float32');
|
|
||||||
}, 'Test compute() working for output ArrayBufferView created from bigger ArrayBuffer');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API concat operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-concat
|
|
||||||
|
|
||||||
testWebNNOperation('concat', buildConcat, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API constant
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-constant-range
|
|
||||||
|
|
||||||
testWebNNOperation('constant', buildConstantRange, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API conv2d operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-conv2d
|
|
||||||
|
|
||||||
testWebNNOperation('conv2d', buildConv2d, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API convTranspose2d operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-convtranspose2d
|
|
||||||
|
|
||||||
testWebNNOperation('convTranspose2d', buildConvTranspose2d, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API element-wise binary operations
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary
|
|
||||||
|
|
||||||
testWebNNOperation(['add', 'sub', 'mul', 'div', 'max', 'min', 'pow'], buildOperationWithTwoInputs, 'gpu');
|
|
|
@ -1,20 +0,0 @@
|
||||||
// META: title=test WebNN API element-wise logical operations
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-logical
|
|
||||||
|
|
||||||
testWebNNOperation(
|
|
||||||
[
|
|
||||||
'equal',
|
|
||||||
'greater',
|
|
||||||
'greaterOrEqual',
|
|
||||||
'lesser',
|
|
||||||
'lesserOrEqual',
|
|
||||||
],
|
|
||||||
buildOperationWithTwoInputs, 'gpu'
|
|
||||||
);
|
|
||||||
testWebNNOperation('logicalNot', buildOperationWithSingleInput, 'gpu');
|
|
|
@ -1,13 +0,0 @@
|
||||||
// META: title=test WebNN API element-wise unary operations
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-unary
|
|
||||||
|
|
||||||
testWebNNOperation(
|
|
||||||
['abs', 'ceil', 'cos', 'erf', 'exp', 'floor', 'identity', 'log', 'neg', 'reciprocal', 'sin', 'sqrt', 'tan'],
|
|
||||||
buildOperationWithSingleInput, 'gpu'
|
|
||||||
);
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API elu operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-elu
|
|
||||||
|
|
||||||
testWebNNOperation('elu', buildOperationWithSingleInput, 'gpu');
|
|
|
@ -1,11 +0,0 @@
|
||||||
// META: title=test WebNN API expand operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-expand
|
|
||||||
|
|
||||||
// reuse buildReshape method
|
|
||||||
testWebNNOperation('expand', buildReshape, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API gather operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gather
|
|
||||||
|
|
||||||
testWebNNOperation('gather', buildOperationWithTwoInputs, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API gemm operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gemm
|
|
||||||
|
|
||||||
testWebNNOperation('gemm', buildGemm, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API hardSigmoid operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-hard-sigmoid
|
|
||||||
|
|
||||||
testWebNNOperation('hardSigmoid', buildOperationWithSingleInput, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API tanh operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-hard-swish
|
|
||||||
|
|
||||||
testWebNNOperation('hardSwish', buildOperationWithSingleInput, 'gpu');
|
|
|
@ -1,10 +0,0 @@
|
||||||
// META: title=test WebNN API instanceNormalization operation
|
|
||||||
// META: global=window,dedicatedworker
|
|
||||||
// META: script=../../resources/utils.js
|
|
||||||
// META: timeout=long
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-instancenorm
|
|
||||||
|
|
||||||
testWebNNOperation('instanceNormalization', buildLayerNorm, 'gpu');
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue