Update web-platform-tests to revision ef625c6ac28d0ac07ef0c62a6f22c10d14a2623a

This commit is contained in:
WPT Sync Bot 2019-01-23 21:00:43 -05:00
parent 5b41c01bdc
commit bd01f2fabd
125 changed files with 3871 additions and 323 deletions

View file

@ -21,7 +21,7 @@ jobs:
steps:
- template: tools/ci/azure/affected_tests.yml
parameters:
artifactName: 'results'
artifactName: 'affected-tests'
- job: affected_without_changes_macOS
displayName: 'affected tests without changes (Safari Technology Preview)'
@ -33,7 +33,7 @@ jobs:
parameters:
checkoutCommit: 'HEAD^1'
affectedRange: 'HEAD@{1}'
artifactName: 'results-without-changes'
artifactName: 'affected-tests-without-changes'
# The decision jobs runs `./wpt test-jobs` to determine which jobs to run,
# and all following jobs wait for it to finish and depend on its output.

View file

@ -1,57 +0,0 @@
<!doctype html>
<title>-webkit-appearance</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<button id=button>Test</button>
<script>
const button = document.getElementById('button');
// values from https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance
// intersection of Firefox and Chrome.
const values = ["none",
"button",
"button-bevel",
"caret",
"checkbox",
"listbox",
"listitem",
"menulist",
"menulist-button",
"menulist-text",
"menulist-textfield",
"radio",
"searchfield",
"textfield",
];
for (const value of values) {
test(() => {
button.removeAttribute('style');
button.style.setProperty('-webkit-appearance', value);
assert_equals(button.style.WebkitAppearance, value);
assert_equals(button.style.webkitAppearance, value); // lowercase w
const style = getComputedStyle(button);
assert_equals(style.WebkitAppearance, value);
assert_equals(style.webkitAppearance, value); // lowercase w
}, `-webkit-appearance: ${value}`);
}
const invalidValues = ["bogus-button"];
for (const invalidValue of invalidValues) {
test(() => {
button.removeAttribute('style');
button.style.setProperty('-webkit-appearance', invalidValue);
assert_equals(button.style.WebkitAppearance, "");
assert_equals(button.style.webkitAppearance, ""); // lowercase w
const style = getComputedStyle(button);
assert_equals(style.WebkitAppearance, "button");
assert_equals(style.webkitAppearance, "button"); // lowercase w
}, `-webkit-appearance: ${invalidValue} (invalid)`);
}
test(() => {
button.removeAttribute('style');
button.style.setProperty('appearance', 'auto');
assert_equals(button.style.appearance, undefined);
const style = getComputedStyle(button);
assert_equals(style.appearance, undefined);
}, 'appearance');
</script>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>Child of block with clear</title>
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control" title="9.5.2 Controlling flow next to floats: the 'clear' property">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<p>Test passes if there is a filled green square.</p>
<div style="width: 100px;background: red;overflow: hidden;">
<div style="float: right; height: 20px; width: 50%; background: green;"></div>
<div>
<div style="float: left; height:100px; width: 50%; background: green;"></div>
<div>
<div style="clear: right; height: 80px; margin-top: 16px; background: green;"></div>
</div>
</div>
</div>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test: There should be no gap between border-collapsed backgrounds</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<link rel="help" href="http://www.w3.org/TR/css3-background">
<link rel="match" href="reference/background-border-collapsed-gradient-ref.html">
<style>
div {
background: linear-gradient(to bottom,#222,#666);
float: left;
padding: 32px;
color: white;
border-collapse: collapse;
}
</style>
</head>
<body>
<div style="height:18px;width:11.5625px;"></div>
<div style="height:18px;width:11.4375px;"></div>
</body>
</html>

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test: A background image on table cells with collapsed borders should fill the table</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<link rel="help" href="http://www.w3.org/TR/css3-background">
<link rel="match" href="reference/background-image-table-cells-zoomed-ref.html">
<style>
body {
zoom: 121%;
}
.test-table {
display: table;
width: 600px;
border-collapse: collapse;
border-spacing: 0;
background-color: red;
}
.test-row {
padding: 0px;
border: 0px;
display: table-row;
}
.test-cell {
display: table-cell;
padding: 0px;
height: 50px;
border: 0px;
background: url("support/50x50-green.png");
background-size: 100% 100%;
}
</style>
</head>
<body>
<div class="test-table">
<div class="test-row">
<div class="test-cell"></div>
<div class="test-cell"></div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test Reference</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<style>
div {
background: linear-gradient(to bottom,#222,#666);
float: left;
padding: 32px 64px;
color: white;
border-collapse: collapse;
}
</style>
</head>
<body>
<div style="height:18px;width:23px;"></div>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Background Test Reference</title>
<link rel="author" title="schenney" href="mailto:schenney@chromium.org">
<style>
body {
zoom: 121%;
}
.test-table {
display: table;
width: 600px;
border-collapse: collapse;
border-spacing: 0;
background-color: green;
}
.test-row {
display: table-row;
padding: 0px;
}
.test-cell {
display: table-cell;
padding: 0px;
height: 50px;
border: 0;
}
</style>
</head>
<body>
<div class="test-table">
<div class="test-row">
<div class="test-cell"></div>
<div class="test-cell"></div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<title>Percentage height in flexbox: css-sizing-3</title>
<link rel="author" title="mailto:atotic@google.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#percentage-sizing">
<link rel="help" href="https://crbug.com/907911">
<meta name="assert" content="Percentage height resolves correctly inside flexbox.">
<style>
#outer {
width: 100px;
height: 100px;
background: red;
}
#container {
display: inline-flex;
height: 50px;
background: green;
}
#target {
height:100%;
display:block;
}
</style>
<div id="outer">
<div id="container">
<img id="target" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
</div>
</div>
<script>
test(() => {
let target = document.querySelector("#target");
assert_equals(target.offsetWidth, target.offsetHeight);
assert_equals(target.offsetWidth, target.parentNode.offsetWidth);
assert_equals(target.offsetHeight, target.parentNode.offsetHeight);
}, '#target offsetSize matches #container offsetSize' );
test(() => {
document.querySelector("#container").style.height = "100px";
let target = document.querySelector("#target");
assert_equals(target.offsetWidth, target.offsetHeight);
assert_equals(target.offsetWidth, target.parentNode.offsetWidth);
assert_equals(target.offsetHeight, target.parentNode.offsetHeight);
}, '#target offsetSize matches #container offsetSize after resize' );
</script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing hanging-punctuation with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-hanging-punctuation">
<meta name="assert" content="hanging-punctuation supports only the grammar 'none | [ first || [ force-end | allow-end ] || last ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("hanging-punctuation", "none first");
test_invalid_value("hanging-punctuation", "last none");
test_invalid_value("hanging-punctuation", "first first");
test_invalid_value("hanging-punctuation", "force-end allow-end");
test_invalid_value("hanging-punctuation", "allow-end last force-end");
test_invalid_value("hanging-punctuation", "first allow-end last allow-end");
test_invalid_value("hanging-punctuation", "last force-end last");
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing hanging-punctuation with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-hanging-punctuation">
<meta name="assert" content="hanging-punctuation supports the full grammar 'none | [ first || [ force-end | allow-end ] || last ]'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("hanging-punctuation", "none");
test_valid_value("hanging-punctuation", "first");
test_valid_value("hanging-punctuation", "force-end");
test_valid_value("hanging-punctuation", "allow-end");
test_valid_value("hanging-punctuation", "last");
test_valid_value("hanging-punctuation", "first force-end");
test_valid_value("hanging-punctuation", "first last");
test_valid_value("hanging-punctuation", "allow-end first");
test_valid_value("hanging-punctuation", "force-end last");
test_valid_value("hanging-punctuation", "last first");
test_valid_value("hanging-punctuation", "last allow-end");
test_valid_value("hanging-punctuation", "first allow-end last");
test_valid_value("hanging-punctuation", "first last force-end");
test_valid_value("hanging-punctuation", "force-end first last");
test_valid_value("hanging-punctuation", "allow-end last first");
test_valid_value("hanging-punctuation", "last first force-end");
test_valid_value("hanging-punctuation", "last allow-end first");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing hyphens with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-hyphens">
<meta name="assert" content="hyphens supports only the grammar 'none | manual | auto'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("hyphens", "normal");
test_invalid_value("hyphens", "none manual");
test_invalid_value("hyphens", "auto auto");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing hyphens with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-hyphens">
<meta name="assert" content="hyphens supports the full grammar 'none | manual | auto'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("hyphens", "none");
test_valid_value("hyphens", "manual");
test_valid_value("hyphens", "auto");
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing letter-spacing with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-letter-spacing">
<meta name="assert" content="letter-spacing supports only the grammar 'normal | <length>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("letter-spacing", "auto");
test_invalid_value("letter-spacing", "20");
test_invalid_value("letter-spacing", "30%");
test_invalid_value("letter-spacing", "calc(40% + 50px)");
test_invalid_value("letter-spacing", "normal 10px");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing letter-spacing with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-letter-spacing">
<meta name="assert" content="letter-spacing supports the full grammar 'normal | <length>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("letter-spacing", "normal");
test_valid_value("letter-spacing", "0", "0px");
test_valid_value("letter-spacing", "-10px");
test_valid_value("letter-spacing", "calc(2em + 3ex)");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing line-break with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-line-break">
<meta name="assert" content="line-break supports only the grammar 'auto | loose | normal | strict | anywhere'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("line-break", "none");
test_invalid_value("line-break", "auto loose");
test_invalid_value("line-break", "strict normal");
test_invalid_value("line-break", "anywhere anywhere");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing line-break with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-line-break">
<meta name="assert" content="line-break supports the full grammar 'auto | loose | normal | strict | anywhere'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("line-break", "auto");
test_valid_value("line-break", "loose");
test_valid_value("line-break", "normal");
test_valid_value("line-break", "strict");
test_valid_value("line-break", "anywhere");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing overflow-wrap with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-overflow-wrap">
<meta name="assert" content="overflow-wrap supports only the grammar 'normal | break-word | anywhere'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("overflow-wrap", "auto");
test_invalid_value("overflow-wrap", "normal break-word");
test_invalid_value("overflow-wrap", "anywhere anywhere");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing overflow-wrap with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-overflow-wrap">
<meta name="assert" content="overflow-wrap supports the full grammar 'normal | break-word | anywhere'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("overflow-wrap", "normal");
test_valid_value("overflow-wrap", "break-word");
test_valid_value("overflow-wrap", "anywhere");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing tab-size with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-tab-size">
<meta name="assert" content="tab-size supports only the grammar '<number> | <length>'.">
<meta name="assert" content="Negative tab-size values are not allowed.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("tab-size", "-10px");
test_invalid_value("tab-size", "-20");
test_invalid_value("tab-size", "30%");
test_invalid_value("tab-size", "calc(40% + 50px)");
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing tab-size with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-tab-size">
<meta name="assert" content="tab-size supports the full grammar '<number> | <length>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("tab-size", "0");
test_valid_value("tab-size", "2.5");
test_valid_value("tab-size", "0px");
test_valid_value("tab-size", "10px");
test_valid_value("tab-size", "calc(2em + 3ex)");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-align-all with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-align-all">
<meta name="assert" content="text-align-all supports only the grammar 'start | end | left | right | center | justify | match-parent'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-align-all", "auto");
test_invalid_value("text-align-all", "start end");
test_invalid_value("text-align-all", "left right");
test_invalid_value("text-align-all", "center justify");
test_invalid_value("text-align-all", "match-parent match-parent");
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-align-all with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-align-all">
<meta name="assert" content="text-align-all supports the full grammar 'start | end | left | right | center | justify | match-parent'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-align-all", "start");
test_valid_value("text-align-all", "end");
test_valid_value("text-align-all", "left");
test_valid_value("text-align-all", "right");
test_valid_value("text-align-all", "center");
test_valid_value("text-align-all", "justify");
test_valid_value("text-align-all", "match-parent");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-align with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-align">
<meta name="assert" content="text-align supports only the grammar 'start | end | left | right | center | justify | match-parent | justify-all'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-align", "auto");
test_invalid_value("text-align", "start end");
test_invalid_value("text-align", "left right");
test_invalid_value("text-align", "center justify");
test_invalid_value("text-align", "justify-all match-parent");
</script>
</body>
</html>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-align-last with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-align-last">
<meta name="assert" content="text-align-last supports only the grammar 'auto | start | end | left | right | center | justify | match-parent'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-align-last", "none");
test_invalid_value("text-align-last", "auto start");
test_invalid_value("text-align-last", "end left");
test_invalid_value("text-align-last", "right center");
test_invalid_value("text-align-last", "justify match-parent");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-align-last with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-align-last">
<meta name="assert" content="text-align-last supports the full grammar 'auto | start | end | left | right | center | justify | match-parent'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-align-last", "auto");
test_valid_value("text-align-last", "start");
test_valid_value("text-align-last", "end");
test_valid_value("text-align-last", "left");
test_valid_value("text-align-last", "right");
test_valid_value("text-align-last", "center");
test_valid_value("text-align-last", "justify");
test_valid_value("text-align-last", "match-parent");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-align with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-align">
<meta name="assert" content="text-align supports the full grammar 'start | end | left | right | center | justify | match-parent | justify-all'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-align", "start");
test_valid_value("text-align", "end");
test_valid_value("text-align", "left");
test_valid_value("text-align", "right");
test_valid_value("text-align", "center");
test_valid_value("text-align", "justify");
test_valid_value("text-align", "match-parent");
test_valid_value("text-align", "justify-all");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-indent with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-indent">
<meta name="assert" content="text-indent supports only the grammar '[ <length-percentage> ] && hanging? && each-line?'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-indent", "auto");
test_invalid_value("text-indent", "hanging");
test_invalid_value("text-indent", "each-line");
test_invalid_value("text-indent", "10");
test_invalid_value("text-indent", "10px hanging 20px");
test_invalid_value("text-indent", "hanging 20% hanging");
test_invalid_value("text-indent", "each-line each-line");
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-indent with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-indent">
<meta name="assert" content="text-indent supports the full grammar '[ <length-percentage> ] && hanging? && each-line?'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-indent", "10px");
test_valid_value("text-indent", "20%");
test_valid_value("text-indent", "calc(2em + 3ex)");
test_valid_value("text-indent", "calc(50% + 60px)");
test_valid_value("text-indent", "-30px");
test_valid_value("text-indent", "-40%");
test_valid_value("text-indent", "10px hanging");
test_valid_value("text-indent", "20% each-line");
test_valid_value("text-indent", "calc(2em + 3ex) hanging each-line");
test_valid_value("text-indent", "hanging calc(50% + 60px)", "calc(50% + 60px) hanging");
test_valid_value("text-indent", "each-line 10px", "10px each-line");
test_valid_value("text-indent", "hanging 20% each-line", "20% hanging each-line");
test_valid_value("text-indent", "each-line hanging calc(2em + 3ex)", "calc(2em + 3ex) hanging each-line");
test_valid_value("text-indent", "calc(50% + 60px) each-line hanging", "calc(50% + 60px) hanging each-line");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-justify with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-justify">
<meta name="assert" content="text-justify supports only the grammar 'auto | none | inter-word | inter-character'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-justify", "normal");
test_invalid_value("text-justify", "auto none");
test_invalid_value("text-justify", "inter-character inter-word");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-justify with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-justify">
<meta name="assert" content="text-justify supports the full grammar 'auto | none | inter-word | inter-character'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-justify", "auto");
test_valid_value("text-justify", "none");
test_valid_value("text-justify", "inter-word");
test_valid_value("text-justify", "inter-character");
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-transform with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-transform">
<meta name="assert" content="text-transform supports only the grammar 'none | [capitalize | uppercase | lowercase ] || full-width || full-size-kana'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("text-transform", "none full-width");
test_invalid_value("text-transform", "capitalize none");
test_invalid_value("text-transform", "capitalize full-width lowercase");
test_invalid_value("text-transform", "uppercase full-size-kana uppercase");
test_invalid_value("text-transform", "full-width full-size-kana full-width");
test_invalid_value("text-transform", "full-size-kana capitalize full-size-kana");
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing text-transform with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-transform">
<meta name="assert" content="text-transform supports the full grammar 'none | [capitalize | uppercase | lowercase ] || full-width || full-size-kana'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("text-transform", "none");
test_valid_value("text-transform", "capitalize");
test_valid_value("text-transform", "uppercase");
test_valid_value("text-transform", "lowercase");
test_valid_value("text-transform", "full-width");
test_valid_value("text-transform", "full-size-kana");
test_valid_value("text-transform", "capitalize full-width");
test_valid_value("text-transform", "uppercase full-size-kana");
test_valid_value("text-transform", "full-width full-size-kana");
test_valid_value("text-transform", "full-width lowercase");
test_valid_value("text-transform", "full-size-kana capitalize");
test_valid_value("text-transform", "full-size-kana full-width");
test_valid_value("text-transform", "capitalize full-width full-size-kana");
test_valid_value("text-transform", "full-width full-size-kana uppercase");
test_valid_value("text-transform", "full-size-kana lowercase full-width");
test_valid_value("text-transform", "lowercase full-size-kana full-width");
test_valid_value("text-transform", "full-width uppercase full-size-kana");
test_valid_value("text-transform", "full-size-kana full-width capitalize");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing white-space with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-white-space">
<meta name="assert" content="white-space supports only the grammar 'normal | pre | nowrap | pre-wrap | break-spaces | pre-line'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("white-space", "auto");
test_invalid_value("white-space", "normal pre");
test_invalid_value("white-space", "nowrap pre-wrap");
test_invalid_value("white-space", "pre-line break-spaces");
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing white-space with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-white-space">
<meta name="assert" content="white-space supports the full grammar 'normal | pre | nowrap | pre-wrap | break-spaces | pre-line'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("white-space", "normal");
test_valid_value("white-space", "pre");
test_valid_value("white-space", "nowrap");
test_valid_value("white-space", "pre-wrap");
test_valid_value("white-space", "break-spaces");
test_valid_value("white-space", "pre-line");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing word-break with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-word-break">
<meta name="assert" content="word-break supports only the grammar 'normal | keep-all | break-all'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("word-break", "auto");
test_invalid_value("word-break", "normal keep-all");
test_invalid_value("word-break", "break-all break-all");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing word-break with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-word-break">
<meta name="assert" content="word-break supports the full grammar 'normal | keep-all | break-all'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("word-break", "normal");
test_valid_value("word-break", "keep-all");
test_valid_value("word-break", "break-all");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing word-spacing with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-word-spacing">
<meta name="assert" content="word-spacing supports only the grammar 'normal | <length>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("word-spacing", "auto");
test_invalid_value("word-spacing", "20%");
test_invalid_value("word-spacing", "normal 10px");
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing word-spacing with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-word-spacing">
<meta name="assert" content="word-spacing supports the full grammar 'normal | <length>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("word-spacing", "normal");
test_valid_value("word-spacing", "10px");
test_valid_value("word-spacing", "-20px");
test_valid_value("word-spacing", "calc(2em + 3ex)");
test_valid_value("word-spacing", "0", "0px");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing word-wrap with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-word-wrap">
<meta name="assert" content="word-wrap supports only the grammar 'normal | break-word | anywhere'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("word-wrap", "auto");
test_invalid_value("word-wrap", "normal break-word");
test_invalid_value("word-wrap", "anywhere anywhere");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Text Module Test: parsing word-wrap with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-word-wrap">
<meta name="assert" content="word-wrap supports the full grammar 'normal | break-word | anywhere'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("word-wrap", "normal");
test_valid_value("word-wrap", "break-word");
test_valid_value("word-wrap", "anywhere");
</script>
</body>
</html>

View file

@ -0,0 +1,233 @@
<!doctype html>
<title>CSS Basic User Interface Test: appearance CSSOM</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
<meta name="assert" content="CSSOM for the appearance/-webkit-appearance property is correct.">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<button id=button>Test</button>
<script>
const button = document.getElementById('button');
const values = ["none",
"auto",
"button",
"button-bevel",
"caret",
"checkbox",
"listbox",
"listitem",
"menulist",
"menulist-button",
"menulist-text",
"menulist-textfield",
"meter",
"progress-bar",
"push-button",
"radio",
"searchfield",
"slider-horizontal",
"square-button",
"textarea",
"textfield",
];
function assert_style_for_prop(style, prop, value) {
if (prop === '-webkit-appearance') {
assert_equals(style.WebkitAppearance, value, 'style.WebkitAppearance (uppercase W)');
assert_equals(style.webkitAppearance, value, 'style.webkitAppearance (lowercase w)');
} else {
assert_equals(style.appearance, value, 'style.appearance');
}
assert_equals(style.getPropertyValue(prop), value, `getPropertyValue(${prop})`);
}
for (const prop of ["-webkit-appearance", "appearance"]) {
for (const value of values) {
test(() => {
button.removeAttribute('style');
button.style.setProperty(prop, value);
assert_style_for_prop(button.style, prop, value);
const style = getComputedStyle(button);
assert_style_for_prop(style, prop, value);
}, `${prop}: ${value}`);
}
const invalidValues = ["bogus-button",
"attachment",
"borderless-attachment",
"button-arrow-down",
"button-arrow-next",
"button-arrow-previous",
"button-arrow-up",
"button-focus",
"caps-lock-indicator",
"checkbox-container",
"checkbox-label",
"checkmenuitem",
"color-well",
"continuous-capacity-level-indicator",
"default-button",
"discrete-capacity-level-indicator",
"dualbutton",
"groupbox",
"inner-spin-button",
"image-controls-button",
"list-button",
"listitem",
"media-enter-fullscreen-button",
"media-exit-fullscreen-button",
"media-fullscreen-volume-slider",
"media-fullscreen-volume-slider-thumb",
"media-mute-button",
"media-play-button",
"media-overlay-play-button",
"media-return-to-realtime-button",
"media-rewind-button",
"media-seek-back-button",
"media-seek-forward-button",
"media-toggle-closed-captions-button",
"media-slider",
"media-sliderthumb",
"media-volume-slider-container",
"media-volume-slider-mute-button",
"media-volume-slider",
"media-volume-sliderthumb",
"media-controls-background",
"media-controls-dark-bar-background",
"media-controls-fullscreen-background",
"media-controls-light-bar-background",
"media-current-time-display",
"media-time-remaining-display",
"menuarrow",
"menubar",
"menucheckbox",
"menuimage",
"menuitem",
"menuitemtext",
"menupopup",
"menuradio",
"menuseparator",
"meterbar",
"meterchunk",
"number-input",
"progress-bar-value",
"progressbar",
"progressbar-vertical",
"progresschunk",
"progresschunk-vertical",
"radio-container",
"radio-label",
"radiomenuitem",
"range",
"range-thumb",
"rating-level-indicator",
"resizer",
"resizerpanel",
"scale-horizontal",
"scalethumbend",
"scalethumb-horizontal",
"scalethumbstart",
"scalethumbtick",
"scalethumb-vertical",
"scale-vertical",
"scrollbarbutton-down",
"scrollbarbutton-left",
"scrollbarbutton-right",
"scrollbarbutton-up",
"scrollbarthumb-horizontal",
"scrollbarthumb-vertical",
"scrollbartrack-horizontal",
"scrollbartrack-vertical",
"searchfield-decoration",
"searchfield-results-decoration",
"searchfield-results-button",
"searchfield-cancel-button",
"snapshotted-plugin-overlay",
"separator",
"sheet",
"slider-vertical",
"sliderthumb-horizontal",
"sliderthumb-vertical",
"spinner",
"spinner-downbutton",
"spinner-textfield",
"spinner-upbutton",
"splitter",
"statusbar",
"statusbarpanel",
"tab",
"tabpanel",
"tabpanels",
"tab-scroll-arrow-back",
"tab-scroll-arrow-forward ",
"textfield-multiline",
"toolbar",
"toolbarbutton",
"toolbarbutton-dropdown",
"toolbargripper",
"toolbox",
"tooltip",
"treeheader",
"treeheadercell",
"treeheadersortarrow",
"treeitem",
"treeline",
"treetwisty",
"treetwistyopen",
"treeview",
"relevancy-level-indicator",
"-moz-win-borderless-glass",
"-moz-win-browsertabbar-toolbox",
"-moz-win-communicationstext",
"-moz-win-communications-toolbox",
"-moz-win-exclude-glass",
"-moz-win-glass",
"-moz-win-media-toolbox",
"-moz-window-button-box",
"-moz-window-button-box-maximized",
"-moz-window-button-close",
"-moz-window-button-maximize",
"-moz-window-button-minimize",
"-moz-window-button-restore",
"-moz-window-frame-bottom",
"-moz-window-frame-left",
"-moz-window-frame-right",
"-moz-window-titlebar",
"-moz-window-titlebar-maximized",
"-apple-pay-button",
];
for (const invalidValue of invalidValues) {
test(() => {
button.removeAttribute('style');
button.style.setProperty(prop, invalidValue);
assert_style_for_prop(button.style, prop, "");
const style = getComputedStyle(button);
assert_style_for_prop(style, prop, "button");
}, `${prop}: ${invalidValue} (invalid)`);
}
}
for (const prefix of ["-ms-",
"mso-",
"-moz-",
"-o-",
"-xv-",
"-atsc-",
"-wap-",
"-khtml-",
"-konq-",
"-apple-",
"prince-",
"-ah-",
"-hp-",
"-ro-",
"-rim-",
"-tc-",
]) {
const prop = `${prefix}appearance`;
test(() => {
button.removeAttribute('style');
button.style.setProperty(prop, 'none');
assert_equals(button.style.getPropertyValue(prop), '');
const style = getComputedStyle(button);
assert_equals(style.getPropertyValue(prop), '');
}, `${prop} (should not be supported)`);
}
</script>

View file

@ -8,6 +8,13 @@
<script>
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard, applePay]);

View file

@ -6,8 +6,18 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard]);
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",

View file

@ -9,8 +9,18 @@
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({ supportedMethods: "basic-card" });
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
const validTotal = Object.freeze({
label: "label",

View file

@ -8,9 +8,18 @@
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({ supportedMethods: "basic-card" });
const validMethods = [validMethod];
const validMethods = [validMethod, applePay];
const validAmount = Object.freeze({
currency: "USD",
value: "5.00",

View file

@ -14,6 +14,15 @@ setup({
const methods = [{
supportedMethods: "basic-card",
}, {
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
}];
const options = {

View file

@ -18,8 +18,19 @@ const validMethodBasicCard = Object.freeze({
supportedMethods: "basic-card",
});
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
// Methods
const validMethods = Object.freeze([validMethodBasicCard, validMethod]);
const validMethods = Object.freeze([validMethodBasicCard, validMethod, applePay]);
// Amounts
const validAmount = Object.freeze({

View file

@ -6,8 +6,18 @@
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({ supportedMethods: "basic-card" });
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
const validTotal = Object.freeze({
label: "label",

View file

@ -6,8 +6,18 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard]);
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",

View file

@ -15,6 +15,16 @@ const methods = [
{
supportedMethods: "basic-card",
},
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
},
}
];
const shippingOptions = {
shippingOptions: [

View file

@ -10,7 +10,16 @@
const methods = [
{ supportedMethods: "basic-card" },
{ supportedMethods: "https://apple.com/apple-pay" },
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
},
},
];
const details = {

View file

@ -9,7 +9,17 @@
<script>
setup({ explicit_done: true, explicit_timeout: true });
const validMethod = Object.freeze({ supportedMethods: "basic-card" });
const validMethods = Object.freeze([validMethod]);
const applePayMethod = {
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
},
};
const validMethods = Object.freeze([validMethod, applePayMethod]);
const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
const validTotal = Object.freeze({
label: "label",

View file

@ -8,7 +8,16 @@
setup({ explicit_done: true, explicit_timeout: true });
const validMethods = Object.freeze([
{ supportedMethods: "basic-card" },
{ supportedMethods: "https://apple.com/apple-pay" },
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
},
},
]);
const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
const validTotal = Object.freeze({

View file

@ -7,7 +7,16 @@
<script>
"use strict";
const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" });
const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
},
});
const defaultMethods = Object.freeze([testMethod, applePay]);
const defaultDetails = Object.freeze({
total: {

View file

@ -7,7 +7,16 @@
<script>
"use strict";
const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" });
const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const defaultMethods = Object.freeze([testMethod, applePay]);
const defaultDetails = Object.freeze({
total: {

View file

@ -17,6 +17,13 @@ setup({
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({

View file

@ -8,7 +8,16 @@
<script src="/resources/testdriver.js"></script>
<script>
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {

View file

@ -10,6 +10,13 @@
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({

View file

@ -28,6 +28,17 @@
"use strict";
const ABUSIVE_AMOUNT = 100000;
const applePay = {
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
};
const basicCard = Object.freeze({
supportedMethods: "basic-card",
});
@ -42,7 +53,7 @@ const evilAmount = Object.freeze({
value: "1".repeat(ABUSIVE_AMOUNT),
});
const defaultMethods = Object.freeze([basicCard]);
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultTotal = Object.freeze({
label: "label",

View file

@ -7,8 +7,18 @@
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard]);
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",

View file

@ -7,8 +7,18 @@
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard]);
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "Total",

View file

@ -8,8 +8,18 @@
<script>
"use strict";
const paymentShipingTypes = Object.freeze(["delivery", "pickup", "shipping"]);
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const defaultMethods = Object.freeze([basicCard]);
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
label: "",

View file

@ -10,7 +10,16 @@
"use strict";
const defaultMethods = Object.freeze([
{ supportedMethods: "basic-card" },
{ supportedMethods: "https://apple.com/apple-pay" },
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
},
]);
const defaultDetails = Object.freeze({

View file

@ -1,10 +1,21 @@
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({
supportedMethods: "basic-card",
});
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({
currency: "USD",

View file

@ -11,7 +11,17 @@ setup({ explicit_done: true, explicit_timeout: true });
const validMethod = Object.freeze({
supportedMethods: "basic-card",
});
const validMethods = Object.freeze([validMethod]);
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({
currency: "USD",
value: "5.00",

View file

@ -9,10 +9,20 @@
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentrequest-show()">
<body>
<script>
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({
supportedMethods: "basic-card",
});
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({
currency: "USD",
value: "5.00",

View file

@ -8,8 +8,18 @@
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({ supportedMethods: "basic-card" });
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
const validTotal = Object.freeze({
label: "label",

View file

@ -24,6 +24,13 @@
const validMethodApplePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
// Methods

View file

@ -23,6 +23,13 @@ const validMethods = Object.freeze([
},
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
},
]);

View file

@ -3,7 +3,16 @@
"use strict";
const defaultMethods = Object.freeze([
{ supportedMethods: "basic-card" },
{ supportedMethods: "https://apple.com/apple-pay" },
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
},
]);
const defaultDetails = Object.freeze({

View file

@ -14,7 +14,16 @@ setup({
const defaultMethods = Object.freeze([
{ supportedMethods: "basic-card" },
{ supportedMethods: "https://apple.com/apple-pay" },
{
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
},
]);
const defaultDetails = Object.freeze({

View file

@ -8,11 +8,21 @@
<script>
"use strict";
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({
supportedMethods: "https://:@wpt.fyi:443/payment-request",
});
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validAmount = Object.freeze({
currency: "USD",

View file

@ -17,10 +17,20 @@ const validTotal = Object.freeze({
label: "Total due",
amount: validAmount,
});
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const validMethod = Object.freeze({
supportedMethods: "basic-card",
});
const validMethods = Object.freeze([validMethod]);
const validMethods = Object.freeze([validMethod, applePay]);
const validDetails = Object.freeze({
total: validTotal,
});

View file

@ -8,13 +8,23 @@
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true, explicit_timeout: true });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
data: {
version: 3,
merchantIdentifier: "merchant.com.example",
countryCode: "US",
merchantCapabilities: ["supports3DS"],
supportedNetworks: ["visa"],
}
});
const basicCardMethod = Object.freeze({
supportedMethods: "basic-card",
});
const validMethod = Object.freeze({
supportedMethods: "this-is-just-for-testings-will-never-match",
});
const methods = Object.freeze([basicCardMethod, validMethod]);
const methods = Object.freeze([basicCardMethod, validMethod, applePay]);
const validAmount = Object.freeze({
currency: "USD",
value: "5.00",

View file

@ -3,10 +3,12 @@ sxg_version=1b3
certfile=127.0.0.1.sxg.pem
keyfile=127.0.0.1.sxg.key
inner_url_origin=https://127.0.0.1:8444
# TODO: Stop hard-coding "web-platform.test" in certUrl when generating
# Signed Exchanges on the fly.
cert_url_origin=https://web-platform.test:8444
sxg_content_type='content-type: application/signed-exchange;v=b2'
# TODO: Stop hard-coding "web-platform.test" when generating Signed Exchanges on
# the fly.
wpt_test_origin=https://web-platform.test:8444
wpt_test_remote_origin=https://www1.web-platform.test:8444
cert_url_origin=$wpt_test_origin
sxg_content_type='content-type: application/signed-exchange;v=b3'
set -e
@ -38,6 +40,89 @@ gen-signedexchange \
-o sxg/sxg-location.sxg \
-miRecordSize 100
# A signed exchange of unsupported version.
gen-signedexchange \
-version 1b2 \
-uri $inner_url_origin/signed-exchange/resources/inner-url.html \
-status 200 \
-content sxg-location.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $inner_url_origin/signed-exchange/resources/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg-version1b2.sxg \
-miRecordSize 100
# A valid Signed Exchange for testing referrer which logical origin is the wpt
# test origin.
gen-signedexchange \
-version $sxg_version \
-uri $wpt_test_origin/signed-exchange/resources/inner-url.html \
-status 200 \
-content sxg-location.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $wpt_test_origin/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-referrer-same-origin.sxg \
-miRecordSize 100
# A valid Signed Exchange for testing referrer which logical origin is the wpt
# test remote origin.
gen-signedexchange \
-version $sxg_version \
-uri $wpt_test_remote_origin/signed-exchange/resources/inner-url.html \
-status 200 \
-content sxg-location.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $wpt_test_remote_origin/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-referrer-remote-origin.sxg \
-miRecordSize 100
# A invalid Signed Exchange for testing referrer which logical origin is the wpt
# test origin. Response has Cache-Control: no-store header.
gen-signedexchange \
-version $sxg_version \
-uri $wpt_test_origin/signed-exchange/resources/inner-url.html \
-status 200 \
-responseHeader "Cache-Control: no-store" \
-content sxg-location.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $wpt_test_origin/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/invalid-sxg-referrer-same-origin.sxg \
-miRecordSize 100 \
-ignoreErrors true
# A invalid Signed Exchange for testing referrer which logical origin is the wpt
# test remote origin. Response has Cache-Control: no-store header.
gen-signedexchange \
-version $sxg_version \
-uri $wpt_test_remote_origin/signed-exchange/resources/inner-url.html \
-status 200 \
-responseHeader "Cache-Control: no-store" \
-content sxg-location.html \
-certificate $certfile \
-certUrl $cert_url_origin/signed-exchange/resources/$certfile.cbor \
-validityUrl $wpt_test_remote_origin/resource.validity.msg \
-privateKey $keyfile \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/invalid-sxg-referrer-remote-origin.sxg \
-miRecordSize 100 \
-ignoreErrors true
# For check-cert-request.tentative.html
gen-signedexchange \
-version $sxg_version \
@ -66,7 +151,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-invalid-validity-url.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# certUrl is 404 and fallback URL is another signed exchange.
gen-signedexchange \
@ -81,7 +167,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/fallback-to-another-sxg.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# Nested signed exchange.
gen-signedexchange \
@ -97,7 +184,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/nested-sxg.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# Fallback URL has non-ASCII UTF-8 characters.
gen-signedexchange \
@ -113,7 +201,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-utf8-inner-url.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# Fallback URL has invalid UTF-8 sequence.
gen-signedexchange \
@ -129,7 +218,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-invalid-utf8-inner-url.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# Fallback URL has UTF-8 BOM.
gen-signedexchange \
@ -145,7 +235,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-inner-url-bom.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# Response has Cache-Control: no-store header.
gen-signedexchange \
@ -161,7 +252,8 @@ gen-signedexchange \
-date 2018-04-01T00:00:00Z \
-expire 168h \
-o sxg/sxg-noncacheable.sxg \
-miRecordSize 100
-miRecordSize 100 \
-ignoreErrors true
# Response has a strict-transport-security header.
gen-signedexchange \

View file

@ -2,6 +2,9 @@
<title>Content of fallback URL</title>
<script>
window.addEventListener('message', (event) => {
event.data.port.postMessage({location: document.location.href, is_fallback: true});
event.data.port.postMessage({
location: document.location.href,
referrer: document.referrer,
is_fallback: true});
}, false);
</script>

View file

@ -2,6 +2,9 @@
<title>Content of SignedHTTPExchange</title>
<script>
window.addEventListener('message', (event) => {
event.data.port.postMessage({location: document.location.href, is_fallback: false});
event.data.port.postMessage({
location: document.location.href,
referrer: document.referrer,
is_fallback: false});
}, false);
</script>

View file

@ -1,12 +1,12 @@
// Opens |url| in an iframe, establish a message channel with it, and waits for
// a message from the frame content. Returns a promise that resolves with the
// data of the message, or rejects on 2000ms timeout.
function openSXGInIframeAndWaitForMessage(test_object, url) {
function openSXGInIframeAndWaitForMessage(test_object, url, referrerPolicy) {
return new Promise(async (resolve, reject) => {
// We can't catch the network error on iframe. So we use the timer.
test_object.step_timeout(() => reject('timeout'), 2000);
const frame = await withIframe(url, 'sxg_iframe');
const frame = await withIframe(url, 'sxg_iframe', referrerPolicy);
const channel = new MessageChannel();
channel.port1.onmessage = (event) => resolve(event.data);
frame.contentWindow.postMessage(
@ -14,11 +14,14 @@ function openSXGInIframeAndWaitForMessage(test_object, url) {
});
}
function withIframe(url, name) {
function withIframe(url, name, referrerPolicy) {
return new Promise((resolve, reject) => {
const frame = document.createElement('iframe');
frame.src = url;
frame.name = name;
if (referrerPolicy !== undefined) {
frame.referrerPolicy = referrerPolicy;
}
frame.onload = () => resolve(frame);
frame.onerror = () => reject('failed to load ' + url);
document.body.appendChild(frame);

View file

@ -0,0 +1,2 @@
Content-Type: application/signed-exchange;v=b2
X-Content-Type-Options: nosniff

View file

@ -0,0 +1,284 @@
<!DOCTYPE html>
<title>Referrer of SignedHTTPExchange</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="./resources/sxg-util.js"></script>
<body>
<script>
(() => {
const SAME_ORIGIN = get_host_info().HTTPS_ORIGIN;
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
const SAME_ORIGIN_SXG = 'sxg-referrer-same-origin.sxg';
const REMOTE_ORIGIN_SXG = 'sxg-referrer-remote-origin.sxg';
const TEST_CASES = [
// Physical origin = same origin. Logical origin = same origin.
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
// Physical origin = same origin. Logical origin = remote origin.
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
// Physical origin = remote origin. Logical origin = same origin.
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: SAME_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
// Physical origin = remote origin. Logical origin = remote origin.
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'no-referrer-when-downgrade',
expectedReferrer: document.location.href
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'same-origin',
expectedReferrer: ''
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'strict-origin-when-cross-origin',
expectedReferrer: document.location.origin + '/'
},
{
origin: REMOTE_ORIGIN,
sxg: REMOTE_ORIGIN_SXG,
referrerPolicy: 'unsafe-url',
expectedReferrer: document.location.href
},
// Referrer-Policy header in outer SXG response.
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,no-referrer)',
referrerPolicy: undefined,
expectedReferrer: ''
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG +
'?pipe=header(Referrer-Policy,no-referrer-when-downgrade)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,same-origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,strict-origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.origin + '/'
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG +
'?pipe=header(Referrer-Policy,strict-origin-when-cross-origin)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
{
origin: SAME_ORIGIN,
sxg: SAME_ORIGIN_SXG + '?pipe=header(Referrer-Policy,unsafe-url)',
referrerPolicy: undefined,
expectedReferrer: document.location.href
},
];
for (const i in TEST_CASES) {
const test_case = TEST_CASES[i];
promise_test(async (t) => {
const sxgUrl = test_case.origin + '/signed-exchange/resources/sxg/' +
test_case.sxg;
const message =
await openSXGInIframeAndWaitForMessage(
t, sxgUrl, test_case.referrerPolicy);
assert_false(message.is_fallback);
assert_equals(message.referrer, test_case.expectedReferrer);
const invalidSxgUrl =
test_case.origin + '/signed-exchange/resources/sxg/invalid-' +
test_case.sxg;
const fallbackMessage =
await openSXGInIframeAndWaitForMessage(
t, invalidSxgUrl, test_case.referrerPolicy);
assert_true(fallbackMessage.is_fallback);
assert_equals(fallbackMessage.referrer, test_case.expectedReferrer);
}, 'Referrer of SignedHTTPExchange test : ' + JSON.stringify(test_case));
}
})();
</script>
</body>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<title>Loading SignedHTTPExchange of unsupported version must fail</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="./resources/sxg-util.js"></script>
<body>
<p>Note: This test FAILs if your browser supports Signed Exchange version 1b2.</p>
<script>
promise_test(async (t) => {
const sxgUrl = get_host_info().HTTPS_ORIGIN +
'/signed-exchange/resources/sxg-version1b2.sxg';
const message = await openSXGInIframeAndWaitForMessage(t, sxgUrl);
const innerURL = innerURLOrigin() +
'/signed-exchange/resources/inner-url.html';
assert_equals(message.location, innerURL);
assert_true(message.is_fallback);
}, 'Loading SignedHTTPExchange of unsupported version must fail and fallback redirect.');
</script>
</body>

View file

@ -1,110 +0,0 @@
// META: title=Web Locks API: navigator.locks.query ordering
// META: script=resources/helpers.js
// META: global=window,dedicatedworker,sharedworker,serviceworker
'use strict';
// Grab a lock and hold until a release function is called. Resolves
// to a release function.
function getLockAndHoldUntilReleased(name, options) {
let release;
const promise = new Promise(resolve => { release = resolve; });
return new Promise(resolve => {
navigator.locks.request(name, options || {}, lock => {
resolve(release);
return promise;
}).catch(_ => {});
});
}
promise_test(async t => {
const res1 = uniqueName(t);
const res2 = uniqueName(t);
const res3 = uniqueName(t);
// These will never be released.
await Promise.all([
getLockAndHoldUntilReleased(res1),
getLockAndHoldUntilReleased(res2),
getLockAndHoldUntilReleased(res3)
]);
// These requests should be blocked.
navigator.locks.request(res3, {mode: 'shared'}, lock => {});
navigator.locks.request(res2, {mode: 'shared'}, lock => {});
navigator.locks.request(res1, {mode: 'shared'}, lock => {});
const state = await navigator.locks.query();
const relevant_pending_names = state.pending.map(lock => lock.name)
.filter(name => [res1, res2, res3].includes(name));
assert_array_equals(relevant_pending_names, [res3, res2, res1],
'Pending locks should appear in order.');
}, 'Requests appear in state in order made');
promise_test(async t => {
const res1 = uniqueName(t);
const res2 = uniqueName(t);
const res3 = uniqueName(t);
// These should be granted, and will be held until released.
const [release1, release2, release3] = await Promise.all([
getLockAndHoldUntilReleased(res1),
getLockAndHoldUntilReleased(res2),
getLockAndHoldUntilReleased(res3)
]);
// These requests should be blocked.
const requests = [
getLockAndHoldUntilReleased(res1),
getLockAndHoldUntilReleased(res2),
getLockAndHoldUntilReleased(res3)
];
// Ensure the requests have had a chance to get queued by
// waiting for something else to make it through the queue.
await navigator.locks.request(uniqueName(t), lock => {});
// Now release the previous holders.
release2();
release3();
release1();
// Wait until the subsequent requests make it through.
await Promise.all(requests);
const state = await navigator.locks.query();
const relevant_held_names = state.held.map(lock => lock.name)
.filter(name => [res1, res2, res3].includes(name));
assert_array_equals(relevant_held_names, [res2, res3, res1],
'Held locks should appear in granted order.');
}, 'Held locks appear in state in order granted');
promise_test(async t => {
const res1 = uniqueName(t);
const res2 = uniqueName(t);
const res3 = uniqueName(t);
// These should be granted, and will be held until stolen.
await Promise.all([
getLockAndHoldUntilReleased(res1),
getLockAndHoldUntilReleased(res2),
getLockAndHoldUntilReleased(res3)
]);
// Steal in a different order.
await Promise.all([
getLockAndHoldUntilReleased(res3, {steal: true}),
getLockAndHoldUntilReleased(res1, {steal: true}),
getLockAndHoldUntilReleased(res2, {steal: true})
]);
const state = await navigator.locks.query();
const relevant_held_names = state.held.map(lock => lock.name)
.filter(name => [res1, res2, res3].includes(name));
assert_array_equals(relevant_held_names, [res3, res1, res2],
'Held locks should appear in granted order.');
}, 'Held locks appear in state in order granted, including when stolen');

View file

@ -0,0 +1,130 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Web Locks API: navigator.locks.query ordering</title>
<link rel=help href="https://wicg.github.io/web-locks/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>
<style>iframe { display: none; }</style>
<script>
'use strict';
// Grab a lock and hold until a release function is called. Resolves
// to a release function.
function getLockAndHoldUntilReleased(name, options) {
let release;
const promise = new Promise(resolve => { release = resolve; });
return new Promise(resolve => {
navigator.locks.request(name, options || {}, lock => {
resolve(release);
return promise;
}).catch(_ => {});
});
}
// Returns a promise resolved by the next message event.
function nextMessage() {
return new Promise(resolve => {
window.addEventListener('message', event => {
resolve(event.data);
}, {once: true});
});
}
// Tests the ordering constraints on the requested lock state returned by
// navigator.locks.query(). Three separate iframes are instantiated to make
// lock requests on the same resource, first in one order and then in another,
// different order. For each set of requests, it is verified that the requests
// appear in the result of navigator.locks.query() in the same order in which
// they were made.
//
// It is necessary to use separate iframes here so that the lock requests have
// distinguishable client_ids (otherwise it would not be possible to
// distinguish the requests and thus impossible to verify ordering).
promise_test(async testCase => {
const resourceName = uniqueName(testCase);
// Set up clients.
const frame1 = await iframe('resources/iframe.html');
const frame2 = await iframe('resources/iframe.html');
const frame3 = await iframe('resources/iframe.html');
testCase.add_cleanup(() => { frame1.remove(); });
testCase.add_cleanup(() => { frame2.remove(); });
testCase.add_cleanup(() => { frame3.remove(); });
// Collect the client ids.
const clientId1 =
(await postToFrameAndWait(frame1, {op: 'client_id',
name: resourceName})).client_id;
const clientId2 =
(await postToFrameAndWait(frame2, {op: 'client_id',
name: resourceName})).client_id;
const clientId3 =
(await postToFrameAndWait(frame3, {op: 'client_id',
name: resourceName})).client_id;
// Preemptively take the lock.
const firstRequestGroupReleaseFunction =
await getLockAndHoldUntilReleased(resourceName);
// Queue the first group of lock requests from the different clients. These
// will be blocked until firstRequestGroupReleaseFunction() is called.
let lockId1;
let lockId2;
const lockPromise1 =
postToFrameAndWait(frame1, {op: 'request', name: resourceName})
.then(val => {lockId1 = val.lock_id;});
const lockPromise2 =
postToFrameAndWait(frame2, {op: 'request', name: resourceName})
.then(val => {lockId2 = val.lock_id;});
// This third request will later be granted and held in order to block a
// second group of requests to test a different client ordering. It is not
// meant to be released.
postToFrameAndWait(frame3, {op: 'request', name: resourceName});
// Request and wait for the release of a separate lock to ensure all previous
// requests are processed.
const checkpointName = uniqueName(testCase, 'checkpoint');
const checkpointId = (await postToFrameAndWait(
frame3,
{op: 'request', name: checkpointName})).lock_id;
await postToFrameAndWait(frame3, {op: 'release', lock_id: checkpointId});
// Query the state and test the ordering of requested locks.
const state = await navigator.locks.query();
const relevant_pending_ids = state.pending
.filter(lock => [clientId1, clientId2, clientId3].includes(lock.clientId))
.map(lock => lock.clientId);
assert_array_equals(
[clientId1, clientId2, clientId3],
relevant_pending_ids,
'Querying the state should return requested locks in the order they were '
+ 'requested.');
// Add the second group of requests from the clients in a new order.
postToFrameAndWait(frame3, {op: 'request', name: resourceName});
postToFrameAndWait(frame1, {op: 'request', name: resourceName});
postToFrameAndWait(frame2, {op: 'request', name: resourceName});
// Release locks such that only the newly added locks are requested. This
// acts like a checkpoint for the newly queued requests.
firstRequestGroupReleaseFunction();
await lockPromise1;
await postToFrameAndWait(frame1, {op: 'release', lock_id: lockId1});
await lockPromise2;
await postToFrameAndWait(frame2, {op: 'release', lock_id: lockId2});
// Query the state and test the new ordering.
const state2 = await navigator.locks.query();
const relevant_pending_ids2 = state2.pending
.filter(lock => [clientId1, clientId2, clientId3].includes(lock.clientId))
.map(lock => lock.clientId);
assert_array_equals(
[clientId3, clientId1, clientId2],
relevant_pending_ids2,
'Querying the state should return requested locks in the order they were '
+ 'requested.');
}, 'Requests appear in state in order made.');
</script>

View file

@ -5,8 +5,8 @@
// test case name. This is useful to avoid lock interference between
// test cases.
let res_num = 0;
self.uniqueName = testCase => {
return `${self.location.pathname}-${testCase.name}-${++res_num}`;
self.uniqueName = (testCase, prefix) => {
return `${self.location.pathname}-${prefix}-${testCase.name}-${++res_num}`;
};
// Inject an iframe showing the given url into the page, and resolve

View file

@ -38,6 +38,15 @@ self.addEventListener('message', e => {
held.delete(e.data.lock_id);
respond({ack: 'release', lock_id: e.data.lock_id});
break;
case 'client_id':
navigator.locks.request(e.data.name, async lock => {
const lock_state = await navigator.locks.query();
const held_lock =
lock_state.held.filter(l => l.name === lock.name)[0];
respond({ack: 'client_id', client_id: held_lock.clientId});
});
break;
}
});
</script>

Some files were not shown because too many files have changed in this diff Show more