mirror of
https://github.com/servo/servo.git
synced 2025-08-09 15:35:34 +01:00
Update web-platform-tests to revision 36634cbcf3253dfe8d220990a27ad4eeebf8ec2f
This commit is contained in:
parent
0964d055cd
commit
7295abcc2a
245 changed files with 5966 additions and 1901 deletions
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var tests = [
|
||||
// Make sure that csp works properly in normal situations
|
||||
{ "csp": "", "expected": true, "name": "Should load image without any CSP" },
|
||||
{ "csp": "img-src 'none';", "expected": false, "name": "Should not load image with 'none' CSP" },
|
||||
// Ensure ASCII whitespaces are properly parsed
|
||||
// ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.
|
||||
|
||||
// between directive name and value
|
||||
{ "csp": "img-src\u0009'none';", "expected": false, "name": "U+0009 TAB should be properly parsed between directive name and value" },
|
||||
{ "csp": "img-src\u000C'none';", "expected": false, "name": "U+000C FF should be properly parsed between directive name and value" },
|
||||
{ "csp": "img-src\u000A'none';", "expected": false, "name": "U+000A LF should be properly parsed between directive name and value" },
|
||||
{ "csp": "img-src\u000D'none';", "expected": false, "name": "U+000D CR should be properly parsed between directive name and value" },
|
||||
{ "csp": "img-src\u0020'none';", "expected": false, "name": "U+0020 SPACE should be properly parsed between directive name and value" },
|
||||
|
||||
// inside directive value
|
||||
{ "csp": "img-src http://example.com\u0009http://example2.com;", "expected": false, "name": "U+0009 TAB should be properly parsed inside directive value" },
|
||||
{ "csp": "img-src http://example.com\u000Chttp://example2.com;", "expected": false, "name": "U+000C FF should be properly parsed inside directive value" },
|
||||
{ "csp": "img-src http://example.com\u000Ahttp://example2.com;", "expected": false, "name": "U+000A LF should be properly parsed inside directive value" },
|
||||
{ "csp": "img-src http://example.com\u000Dhttp://example2.com;", "expected": false, "name": "U+000D CR should be properly parsed inside directive value" },
|
||||
{ "csp": "img-src http://example.com\u0020http://example2.com;", "expected": false, "name": "U+0020 SPACE should be properly parsed inside directive value" },
|
||||
|
||||
// Ensure nbsp (U+00A0) is not considered a valid whitespace
|
||||
// https://github.com/webcompat/web-bugs/issues/18902 has more details about why this particularly relevant
|
||||
{ "csp": "img-src\u00A0'none';", "expected": true, "name": "U+00A0 NBSP should not be parsed between directive name and value" },
|
||||
{ "csp": "img-src http://example.com\u00A0http://example2.com;", "expected": true, "name": "U+00A0 NBSP should not be parsed inside directive value" },
|
||||
];
|
||||
|
||||
tests.forEach(test => {
|
||||
async_test(t => {
|
||||
var url = "support/load_img_and_post_result_meta.sub.html?csp=" + encodeURIComponent(test.csp);
|
||||
test_image_loads_as_expected(test, t, url);
|
||||
}, test.name + " - meta tag");
|
||||
|
||||
// We can't test csp delivered in an HTTP header if we're testing CR/LF characters
|
||||
if (test.csp.indexOf("\u000A") == -1 && test.csp.indexOf("\u000D") == -1) {
|
||||
async_test(t => {
|
||||
var url = "support/load_img_and_post_result_meta.sub.html?csp=" + encodeURIComponent(test.csp);
|
||||
test_image_loads_as_expected(test, t, url);
|
||||
}, test.name + " - HTTP header");
|
||||
}
|
||||
});
|
||||
|
||||
function test_image_loads_as_expected(test, t, url) {
|
||||
var i = document.createElement('iframe');
|
||||
i.src = url;
|
||||
window.addEventListener('message', t.step_func(function(e) {
|
||||
if (e.source != i.contentWindow) return;
|
||||
if (test.expected) {
|
||||
assert_equals(e.data, "img loaded");
|
||||
} else {
|
||||
assert_equals(e.data, "img not loaded");
|
||||
}
|
||||
t.done();
|
||||
}));
|
||||
document.body.appendChild(i);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<html>
|
||||
<body>
|
||||
<script>
|
||||
var img = document.createElement("img");
|
||||
img.src = "/content-security-policy/support/pass.png";
|
||||
img.onload = function() { parent.postMessage('img loaded', '*'); }
|
||||
img.onerror = function() { parent.postMessage('img not loaded', '*'); }
|
||||
document.body.appendChild(img);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
Content-Security-Policy: {{GET[csp]}}
|
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Security-Policy" content="{{GET[csp]}}">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var img = document.createElement("img");
|
||||
img.src = "/content-security-policy/support/pass.png";
|
||||
img.onload = function() { parent.postMessage('img loaded', '*'); }
|
||||
img.onerror = function() { parent.postMessage('img not loaded', '*'); }
|
||||
document.body.appendChild(img);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -78,11 +78,139 @@
|
|||
assert_equals(event.animationName, "sample");
|
||||
}, "animationName set to 'sample'");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: undefined});
|
||||
assert_equals(event.animationName, "");
|
||||
}, "animationName set to undefined");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: null});
|
||||
assert_equals(event.animationName, "null");
|
||||
}, "animationName set to null");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: false});
|
||||
assert_equals(event.animationName, "false");
|
||||
}, "animationName set to false");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: true});
|
||||
assert_equals(event.animationName, "true");
|
||||
}, "animationName set to true");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: 0.5});
|
||||
assert_equals(event.animationName, "0.5");
|
||||
}, "animationName set to a number");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: []});
|
||||
assert_equals(event.animationName, "");
|
||||
}, "animationName set to []");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: [1, 2, 3]});
|
||||
assert_equals(event.animationName, "1,2,3");
|
||||
}, "animationName set to [1, 2, 3]");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {animationName: {sample: 0.5}});
|
||||
assert_equals(event.animationName, "[object Object]");
|
||||
}, "animationName set to an object");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test",
|
||||
{animationName: {valueOf: function () { return 'sample'; }}});
|
||||
assert_equals(event.animationName, "[object Object]");
|
||||
}, "animationName set to an object with a valueOf function");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: 0.5});
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "elapsedTime set to 0.5");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: -0.5});
|
||||
assert_equals(event.elapsedTime, -0.5);
|
||||
}, "elapsedTime set to -0.5");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: undefined});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to undefined");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: null});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to null");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: false});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to false");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: true});
|
||||
assert_equals(event.elapsedTime, 1);
|
||||
}, "elapsedTime set to true");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: ""});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to ''");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: []});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to []");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent("test", {elapsedTime: [0.5]});
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "elapsedTime set to [0.5]");
|
||||
|
||||
test(function() {
|
||||
var event = new AnimationEvent(
|
||||
"test", {elapsedTime: { valueOf: function() { return 0.5; }}});
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "elapsedTime set to an object with a valueOf function");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new AnimationEvent("test", {elapsedTime: NaN});
|
||||
}, 'elapsedTime cannot be NaN so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to NaN");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new AnimationEvent("test", {elapsedTime: Infinity});
|
||||
}, 'elapsedTime cannot be Infinity so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to Infinity");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new AnimationEvent("test", {elapsedTime: -Infinity});
|
||||
}, 'elapsedTime cannot be -Infinity so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to -Infinity");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new AnimationEvent("test", {elapsedTime: "sample"});
|
||||
}, 'elapsedTime cannot be a string so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to 'sample'");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new AnimationEvent("test", {elapsedTime: [0.5, 1.0]});
|
||||
}, 'elapsedTime cannot be a multi-element array so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to [0.5, 1.0]");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new AnimationEvent("test", {elapsedTime: { sample: 0.5}});
|
||||
}, 'elapsedTime cannot be an object so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to an object");
|
||||
|
||||
test(function() {
|
||||
var eventInit = {animationName: "sample", elapsedTime: 0.5};
|
||||
var event = new AnimationEvent("test", eventInit);
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<title>Historical CSS Animation features must be removed</title>
|
||||
<link rel="help" href="http://www.w3.org/TR/css3-animations">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function isInterfaceNuked(name) {
|
||||
test(function() {
|
||||
assert_equals(window[name], undefined)
|
||||
}, "Historical CSS features must be removed: " + name)
|
||||
}
|
||||
var nukedInterfaces = [
|
||||
"WebKitAnimationEvent", // Replaced by unprefixed AnimationEvent
|
||||
];
|
||||
nukedInterfaces.forEach(isInterfaceNuked);
|
||||
</script>
|
|
@ -31,5 +31,4 @@
|
|||
document.documentElement.classList.remove("reftest-wait");
|
||||
});
|
||||
});
|
||||
inner.style.backgroundClip = "border-box";
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Containment Test: Size containment on fieldset</title>
|
||||
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size">
|
||||
<link rel="match" href="reference/contain-size-fieldset-001-ref.html">
|
||||
<meta name=assert content="Size containment does apply to fieldsets, thus their size is the same than if they don't have contents.">
|
||||
<style>
|
||||
fieldset {
|
||||
contain: size;
|
||||
display: inline-block;
|
||||
color: transparent;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>This test passes if it has the same output as the reference. You see the word "before", a small space, and then the word "after".</p>
|
||||
before<fieldset><legend>legend</legend></fieldset>after
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Containment Test: Reference file</title>
|
||||
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
|
||||
<style>
|
||||
fieldset {
|
||||
display: inline-block;
|
||||
color: transparent;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>This test passes if it has the same output as the reference. You see the word "before", a small space, and then the word "after".</p>
|
||||
before<fieldset></fieldset>after
|
|
@ -0,0 +1,62 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#align-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'align-self' property's value of a grid item from 'baseline' will exclude such item from its baseline context, which implies recomputing all the baseline offsets and aligning the items left in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 100px / 50px 50px 50px;
|
||||
background: grey;
|
||||
align-items: baseline;
|
||||
}
|
||||
#item1 {
|
||||
height: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
height: 50px;
|
||||
background: green;
|
||||
}
|
||||
#item3 {
|
||||
height: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-y": 30 },
|
||||
item2: {"data-offset-y": 0 },
|
||||
item3: {"data-offset-y": 20 }
|
||||
};
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-y": 10 },
|
||||
item2: {"data-offset-y": 50 },
|
||||
item3: {"data-offset-y": 0 }
|
||||
};
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.alignSelf = "end";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="50" data-expected-height="20" data-offset-x="0"></div>
|
||||
<div id="item2" data-expected-width="50" data-expected-height="50" data-offset-x="50"></div>
|
||||
<div id="item3" data-expected-width="50" data-expected-height="30" data-offset-x="100"></div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#align-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'align-self' property's value of a grid item to 'baseline' will include such item into a baseline context, which implies recomputing all the baseline offsets and aligning the items in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 100px / 50px 50px 50px;
|
||||
background: grey;
|
||||
align-items: baseline;
|
||||
}
|
||||
#item1 {
|
||||
height: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
height: 50px;
|
||||
background: green;
|
||||
align-self: center;
|
||||
}
|
||||
#item3 {
|
||||
height: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-y": 10 },
|
||||
item2: {"data-offset-y": 25 },
|
||||
item3: {"data-offset-y": 0 }
|
||||
};
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-y": 30 },
|
||||
item2: {"data-offset-y": 0 },
|
||||
item3: {"data-offset-y": 20 }
|
||||
};
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.alignSelf = "baseline";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="50" data-expected-height="20" data-offset-x="0"></div>
|
||||
<div id="item2" data-expected-width="50" data-expected-height="50" data-offset-x="50"></div>
|
||||
<div id="item3" data-expected-width="50" data-expected-height="30" data-offset-x="100"></div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing the Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the justify-self' property's value of a grid item from 'baseline' will exclude such item from its baseline context, which implies recomputing all the baseline offsets and aligning the items left in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 50px 50px 50px / 100px;
|
||||
background: grey;
|
||||
justify-items: baseline;
|
||||
}
|
||||
#container > div { writing-mode: vertical-rl; }
|
||||
#item1 {
|
||||
width: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
width: 50px;
|
||||
background: green;
|
||||
}
|
||||
#item3 {
|
||||
width: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-x": 30 },
|
||||
item2: {"data-offset-x": 0 },
|
||||
item3: {"data-offset-x": 20 }
|
||||
};
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-x": 10 },
|
||||
item2: {"data-offset-x": 50 },
|
||||
item3: {"data-offset-x": 0 }
|
||||
};
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.justifySelf = "end";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="20" data-expected-height="50" data-offset-y="0"></div>
|
||||
<div id="item2" data-expected-width="50" data-expected-height="50" data-offset-y="50"></div>
|
||||
<div id="item3" data-expected-width="30" data-expected-height="50" data-offset-y="100"></div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing the Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'justify-self' property's value of a grid item to 'baseline' will include such item into a baseline context, which implies recomputing all the baseline offsets and aligning the items in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 50px 50px 50px / 100px;
|
||||
background: grey;
|
||||
justify-items: baseline;
|
||||
}
|
||||
#container > div { writing-mode: vertical-rl; }
|
||||
#item1 {
|
||||
width: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
width: 50px;
|
||||
background: green;
|
||||
justify-self: center;
|
||||
}
|
||||
#item3 {
|
||||
width: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-x": 10 },
|
||||
item2: {"data-offset-x": 25 },
|
||||
item3: {"data-offset-x": 0 }
|
||||
};
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-x": 30 },
|
||||
item2: {"data-offset-x": 0 },
|
||||
item3: {"data-offset-x": 20 }
|
||||
};
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.justifySelf = "baseline";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="20" data-expected-height="50" data-offset-y="0"></div>
|
||||
<div id="item2" data-expected-width="50" data-expected-height="50" data-offset-y="50"></div>
|
||||
<div id="item3" data-expected-width="30" data-expected-height="50" data-offset-y="100"></div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#align-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'align-self' property's value of a grid item from 'baseline' will exclude such item from its baseline context, which implies recomputing all the baseline offsets and aligning the items left in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 100px / 50px 50px 50px;
|
||||
background: grey;
|
||||
align-items: baseline;
|
||||
font-family: Ahem;
|
||||
}
|
||||
#item1 {
|
||||
font-size: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
font-size: 40px;
|
||||
background: green;
|
||||
}
|
||||
#item3 {
|
||||
font-size: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-y": 16 },
|
||||
item2: {"data-offset-y": 0 },
|
||||
item3: {"data-offset-y": 8 }
|
||||
}
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-y": 8 },
|
||||
item2: {"data-offset-y": 60 },
|
||||
item3: {"data-offset-y": 0 }
|
||||
}
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.alignSelf = "end";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="50" data-expected-height="20" data-offset-x="0">É</div>
|
||||
<div id="item2" data-expected-width="50" data-expected-height="40" data-offset-x="50">É</div>
|
||||
<div id="item3" data-expected-width="50" data-expected-height="30" data-offset-x="100">É</div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#align-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'align-self' property's value of a grid item to 'baseline' will include such item into a baseline context, which implies recomputing all the baseline offsets and aligning the items in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 100px / 50px 50px 50px;
|
||||
background: grey;
|
||||
align-items: baseline;
|
||||
font-family: Ahem;
|
||||
}
|
||||
#item1 {
|
||||
font-size: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
font-size: 40px;
|
||||
background: green;
|
||||
align-self: center;
|
||||
}
|
||||
#item3 {
|
||||
font-size: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-y": 8 },
|
||||
item2: {"data-offset-y": 30 },
|
||||
item3: {"data-offset-y": 0 }
|
||||
}
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-y": 16 },
|
||||
item2: {"data-offset-y": 0 },
|
||||
item3: {"data-offset-y": 8 }
|
||||
}
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.alignSelf = "baseline";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="50" data-expected-height="20" data-offset-x="0">É</div>
|
||||
<div id="item2" data-expected-width="50" data-expected-height="40" data-offset-x="50">É</div>
|
||||
<div id="item3" data-expected-width="50" data-expected-height="30" data-offset-x="100">É</div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing the value of Self-Alignment properties</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'align-self' property's value of a grid item from 'baseline' will exclude such item from its baseline context, which implies recomputing all the baseline offsets and aligning the items left in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 50px 50px 50px / 100px;
|
||||
background: grey;
|
||||
justify-items: baseline;
|
||||
font-family: Ahem;
|
||||
text-orientation: sideways;
|
||||
}
|
||||
#container > div { writing-mode: vertical-lr; }
|
||||
#item1 {
|
||||
font-size: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
font-size: 40px;
|
||||
background: green;
|
||||
}
|
||||
#item3 {
|
||||
font-size: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-x": 4 },
|
||||
item2: {"data-offset-x": 0 },
|
||||
item3: {"data-offset-x": 2 }
|
||||
}
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-x": 2 },
|
||||
item2: {"data-offset-x": 60 },
|
||||
item3: {"data-offset-x": 0 }
|
||||
}
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.justifySelf = "end";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="20" data-expected-height="50" data-offset-y="0">É</div>
|
||||
<div id="item2" data-expected-width="40" data-expected-height="50" data-offset-y="50">É</div>
|
||||
<div id="item3" data-expected-width="30" data-expected-height="50" data-offset-y="100">É</div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Changing the Self-Alignment properties to interfere in Baseline Alignment</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#self-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#justify-self-property">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align/#typedef-baseline-position">
|
||||
<meta name="assert" content="Changing the 'justify-self' property's value of a grid item to 'baseline' will include such item into a baseline context, which implies recomputing all the baseline offsets and aligning the items in such context.">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
grid: 50px 50px 50px / 100px;
|
||||
background: grey;
|
||||
justify-items: baseline;
|
||||
font-family: Ahem;
|
||||
}
|
||||
#container > div { writing-mode: vertical-lr; }
|
||||
#item1 {
|
||||
font-size: 20px;
|
||||
background: blue;
|
||||
}
|
||||
#item2 {
|
||||
font-size: 40px;
|
||||
background: green;
|
||||
justify-self: center;
|
||||
}
|
||||
#item3 {
|
||||
font-size: 30px;
|
||||
background: red;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<script src="support/style-change.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
let before = {
|
||||
item1: {"data-offset-x": 5 },
|
||||
item2: {"data-offset-x": 30 },
|
||||
item3: {"data-offset-x": 0 }
|
||||
};
|
||||
|
||||
let after = {
|
||||
item1: {"data-offset-x": 10 },
|
||||
item2: {"data-offset-x": 0 },
|
||||
item3: {"data-offset-x": 5 }
|
||||
};
|
||||
|
||||
evaluateStyleChangeMultiple("before", before);
|
||||
item2.style.justifySelf = "baseline";
|
||||
evaluateStyleChangeMultiple("after", after);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
<body onload="runTest()">
|
||||
<div id="container">
|
||||
<div id="item1" data-expected-width="20" data-expected-height="50" data-offset-y="0">É</div>
|
||||
<div id="item2" data-expected-width="40" data-expected-height="50" data-offset-y="50">É</div>
|
||||
<div id="item3" data-expected-width="30" data-expected-height="50" data-offset-y="100">É</div>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
</body>
|
|
@ -0,0 +1,89 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Grid Layout Test: Self-Baseline alignment and sizing cyclic dependency</title>
|
||||
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#column-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#row-align">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-align-items">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-justify-items">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-alignment">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-baseline">
|
||||
<link rel="stylesheet" href="../../support/grid.css">
|
||||
<link rel="stylesheet" href="../../support/alignment.css">
|
||||
<meta name="assert" content="Items not participating in baseline may later participate if there is an extra pass of the track sizing algorithm.">
|
||||
<!-- https://github.com/w3c/csswg-drafts/issues/3046 -->
|
||||
<style>
|
||||
.grid {
|
||||
position: relative;
|
||||
display: inline-grid;
|
||||
background: grey;
|
||||
text-orientation: sideways;
|
||||
font-family: Ahem;
|
||||
}
|
||||
.row { grid: minmax(0px, 1fr) / 50px 50px 100px }
|
||||
.column { grid: 50px 50px 100px / minmax(0px, 1fr); }
|
||||
.item1 {
|
||||
font-size: 30px;
|
||||
background: blue;
|
||||
}
|
||||
.item2 {
|
||||
font-size: 20px;
|
||||
background: red;
|
||||
}
|
||||
.item3 {
|
||||
font-size: 80px;
|
||||
background: green;
|
||||
}
|
||||
.height50 { height: 50px; }
|
||||
.relativeHeight { height: 50%; }
|
||||
.relativeWidth { width: 50%; }
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/check-layout-th.js"></script>
|
||||
<body onload="checkLayout('.grid')">
|
||||
|
||||
<pre>flex rows - column-axis baseline - the blue orthogonal item didn't participate in the first iteration</pre>
|
||||
<div class="grid row alignItemsBaseline">
|
||||
<div class="item1 verticalLR" data-offset-x="0" data-offset-y="34" data-expected-width="50" data-expected-height="30">É</div>
|
||||
<div class="item2" data-offset-x="50" data-offset-y="48" data-expected-width="50" data-expected-height="20">É</div>
|
||||
<div class="item3" data-offset-x="100" data-offset-y="0" data-expected-width="100" data-expected-height="80">É</div>
|
||||
</div>
|
||||
|
||||
<pre>flex row - column-axis baseline - the blue relative sized item didn't participate in the first iterarion</pre>
|
||||
<div class="grid row alignItemsBaseline ">
|
||||
<div class="item1 relativeHeight" data-offset-x="0" data-offset-y="40" data-expected-width="50" data-expected-height="40"></div>
|
||||
<div class="item2" data-offset-x="50" data-offset-y="64" data-expected-width="50" data-expected-height="20">É</div>
|
||||
<div class="item3 verticalLR" data-offset-x="100" data-offset-y="0" data-expected-width="100" data-expected-height="80">É</div>
|
||||
</div>
|
||||
|
||||
<pre>flex row - both the blue relative sized and red orthogonal didn't participate in the first iteration</pre>
|
||||
<div class="grid row alignItemsBaseline">
|
||||
<div class="item1 relativeHeight" data-offset-x="0" data-offset-y="24" data-expected-width="50" data-expected-height="40"></div>
|
||||
<div class="item2 verticalLR" data-offset-x="50" data-offset-y="44" data-expected-width="50" data-expected-height="20">É</div>
|
||||
<div class="item3" data-offset-x="100" data-offset-y="0" data-expected-width="100" data-expected-height="80">É</div>
|
||||
</div>
|
||||
|
||||
<pre>flex column - row-axis baseline - the blue orthogonal item didn't participate in the first iteration</pre>
|
||||
<div class="grid column justifyItemsBaseline">
|
||||
<div class="item1" data-offset-x="16" data-offset-y="0" data-expected-width="30" data-expected-height="50">É</div>
|
||||
<div class="item2 verticalLR" data-offset-x="12" data-offset-y="50" data-expected-width="20" data-expected-height="50">É</div>
|
||||
<div class="item3 verticalLR" data-offset-x="0" data-offset-y="100" data-expected-width="80" data-expected-height="100">É</div>
|
||||
</div>
|
||||
|
||||
<pre>flex column - column-axis baseline - the blue relative sized item didn't participate in the first iterarion</pre>
|
||||
<div class="grid column justifyItemsBaseline">
|
||||
<div class="item1 relativeWidth height50" data-offset-x="16" data-offset-y="0" data-expected-width="40" data-expected-height="50"></div>
|
||||
<div class="item2 verticalLR" data-offset-x="12" data-offset-y="50" data-expected-width="20" data-expected-height="50">É</div>
|
||||
<div class="item3 verticalLR" data-offset-x="0" data-offset-y="100" data-expected-width="80" data-expected-height="100">É</div>
|
||||
</div>
|
||||
|
||||
<pre>flex columns - both the blue relative sized and red orthogonal didn't participate in the first iteration</pre>
|
||||
<div class="grid column justifyItemsBaseline">
|
||||
<div class="item1 relativeWidth height50" data-offset-x="16" data-offset-y="0" data-expected-width="40" data-expected-height="50"></div>
|
||||
<div class="item2" data-offset-x="16" data-offset-y="50" data-expected-width="20" data-expected-height="50">É</div>
|
||||
<div class="item3 verticalLR" data-offset-x="0" data-offset-y="100" data-expected-width="80" data-expected-height="100">É</div>
|
||||
</div>
|
||||
|
||||
</body>
|
|
@ -3,3 +3,12 @@ function evaluateStyleChange(element, phase, expectedProperty, expectedResult) {
|
|||
element.setAttribute(expectedProperty, expectedResult);
|
||||
checkLayout("." + phase, false);
|
||||
}
|
||||
function evaluateStyleChangeMultiple(phase, expectedResult) {
|
||||
for (var item in expectedResult) {
|
||||
var element = document.getElementById(item);
|
||||
element.className += " " + phase;
|
||||
for (var key in expectedResult[item])
|
||||
element.setAttribute(key, expectedResult[item][key]);
|
||||
}
|
||||
checkLayout("." + phase, false);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Multicol under vertical-rl scrolling container</title>
|
||||
<p>Passes if there are two green squares</p>
|
||||
<div id="scroller" style="width: 200px; height: 200px; overflow: scroll; border: 1px solid black">
|
||||
<div style="width: 580px; height: 500px; position: relative">
|
||||
<div style="position: absolute; right: 0">
|
||||
<div style="width: 80px; height: 80px; background: green"></div>
|
||||
<div style="height: 20px"></div>
|
||||
<div style="width: 80px; height: 80px; background: green"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Scroll all the way to the right.
|
||||
scroller.scrollLeft = 800;
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Multicol under vertical-rl scrolling container</title>
|
||||
<link rel="match" href="multicol-under-vertical-rl-scroll-ref.html">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-multicol">
|
||||
<p>Passes if there are two green squares</p>
|
||||
<div style="width: 200px; height: 200px; overflow: scroll; writing-mode: vertical-rl; border: 1px solid black">
|
||||
<div style="columns: 2; column-gap: 20px; width: 80px; height: 180px">
|
||||
<div style="width: 160px; background: green"></div>
|
||||
</div>
|
||||
<div style="width: 500px; height: 500px"></div>
|
||||
</div>
|
|
@ -72,4 +72,18 @@ test(function(){
|
|||
assert_equals(getComputedStyle(inner).getPropertyValue('--inherited-length-5'), '42px');
|
||||
}, "Reference to syntax-incompatible variable results in inherited value");
|
||||
|
||||
test(function(){
|
||||
CSS.registerProperty({name: '--inherited-em', syntax: '<length>', initialValue: '0px', inherits: true});
|
||||
outer.style = 'font-size: 11px; --inherited-em: 10em;';
|
||||
inner.style = 'font-size: 22px; --unregistered:var(--inherited-em);';
|
||||
assert_equals(getComputedStyle(inner).getPropertyValue('--unregistered'), '110px');
|
||||
}, "Font-relative units are absolutized before before inheritance");
|
||||
|
||||
test(function(){
|
||||
CSS.registerProperty({name: '--calc-length', syntax: '<length>', initialValue: '0px', inherits: true});
|
||||
outer.style = '--calc-length: calc(10px + 10px);';
|
||||
inner.style = '--unregistered:var(--calc-length);';
|
||||
assert_equals(getComputedStyle(inner).getPropertyValue('--unregistered'), '20px');
|
||||
}, "Calc expressions are resolved before inheritance");
|
||||
|
||||
</script>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function register_length(name) {
|
||||
function register_length(name, inherits=true) {
|
||||
CSS.registerProperty({
|
||||
name: name,
|
||||
syntax: '<length>',
|
||||
initialValue: '0px',
|
||||
inherits: false
|
||||
inherits: inherits
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
|||
register_length('--font-size-rem-via-var');
|
||||
register_length('--font-size-ex-via-var');
|
||||
register_length('--font-size-ch-via-var');
|
||||
register_length('--font-size-em-inherited', true);
|
||||
register_length('--font-size-ex-inherited', true);
|
||||
register_length('--font-size-ch-inherited', true);
|
||||
</script>
|
||||
<style>
|
||||
:root {
|
||||
|
@ -43,12 +46,20 @@
|
|||
--font-size-ch-via-var: var(--unregistered-ch);
|
||||
}
|
||||
|
||||
#parent {
|
||||
--font-size-em-inherited: 4em;
|
||||
--font-size-ex-inherited: 4ex;
|
||||
--font-size-ch-inherited: 4ch;
|
||||
}
|
||||
|
||||
#target {
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id=target></div>
|
||||
<div id=parent>
|
||||
<div id=target></div>
|
||||
</div>
|
||||
<div id=ref></div>
|
||||
|
||||
<script>
|
||||
|
@ -170,4 +181,25 @@
|
|||
assert_property_equals('--font-size-rem-via-var', expected10rem, root);
|
||||
}, 'Lengths with rem units are detected via var references');
|
||||
|
||||
test(function() {
|
||||
let expected4em = compute_dimension('4em', 'unset');
|
||||
target.style = 'font-size: var(--font-size-em-inherited);';
|
||||
assert_property_equals('font-size', expected4em);
|
||||
assert_property_equals('--font-size-em-inherited', expected4em);
|
||||
}, 'Inherited lengths with em units may be used');
|
||||
|
||||
test(function() {
|
||||
let expected4ex = compute_dimension('4ex', 'unset');
|
||||
target.style = 'font-size: var(--font-size-ex-inherited);';
|
||||
assert_property_equals('font-size', expected4ex);
|
||||
assert_property_equals('--font-size-ex-inherited', expected4ex);
|
||||
}, 'Inherited lengths with ex units may be used');
|
||||
|
||||
test(function() {
|
||||
let expected4ch = compute_dimension('4ch', 'unset');
|
||||
target.style = 'font-size: var(--font-size-ch-inherited);';
|
||||
assert_property_equals('font-size', expected4ch);
|
||||
assert_property_equals('--font-size-ch-inherited', expected4ch);
|
||||
}, 'Inherited lengths with ch units may be used');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -54,7 +54,7 @@ test(function() {
|
|||
assert_equals(computedStyle.getPropertyValue('--registered-length-6'), '80px');
|
||||
assert_equals(computedStyle.getPropertyValue('--registered-length-7'), '123px');
|
||||
assert_equals(computedStyle.getPropertyValue('--length-1'), ' 20px');
|
||||
assert_equals(computedStyle.getPropertyValue('--length-2'), ' 10px');
|
||||
assert_equals(computedStyle.getPropertyValue('--length-2'), ' 10px');
|
||||
assert_equals(computedStyle.getPropertyValue('--length-3'), ' calc(123px + 123px)');
|
||||
assert_equals(computedStyle.getPropertyValue('--registered-length-invalid'), '15px');
|
||||
|
||||
|
@ -96,5 +96,43 @@ test(function(){
|
|||
assert_equals(computedStyle.getPropertyValue('--registered-length-list-3'), '1px, 10px, 2px, 1px, 20px, 10px, 2px');
|
||||
}, 'Registered lists may be concatenated');
|
||||
|
||||
test(function(){
|
||||
CSS.registerProperty({
|
||||
name: '--length-em',
|
||||
syntax: '<length>',
|
||||
initialValue: '0px',
|
||||
inherits: false
|
||||
});
|
||||
element.style = 'font-size: 11px; --length-em: 10em; --unregistered:var(--length-em);';
|
||||
let computedStyle = getComputedStyle(element);
|
||||
assert_equals(computedStyle.getPropertyValue('--unregistered'), '110px');
|
||||
element.style = '';
|
||||
}, 'Font-relative units are absolutized when substituting');
|
||||
|
||||
test(function(){
|
||||
CSS.registerProperty({
|
||||
name: '--length-calc',
|
||||
syntax: '<length>',
|
||||
initialValue: '0px',
|
||||
inherits: false
|
||||
});
|
||||
element.style = 'font-size: 11px; --length-calc: calc(10em + 10px); --unregistered:var(--length-calc);';
|
||||
let computedStyle = getComputedStyle(element);
|
||||
assert_equals(computedStyle.getPropertyValue('--unregistered'), '120px');
|
||||
element.style = '';
|
||||
}, 'Calc expressions are resolved when substituting');
|
||||
|
||||
test(function(){
|
||||
CSS.registerProperty({
|
||||
name: '--length-calc-list',
|
||||
syntax: '<length>#',
|
||||
initialValue: '0px',
|
||||
inherits: false
|
||||
});
|
||||
element.style = 'font-size: 11px; --length-calc-list: 10em, calc(10em + 10px); --unregistered:var(--length-calc-list);';
|
||||
let computedStyle = getComputedStyle(element);
|
||||
assert_equals(computedStyle.getPropertyValue('--unregistered'), '110px, 120px');
|
||||
element.style = '';
|
||||
}, 'Lists with relative units are absolutized when substituting');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
<link rel="author" title="David Grogan" href="dgrogan@chromium.org">
|
||||
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows">
|
||||
<meta name="flags" content="" />
|
||||
<meta name="assert" content="caption margins are resolved against table's height when table has vertical flow" />
|
||||
<style>
|
||||
x-table {
|
||||
display: table;
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
writing-mode: vertical-lr;
|
||||
outline: 2px dashed blue;
|
||||
}
|
||||
x-caption {
|
||||
display: table-caption;
|
||||
height: 50px;
|
||||
width: 120px;
|
||||
writing-mode: horizontal-tb;
|
||||
outline: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
<x-table>
|
||||
<x-caption id=captionMarginLeft style="margin-left:20%">caption</x-caption>
|
||||
</x-table>
|
||||
<x-table>
|
||||
<x-caption id=captionMarginTop style="margin:auto 0">caption</x-caption>
|
||||
</x-table>
|
||||
<p>This is a script test because of how ridiculously differently the current
|
||||
engines render these cases.</p>
|
||||
|
||||
|
||||
<script>
|
||||
let caption_margin_left = getComputedStyle(id=captionMarginLeft).marginLeft;
|
||||
test(() => assert_equals(caption_margin_left, "40px"), "Caption percent margins are resolved against table's height for vertical-lr tables");
|
||||
let caption_margin_top = getComputedStyle(captionMarginTop).marginTop;
|
||||
test(() => assert_equals(caption_margin_top, "75px"), "Caption with auto top/bottom margins is centered vertically for vertical-lr tables");
|
||||
</script>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS Text Test: minimum rendered width of tab character</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<style>
|
||||
span { background-color: yellow; display: inline-block; letter-spacing: -.1em; }
|
||||
pre { position: absolute; top: 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre>
|
||||
</pre>
|
||||
<pre>
|
||||
</pre>
|
||||
<script>
|
||||
let pre = document.getElementsByTagName("pre")[0];
|
||||
let test = "";
|
||||
for (i = 7.0; i <= 8.125; i += 0.125) {
|
||||
test += `<span style="width:${i}ch">${i}ch</span>\n`;
|
||||
}
|
||||
pre.innerHTML = test;
|
||||
pre = document.getElementsByTagName("pre")[1];
|
||||
test = "";
|
||||
for (i = 0; i < 5; i++) {
|
||||
test += `\tfoo\n`;
|
||||
}
|
||||
for (i = 0; i < 5; i++) {
|
||||
test += `\t\tfoo\n`;
|
||||
}
|
||||
pre.innerHTML = test;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS Text Test: minimum rendered width of tab character</title>
|
||||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
|
||||
<link rel="reviewer" title="Xidorn Quan" href="https://www.upsuper.org/">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2">
|
||||
<link rel="match" href="tab-min-rendered-width-1-ref.html">
|
||||
<meta name="assert" content="If [rendered width of tab would be] less than 0.5ch, then the subsequent tab stop is used instead.">
|
||||
<style>
|
||||
span { background-color: yellow; display: inline-block; letter-spacing: -.1em; }
|
||||
pre { position: absolute; top: 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre>
|
||||
</pre>
|
||||
<script>
|
||||
let pre = document.getElementsByTagName("pre")[0];
|
||||
let test = "";
|
||||
for (i = 7.0; i <= 8.125; i += 0.125) {
|
||||
test += `<span style="width:${i}ch">${i}ch</span>	foo\n`;
|
||||
}
|
||||
pre.innerHTML = test;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,229 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Transitions Test: TransitionEvent interface</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transitions-1/#interface-transitionevent">
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="transitionevent-interface.js"></script>
|
||||
|
||||
<script>
|
||||
test(function() {
|
||||
var event = new TransitionEvent("");
|
||||
assert_true(event instanceof window.TransitionEvent);
|
||||
}, "the event is an instance of TransitionEvent");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("");
|
||||
assert_true(event instanceof window.Event);
|
||||
}, "the event inherts from Event");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent();
|
||||
}, 'First argument is required, so was expecting a TypeError.');
|
||||
}, 'Missing type argument');
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test");
|
||||
assert_equals(event.type, "test");
|
||||
}, "type argument is string");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent(null);
|
||||
assert_equals(event.type, "null");
|
||||
}, "type argument is null");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent(undefined);
|
||||
assert_equals(event.type, "undefined");
|
||||
}, "event type set to undefined");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test");
|
||||
assert_equals(event.propertyName, "");
|
||||
}, "propertyName has default value of empty string");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test");
|
||||
assert_equals(event.elapsedTime, 0.0);
|
||||
}, "elapsedTime has default value of 0.0");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test");
|
||||
assert_readonly(event, "propertyName", "readonly attribute value");
|
||||
}, "propertyName is readonly");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test");
|
||||
assert_readonly(event, "elapsedTime", "readonly attribute value");
|
||||
}, "elapsedTime is readonly");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", null);
|
||||
assert_equals(event.propertyName, "");
|
||||
assert_equals(event.elapsedTime, 0.0);
|
||||
}, "animationEventInit argument is null");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", undefined);
|
||||
assert_equals(event.propertyName, "");
|
||||
assert_equals(event.elapsedTime, 0.0);
|
||||
}, "animationEventInit argument is undefined");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {});
|
||||
assert_equals(event.propertyName, "");
|
||||
assert_equals(event.elapsedTime, 0.0);
|
||||
}, "animationEventInit argument is empty dictionary");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {pseudoElement: "::testPseudo"});
|
||||
assert_equals(event.pseudoElement, "::testPseudo");
|
||||
}, "TransitionEvent.pseudoElement initialized from the dictionary");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: "sample"});
|
||||
assert_equals(event.propertyName, "sample");
|
||||
}, "propertyName set to 'sample'");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: undefined});
|
||||
assert_equals(event.propertyName, "");
|
||||
}, "propertyName set to undefined");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: null});
|
||||
assert_equals(event.propertyName, "null");
|
||||
}, "propertyName set to null");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: false});
|
||||
assert_equals(event.propertyName, "false");
|
||||
}, "propertyName set to false");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: true});
|
||||
assert_equals(event.propertyName, "true");
|
||||
}, "propertyName set to true");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: 0.5});
|
||||
assert_equals(event.propertyName, "0.5");
|
||||
}, "propertyName set to a number");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: []});
|
||||
assert_equals(event.propertyName, "");
|
||||
}, "propertyName set to []");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: [1, 2, 3]});
|
||||
assert_equals(event.propertyName, "1,2,3");
|
||||
}, "propertyName set to [1, 2, 3]");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {propertyName: {sample: 0.5}});
|
||||
assert_equals(event.propertyName, "[object Object]");
|
||||
}, "propertyName set to an object");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test",
|
||||
{propertyName: {valueOf: function () { return 'sample'; }}});
|
||||
assert_equals(event.propertyName, "[object Object]");
|
||||
}, "propertyName set to an object with a valueOf function");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: 0.5});
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "elapsedTime set to 0.5");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: -0.5});
|
||||
assert_equals(event.elapsedTime, -0.5);
|
||||
}, "elapsedTime set to -0.5");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: undefined});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to undefined");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: null});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to null");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: false});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to false");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: true});
|
||||
assert_equals(event.elapsedTime, 1);
|
||||
}, "elapsedTime set to true");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: ""});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to ''");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: []});
|
||||
assert_equals(event.elapsedTime, 0);
|
||||
}, "elapsedTime set to []");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent("test", {elapsedTime: [0.5]});
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "elapsedTime set to [0.5]");
|
||||
|
||||
test(function() {
|
||||
var event = new TransitionEvent(
|
||||
"test", {elapsedTime: { valueOf: function() { return 0.5; }}});
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "elapsedTime set to an object with a valueOf function");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent("test", {elapsedTime: NaN});
|
||||
}, 'elapsedTime cannot be NaN so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to NaN");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent("test", {elapsedTime: Infinity});
|
||||
}, 'elapsedTime cannot be Infinity so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to Infinity");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent("test", {elapsedTime: -Infinity});
|
||||
}, 'elapsedTime cannot be -Infinity so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to -Infinity");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent("test", {elapsedTime: "sample"});
|
||||
}, 'elapsedTime cannot be a string so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to 'sample'");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent("test", {elapsedTime: [0.5, 1.0]});
|
||||
}, 'elapsedTime cannot be a multi-element array so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to [0.5, 1.0]");
|
||||
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
new TransitionEvent("test", {elapsedTime: { sample: 0.5}});
|
||||
}, 'elapsedTime cannot be an object so was expecting a TypeError');
|
||||
}, "elapsedTime cannot be set to an object");
|
||||
|
||||
test(function() {
|
||||
var eventInit = {propertyName: "sample", elapsedTime: 0.5};
|
||||
var event = new TransitionEvent("test", eventInit);
|
||||
assert_equals(event.propertyName, "sample");
|
||||
assert_equals(event.elapsedTime, 0.5);
|
||||
}, "TransitionEventInit properties set value");
|
||||
</script>
|
|
@ -793,14 +793,6 @@ asserts that one `assert_func(actual, expected_array_N, extra_arg1, ..., extra_a
|
|||
allows multiple behaviours. Test authors should not use this method simply to hide
|
||||
UA bugs.
|
||||
|
||||
### `assert_exists(object, property_name, description)`
|
||||
**deprecated**
|
||||
asserts that object has an own property `property_name`
|
||||
|
||||
### `assert_not_exists(object, property_name, description)`
|
||||
**deprecated**
|
||||
assert that object does not have own property `property_name`
|
||||
|
||||
## Metadata ##
|
||||
|
||||
It is possible to add optional metadata to tests; this can be done in
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<!--
|
||||
This test is adopted from Olli Pettay's test case at
|
||||
http://mozilla.pettay.fi/shadow_focus.html
|
||||
-->
|
||||
<div id="host"></div>
|
||||
<input id="lightInput">
|
||||
<script>
|
||||
const root = host.attachShadow({ mode: "closed" });
|
||||
root.innerHTML = "<input id='shadowInput'>";
|
||||
|
||||
async_test((test) => {
|
||||
root.getElementById("shadowInput").focus();
|
||||
window.addEventListener("focus", test.step_func_done((e) => {
|
||||
assert_equals(e.relatedTarget, host);
|
||||
}, "relatedTarget should be pointing to shadow host."), true);
|
||||
lightInput.focus();
|
||||
}, "relatedTarget should not leak at capturing phase, at window object.");
|
||||
|
||||
async_test((test) => {
|
||||
root.getElementById("shadowInput").focus();
|
||||
lightInput.addEventListener("focus", test.step_func_done((e) => {
|
||||
assert_equals(e.relatedTarget, host);
|
||||
}, "relatedTarget should be pointing to shadow host."), true);
|
||||
lightInput.focus();
|
||||
}, "relatedTarget should not leak at target.");
|
||||
|
||||
</script>
|
|
@ -12,7 +12,7 @@
|
|||
EventSource.prototype.ReturnTrue = function() { return true }
|
||||
var source = new EventSource("resources/message.py")
|
||||
assert_true(source.ReturnTrue())
|
||||
assert_exists(window, "EventSource")
|
||||
assert_own_property(window, "EventSource")
|
||||
source.close()
|
||||
})
|
||||
</scrIpt>
|
||||
|
|
|
@ -19,7 +19,7 @@ async_test(function(t) {
|
|||
}
|
||||
|
||||
function step2_processSubframeMsg(msg) {
|
||||
assert_not_exists(msg, 'error');
|
||||
assert_false(msg.hasOwnProperty('error'), 'unexpected property found: "error"');
|
||||
assert_equals(msg.blob_type, 'text/html');
|
||||
assert_equals(msg.blob_size, 147);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ async_test(t => {
|
|||
const events = [];
|
||||
const callback = t.step_func(event => {
|
||||
// fullscreenElement should have changed before either event is fired.
|
||||
assert_equals(document.fullscreenElement, null, `fullscreenElement in {event.type} event`);
|
||||
assert_equals(document.fullscreenElement, null, `fullscreenElement in ${event.type} event`);
|
||||
events.push(event.type);
|
||||
if (event.type == 'fullscreenchange') {
|
||||
step_timeout(t.unreached_func('timer callback'));
|
||||
|
|
|
@ -7,18 +7,19 @@
|
|||
<iframe allowfullscreen></iframe>
|
||||
<iframe allowfullscreen></iframe>
|
||||
<script>
|
||||
async_test(function(t)
|
||||
{
|
||||
var iframes = document.getElementsByTagName("iframe");
|
||||
trusted_request(t, iframes[0].contentDocument.body, document.body);
|
||||
iframes[0].contentDocument.onfullscreenchange = t.step_func(function()
|
||||
{
|
||||
assert_equals(document.fullscreenElement, iframes[0]);
|
||||
trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body);
|
||||
iframes[1].contentDocument.onfullscreenchange = t.step_func_done(function() {
|
||||
assert_equals(document.fullscreenElement, iframes[1]);
|
||||
});
|
||||
iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenchange error");
|
||||
});
|
||||
});
|
||||
// wait for load event to avoid https://bugzil.la/1493878
|
||||
window.onload = function() {
|
||||
async_test(function(t) {
|
||||
var iframes = document.getElementsByTagName("iframe");
|
||||
trusted_request(t, iframes[0].contentDocument.body, document.body);
|
||||
iframes[0].contentDocument.onfullscreenchange = t.step_func(function() {
|
||||
assert_equals(document.fullscreenElement, iframes[0]);
|
||||
trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body);
|
||||
iframes[1].contentDocument.onfullscreenchange = t.step_func_done(function() {
|
||||
assert_equals(document.fullscreenElement, iframes[1]);
|
||||
});
|
||||
iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenchange error");
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -6,14 +6,16 @@
|
|||
<div id="log"></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
async_test(function(t)
|
||||
{
|
||||
var iframe = document.querySelector("iframe");
|
||||
document.onfullscreenchange = t.unreached_func("document fullscreenchange event");
|
||||
document.onfullscreenerror = t.unreached_func("document fullscreenerror event");
|
||||
iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event");
|
||||
iframe.contentDocument.onfullscreenerror = t.step_func_done();
|
||||
assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag");
|
||||
trusted_request(t, iframe.contentDocument.body, document.body);
|
||||
});
|
||||
// wait for load event to avoid https://bugzil.la/1493878
|
||||
window.onload = function() {
|
||||
async_test(function(t) {
|
||||
var iframe = document.querySelector("iframe");
|
||||
document.onfullscreenchange = t.unreached_func("document fullscreenchange event");
|
||||
document.onfullscreenerror = t.unreached_func("document fullscreenerror event");
|
||||
iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event");
|
||||
iframe.contentDocument.onfullscreenerror = t.step_func_done();
|
||||
assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag");
|
||||
trusted_request(t, iframe.contentDocument.body, document.body);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -6,37 +6,40 @@
|
|||
<div id="log"></div>
|
||||
<iframe allowfullscreen></iframe>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const iframe = document.querySelector('iframe');
|
||||
const iframeDoc = iframe.contentDocument;
|
||||
const iframeBody = iframeDoc.body;
|
||||
// wait for load event to avoid https://bugzil.la/1493878
|
||||
window.onload = function() {
|
||||
async_test(t => {
|
||||
const iframe = document.querySelector('iframe');
|
||||
const iframeDoc = iframe.contentDocument;
|
||||
const iframeBody = iframeDoc.body;
|
||||
|
||||
let count = 0;
|
||||
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
|
||||
count++;
|
||||
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
|
||||
// Both when entering and exiting, the fullscreenchange event is fired first
|
||||
// on the outer document and then on the iframe's document. This is because
|
||||
// the events are fired in animation frame tasks, which run in "frame tree"
|
||||
// order.
|
||||
const expected = {
|
||||
target: count == 1 || count == 3 ? iframe : iframeBody,
|
||||
outerFullscreenElement: count <= 2 ? iframe : null,
|
||||
innerFullscreenElement: count <= 2 ? iframeBody : null,
|
||||
};
|
||||
assert_equals(event.target, expected.target, 'event target');
|
||||
assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement');
|
||||
assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement');
|
||||
if (count == 2) {
|
||||
iframeDoc.exitFullscreen();
|
||||
} else if (count == 4) {
|
||||
// Done, but set timeout to fail on extra events.
|
||||
step_timeout(t.step_func_done());
|
||||
}
|
||||
let count = 0;
|
||||
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
|
||||
count++;
|
||||
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
|
||||
// Both when entering and exiting, the fullscreenchange event is fired first
|
||||
// on the outer document and then on the iframe's document. This is because
|
||||
// the events are fired in animation frame tasks, which run in "frame tree"
|
||||
// order.
|
||||
const expected = {
|
||||
target: count == 1 || count == 3 ? iframe : iframeBody,
|
||||
outerFullscreenElement: count <= 2 ? iframe : null,
|
||||
innerFullscreenElement: count <= 2 ? iframeBody : null,
|
||||
};
|
||||
assert_equals(event.target, expected.target, 'event target');
|
||||
assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement');
|
||||
assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement');
|
||||
if (count == 2) {
|
||||
iframeDoc.exitFullscreen();
|
||||
} else if (count == 4) {
|
||||
// Done, but set timeout to fail on extra events.
|
||||
step_timeout(t.step_func_done());
|
||||
}
|
||||
});
|
||||
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
|
||||
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
|
||||
|
||||
trusted_request(t, iframeBody, iframeBody);
|
||||
});
|
||||
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
|
||||
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
|
||||
|
||||
trusted_request(t, iframeBody, iframeBody);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -28,21 +28,25 @@ async_test(t => {
|
|||
}, 'Timing of fullscreenchange and resize events');
|
||||
|
||||
async_test(t => {
|
||||
var promise = document.createElement('a').requestFullscreen();
|
||||
var promise_executed = false;
|
||||
if (promise) {
|
||||
promise.catch(()=>{promise_executed = true; });
|
||||
} else {
|
||||
// if promises aren't supported treat it as executed.
|
||||
promise_executed = true;
|
||||
}
|
||||
// Gecko throttles requestAnimationFrame before the first paint, so
|
||||
// wrap the test to work around that.
|
||||
requestAnimationFrame(t.step_func(() => {
|
||||
var promise = document.createElement('a').requestFullscreen();
|
||||
var promise_executed = false;
|
||||
if (promise) {
|
||||
promise.catch(()=>{promise_executed = true; });
|
||||
} else {
|
||||
// if promises aren't supported treat it as executed.
|
||||
promise_executed = true;
|
||||
}
|
||||
|
||||
// If fullscreenerror is an animation frame event, then animation frame
|
||||
// callbacks should be run after it is fired, before the timer callback.
|
||||
document.onfullscreenerror = t.step_func(() => {
|
||||
assert_true(promise_executed, "promise executed");
|
||||
step_timeout(t.unreached_func('timer callback'));
|
||||
requestAnimationFrame(t.step_func_done());
|
||||
});
|
||||
// If fullscreenerror is an animation frame event, then animation frame
|
||||
// callbacks should be run after it is fired, before the timer callback.
|
||||
document.onfullscreenerror = t.step_func(() => {
|
||||
assert_true(promise_executed, "promise executed");
|
||||
step_timeout(t.unreached_func('timer callback'));
|
||||
requestAnimationFrame(t.step_func_done());
|
||||
});
|
||||
}));
|
||||
}, 'Timing of fullscreenerror event');
|
||||
</script>
|
||||
|
|
|
@ -5,33 +5,36 @@
|
|||
<script src="../trusted-click.js"></script>
|
||||
<iframe allowfullscreen></iframe>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const iframe = document.querySelector('iframe');
|
||||
const iframeDoc = iframe.contentDocument;
|
||||
// wait for load event to avoid https://bugzil.la/1493878
|
||||
window.onload = function() {
|
||||
async_test(t => {
|
||||
const iframe = document.querySelector('iframe');
|
||||
const iframeDoc = iframe.contentDocument;
|
||||
|
||||
// Enter fullscreen for the iframe's body element.
|
||||
trusted_request(t, iframeDoc.body, iframeDoc.body);
|
||||
document.onfullscreenchange = t.step_func(() => {
|
||||
assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element");
|
||||
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element");
|
||||
// Enter fullscreen for the iframe's body element.
|
||||
trusted_request(t, iframeDoc.body, iframeDoc.body);
|
||||
document.onfullscreenchange = t.step_func(() => {
|
||||
assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element");
|
||||
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element");
|
||||
|
||||
// Then, move the outer document's body into the iframe. This is an unusual
|
||||
// thing to do, but means that the iframe is removed from its document and
|
||||
// should trigger fullscreen exit.
|
||||
iframeDoc.documentElement.appendChild(document.body);
|
||||
// Then, move the outer document's body into the iframe. This is an unusual
|
||||
// thing to do, but means that the iframe is removed from its document and
|
||||
// should trigger fullscreen exit.
|
||||
iframeDoc.documentElement.appendChild(document.body);
|
||||
|
||||
// If we exit in an orderly fashion, that's all one can ask for.
|
||||
document.onfullscreenchange = t.step_func_done(() => {
|
||||
assert_equals(document.fullscreenElement, null, "document's final fullscreen element");
|
||||
// If we exit in an orderly fashion, that's all one can ask for.
|
||||
document.onfullscreenchange = t.step_func_done(() => {
|
||||
assert_equals(document.fullscreenElement, null, "document's final fullscreen element");
|
||||
|
||||
// Because the iframe was removed, its browsing context was discarded and
|
||||
// its contentDocument has become null. Because that browsing context was
|
||||
// neither a descendant browsing context nor had an active document,
|
||||
// nothing at all was done with it in the exit fullscreen algorithm, so
|
||||
// its fullscreenElement is unchanged.
|
||||
assert_equals(iframe.contentDocument, null, "iframe's content document");
|
||||
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's final fullscreen element");
|
||||
// Because the iframe was removed, its browsing context was discarded and
|
||||
// its contentDocument has become null. Because that browsing context was
|
||||
// neither a descendant browsing context nor had an active document,
|
||||
// nothing at all was done with it in the exit fullscreen algorithm, so
|
||||
// its fullscreenElement is unchanged.
|
||||
assert_equals(iframe.contentDocument, null, "iframe's content document");
|
||||
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's final fullscreen element");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -14,21 +14,32 @@ iframe {
|
|||
<div id="log"></div>
|
||||
<div id="ancestor"><iframe></iframe></div>
|
||||
<script>
|
||||
function assert_dir_properties(style, propBase, value, state) {
|
||||
for (let dir of ["Top", "Right", "Bottom", "Left"]) {
|
||||
let prop = propBase.replace('{}', dir);
|
||||
assert_equals(style[prop], value, `${state} ${prop} style`);
|
||||
}
|
||||
}
|
||||
|
||||
async_test(t => {
|
||||
const ancestor = document.getElementById('ancestor');
|
||||
const iframe = ancestor.firstChild;
|
||||
|
||||
const initialStyle = getComputedStyle(iframe);
|
||||
assert_equals(initialStyle.border, '1px solid rgb(0, 0, 255)', 'initial border style');
|
||||
assert_equals(initialStyle.padding, '1px', 'initial padding style');
|
||||
assert_dir_properties(initialStyle, 'border{}Width', '1px', 'initial');
|
||||
assert_dir_properties(initialStyle, 'border{}Style', 'solid', 'initial');
|
||||
assert_dir_properties(initialStyle, 'border{}Color', 'rgb(0, 0, 255)', 'initial');
|
||||
assert_dir_properties(initialStyle, 'padding{}', '1px', 'initial');
|
||||
assert_equals(initialStyle.transform, 'matrix(0.5, 0, 0, 0.5, 0, 0)', 'initial transform style');
|
||||
|
||||
trusted_request(t, iframe);
|
||||
|
||||
document.addEventListener('fullscreenchange', t.step_func_done(() => {
|
||||
const fullscreenStyle = getComputedStyle(iframe);
|
||||
assert_equals(fullscreenStyle.border, '0px none rgb(0, 0, 0)', 'fullscreen border style');
|
||||
assert_equals(fullscreenStyle.padding, '0px', 'fullscreen padding style');
|
||||
assert_dir_properties(fullscreenStyle, 'border{}Width', '0px', 'fullscreen');
|
||||
assert_dir_properties(fullscreenStyle, 'border{}Style', 'none', 'fullscreen');
|
||||
assert_dir_properties(fullscreenStyle, 'border{}Color', 'rgb(0, 0, 0)', 'fullscreen');
|
||||
assert_dir_properties(fullscreenStyle, 'padding{}', '0px', 'fullscreen');
|
||||
assert_equals(fullscreenStyle.transform, 'none', 'fullscreen transform style');
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@ function reportload() {
|
|||
test(function () {
|
||||
assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' );
|
||||
}, 'history.length should update when setting location.hash');
|
||||
test(function () { assert_true( !!history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist'); //assert_exists does not allow prototype inheritance
|
||||
test(function () { assert_true( !!history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist'); //assert_own_property does not allow prototype inheritance
|
||||
test(function () { assert_true( !!iframe.contentWindow.history.pushState, 'critical test; ignore any failures after this' ); }, 'history.pushState must exist within iframes');
|
||||
test(function () {
|
||||
assert_equals( iframe.contentWindow.history.state, null );
|
||||
|
@ -250,7 +250,7 @@ function reportload() {
|
|||
assert_equals( ev.state.numdata, 1, 'state numeric data was not correct' );
|
||||
assert_equals( ev.state.strdata, 'string data', 'state string data was not correct' );
|
||||
assert_true( !!ev.state.datedata.getTime, 'state date data was not correct' );
|
||||
assert_exists( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_own_property( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_equals( ev.state.regdata.source, 'a', 'state regex pattern data was not correct' );
|
||||
assert_true( ev.state.regdata.global, 'state regex flag data was not correct' );
|
||||
assert_equals( ev.state.regdata.lastIndex, 0, 'state regex lastIndex data was not correct' );
|
||||
|
|
|
@ -43,7 +43,7 @@ function reportload() {
|
|||
test(function () {
|
||||
assert_equals( history.length, histlength + 1, 'make sure that you loaded the test in a new tab/window' );
|
||||
}, 'history.length should update when setting location.hash');
|
||||
test(function () { assert_true( !!history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist'); //assert_exists does not allow prototype inheritance
|
||||
test(function () { assert_true( !!history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist'); //assert_own_property does not allow prototype inheritance
|
||||
test(function () { assert_true( !!iframe.contentWindow.history.replaceState, 'critical test; ignore any failures after this' ); }, 'history.replaceState must exist within iframes');
|
||||
test(function () {
|
||||
assert_equals( iframe.contentWindow.history.state, null );
|
||||
|
@ -225,7 +225,7 @@ function reportload() {
|
|||
assert_equals( ev.state.numdata, 1, 'state numeric data was not correct' );
|
||||
assert_equals( ev.state.strdata, 'string data', 'state string data was not correct' );
|
||||
assert_true( !!ev.state.datedata.getTime, 'state date data was not correct' );
|
||||
assert_exists( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_own_property( ev.state, 'regdata', 'state regex data was not correct' );
|
||||
assert_equals( ev.state.regdata.source, 'a', 'state regex pattern data was not correct' );
|
||||
assert_true( ev.state.regdata.global, 'state regex flag data was not correct' );
|
||||
assert_equals( ev.state.regdata.lastIndex, 0, 'state regex lastIndex data was not correct' );
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
td {
|
||||
border: 5px solid black;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
Passes if there is a grid containing 2x2 squares.
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td></td><td></td></tr>
|
||||
<tr><td></td><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Test for transformed tbody and tr with collapsed borders</title>
|
||||
<link rel="match" href="transformed-tbody-tr-collapsed-border-ref.html">
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
tbody, tr {
|
||||
transform: translateY(0);
|
||||
}
|
||||
td {
|
||||
border: 5px solid black;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
Passes if there is a grid containing 2x2 squares.
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><td></td><td></td></tr>
|
||||
<tr><td></td><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Reference for legend and display: list-item numbering</title>
|
||||
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
|
||||
<style>
|
||||
ol { margin: 0; padding: 0; border: none; }
|
||||
ol > * { margin: 0 40px; padding: 0; }
|
||||
</style>
|
||||
|
||||
<ol>
|
||||
<li value="2">B</li>
|
||||
<li value="1">A</li>
|
||||
<li value="3">C</li>
|
||||
</ol>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Legend and display: list-item numbering</title>
|
||||
<link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
<link rel=match href="legend-list-item-numbering-ref.html">
|
||||
|
||||
<style>
|
||||
fieldset { margin: 0; padding: 0; border: none; list-style-type: decimal; }
|
||||
fieldset > * { margin: 0 40px; padding: 0; display: list-item; }
|
||||
</style>
|
||||
|
||||
<fieldset>
|
||||
<div>A</div>
|
||||
<legend>B</legend>
|
||||
<div>C</div>
|
||||
</fieldset>
|
|
@ -4,6 +4,7 @@
|
|||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src=/common/get-host-info.sub.js></script>
|
||||
<div id="log"></div>
|
||||
<div id="test">
|
||||
<script>
|
||||
|
@ -31,18 +32,6 @@ tUnsupported.step(function() {
|
|||
elt.rel = "stylesheet";
|
||||
elt.href = "nonexistent:stylesheet.css";
|
||||
document.getElementsByTagName("head")[0].appendChild(elt);
|
||||
})
|
||||
|
||||
var tText = async_test("Should get an error event for a text/plain response.")
|
||||
tText.step(function() {
|
||||
var elt = document.createElement("link");
|
||||
elt.onerror = tText.step_func(function() {
|
||||
assert_true(true, "Got error event for 404 error.")
|
||||
tText.done()
|
||||
})
|
||||
elt.onload = tText.unreached_func("load event should not be fired");
|
||||
elt.rel = "stylesheet";
|
||||
elt.href = "../../../../../common/css-red.txt";
|
||||
document.getElementsByTagName("head")[0].appendChild(elt);
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<script src=resources/link-style-error.js></script>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//" "">
|
||||
<title>link: error events in limited quirks mode</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src=/common/get-host-info.sub.js></script>
|
||||
<div id="log"></div>
|
||||
<script src=resources/link-style-error.js></script>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//" "">
|
||||
<title>link: error events in quirks mode</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src=/common/get-host-info.sub.js></script>
|
||||
<div id="log"></div>
|
||||
<script src=resources/link-style-error.js></script>
|
|
@ -0,0 +1,7 @@
|
|||
def main(request, response):
|
||||
response.add_required_headers = False
|
||||
if "content_type" in request.GET:
|
||||
response.writer.write_header("Content-Type", request.GET.first("content_type"))
|
||||
if "nosniff" in request.GET:
|
||||
response.writer.write_header("x-content-type-options", "nosniff")
|
||||
response.writer.write_content("body { background:red }")
|
|
@ -0,0 +1,47 @@
|
|||
["<link>", "@import"].forEach(linkType => {
|
||||
[
|
||||
["same-origin", "resources/css.py"],
|
||||
["cross-origin", get_host_info().HTTP_REMOTE_ORIGIN + "/html/semantics/document-metadata/the-link-element/resources/css.py"]
|
||||
].forEach(originType => {
|
||||
["no Content-Type", "wrong Content-Type", "broken Content-Type"].forEach(contentType => {
|
||||
["no nosniff", "nosniff"].forEach(nosniff => {
|
||||
async_test(t => {
|
||||
const l = document.createElement("link");
|
||||
t.add_cleanup(() => l.remove());
|
||||
if (nosniff === "nosniff" || contentType === "wrong Content-Type" && (document.compatMode === "CSS1Compat" || originType[0] === "cross-origin")) {
|
||||
l.onerror = t.step_func_done();
|
||||
l.onload = t.unreached_func("error event should have fired");
|
||||
} else {
|
||||
l.onload = t.step_func_done();
|
||||
l.onerror = t.unreached_func("load event should have fired");
|
||||
}
|
||||
l.rel = "stylesheet";
|
||||
let query = [];
|
||||
if (contentType === "broken Content-Type") {
|
||||
query.push("content_type=oops");
|
||||
} else if (contentType === "wrong Content-Type") {
|
||||
query.push("content_type=text/plain")
|
||||
}
|
||||
if (nosniff === "nosniff") {
|
||||
query.push("nosniff");
|
||||
}
|
||||
let stringQuery = "";
|
||||
query.forEach(val => {
|
||||
if (stringQuery === "") {
|
||||
stringQuery += "?" + val;
|
||||
} else {
|
||||
stringQuery += "&" + val;
|
||||
}
|
||||
});
|
||||
const link = new URL(originType[1] + stringQuery, location).href;
|
||||
if (linkType === "<link>") {
|
||||
l.href = link;
|
||||
} else {
|
||||
l.href = "data:text/css,@import url(" + link + ");";
|
||||
}
|
||||
document.head.appendChild(l);
|
||||
}, "Stylesheet loading using " + linkType + " with " + contentType + ", " + originType[0] + ", and " + nosniff);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -15,7 +15,7 @@ async_test(function(t) {
|
|||
video.textTracks.onchange = t.step_func_done(function() {
|
||||
assert_equals(event.target, video.textTracks);
|
||||
assert_true(event instanceof Event, 'instanceof');
|
||||
assert_not_exists(event, 'track');
|
||||
assert_false(event.hasOwnProperty('track'), 'unexpected property found: "track"');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="UTF-8">
|
||||
<title>Check processing of iframe without src and srcdoc attribute</title>
|
||||
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
let iframe = document.querySelector("iframe");
|
||||
|
||||
async_test(t => {
|
||||
let originDoc = iframe.contentDocument;
|
||||
window.addEventListener("load", t.step_func_done(() => {
|
||||
assert_equals(iframe.contentDocument, originDoc, "contentDocument shouldn't be changed");
|
||||
}));
|
||||
}, "iframe.contentDocument should not be changed");
|
||||
|
||||
async_test(t => {
|
||||
iframe.addEventListener("load", t.unreached_func());
|
||||
window.addEventListener("load", () => t.done());
|
||||
}, "load event of iframe should not be fired after processing the element");
|
||||
</script>
|
|
@ -42,10 +42,10 @@
|
|||
}, desc);
|
||||
}
|
||||
|
||||
autocompletetest(document.forms.missing_attribute, ["on", "on", "on", "off", ""], "form autocomplete attribute missing");
|
||||
autocompletetest(document.forms.autocomplete_on, ["on", "on", "on", "off", ""], "form autocomplete attribute on");
|
||||
autocompletetest(document.forms.autocomplete_off, ["off", "off", "on", "off", ""], "form autocomplete attribute off");
|
||||
autocompletetest(document.forms.autocomplete_invalid, ["on", "on", "on", "off", ""], "form autocomplete attribute invalid");
|
||||
autocompletetest(document.forms.missing_attribute, ["on", "", "on", "off", ""], "form autocomplete attribute missing");
|
||||
autocompletetest(document.forms.autocomplete_on, ["on", "", "on", "off", ""], "form autocomplete attribute on");
|
||||
autocompletetest(document.forms.autocomplete_off, ["off", "", "on", "off", ""], "form autocomplete attribute off");
|
||||
autocompletetest(document.forms.autocomplete_invalid, ["on", "", "on", "off", ""], "form autocomplete attribute invalid");
|
||||
|
||||
var keywords = [ "on", "off", "name", "honorific-prefix", "given-name", "additional-name", "family-name", "honorific-suffix", "nickname", "username", "new-password", "current-password", "organization-title", "organization", "street-address", "address-line1", "address-line2", "address-line3", "address-level4", "address-level3", "address-level2", "address-level1", "country", "country-name", "postal-code", "cc-name", "cc-given-name", "cc-additional-name", "cc-family-name", "cc-number", "cc-exp", "cc-exp-month", "cc-exp-year", "cc-csc", "cc-type", "transaction-currency", "transaction-amount", "language", "bday", "bday-day", "bday-month", "bday-year", "sex", "url", "photo", "tel", "tel-country-code", "tel-national", "tel-area-code", "tel-local", "tel-local-prefix", "tel-local-suffix", "tel-extension", "email", "impp" ];
|
||||
|
||||
|
@ -58,4 +58,59 @@
|
|||
assert_equals(input.autocomplete, keyword);
|
||||
}, keyword + " is an allowed autocomplete field name");
|
||||
});
|
||||
|
||||
|
||||
test(() => {
|
||||
const select = document.createElement("select");
|
||||
select.setAttribute("autocomplete", " \n");
|
||||
assert_equals(select.autocomplete, "");
|
||||
}, "Test whitespace-only attribute value");
|
||||
|
||||
test(() => {
|
||||
const select = document.createElement("select");
|
||||
|
||||
select.setAttribute("autocomplete", "foo off");
|
||||
assert_equals(select.autocomplete, "");
|
||||
|
||||
// Normal category; max=3
|
||||
select.setAttribute("autocomplete", "foo section-foo billing name");
|
||||
assert_equals(select.autocomplete, "");
|
||||
|
||||
// Contact category; max=4
|
||||
select.setAttribute("autocomplete", "foo section-bar billing work name");
|
||||
assert_equals(select.autocomplete, "");
|
||||
}, "Test maximum number of tokens");
|
||||
|
||||
test(() => {
|
||||
const textarea = document.createElement("textarea");
|
||||
|
||||
textarea.setAttribute("autocomplete", "call-sign");
|
||||
assert_equals(textarea.autocomplete, "");
|
||||
}, "Unknown field");
|
||||
|
||||
test(() => {
|
||||
const hidden = document.createElement("input");
|
||||
hidden.type = "hidden";
|
||||
hidden.setAttribute("autocomplete", "on");
|
||||
assert_equals(hidden.autocomplete, "");
|
||||
hidden.setAttribute("autocomplete", "off");
|
||||
assert_equals(hidden.autocomplete, "");
|
||||
}, "Test 'wearing the autofill anchor mantle' with off/on");
|
||||
|
||||
test(() => {
|
||||
const textarea = document.createElement("textarea");
|
||||
|
||||
textarea.setAttribute("autocomplete", " HOME\ntel");
|
||||
assert_equals(textarea.autocomplete, "home tel");
|
||||
|
||||
textarea.setAttribute("autocomplete", "shipping country");
|
||||
assert_equals(textarea.autocomplete, "shipping country");
|
||||
|
||||
textarea.setAttribute("autocomplete", "billing work email");
|
||||
assert_equals(textarea.autocomplete, "billing work email");
|
||||
|
||||
textarea.setAttribute("autocomplete", " section-FOO bday");
|
||||
assert_equals(textarea.autocomplete, "section-foo bday");
|
||||
}, "Serialize combinations of section, mode, contact, and field");
|
||||
|
||||
</script>
|
||||
|
|
|
@ -39,31 +39,31 @@ promise_test(t => {
|
|||
}).then(() => {
|
||||
const w = iframe.contentWindow;
|
||||
|
||||
assert_equals(w.sameOriginNone, 'not found',
|
||||
'Modules should be loaded without the credentials when the crossOrigin attribute is not specified and the target is same-origin');
|
||||
assert_equals(w.sameOriginNone, 'found',
|
||||
'Modules should be loaded with the credentials when the crossOrigin attribute is not specified and the target is same-origin');
|
||||
assert_equals(w.sameOriginAnonymous, 'found',
|
||||
'Modules should be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is same-origin');
|
||||
assert_equals(w.sameOriginUseCredentials, 'found',
|
||||
'Modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is same-origin');
|
||||
assert_equals(w.crossOriginNone, 'not found',
|
||||
'Modules should be loaded without the credentials when the crossOrigin attribute is not specified and the target is cross-origin');
|
||||
'Modules should not be loaded with the credentials when the crossOrigin attribute is not specified and the target is cross-origin');
|
||||
assert_equals(w.crossOriginAnonymous, 'not found',
|
||||
'Modules should be loaded without the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is cross-origin');
|
||||
'Modules should not be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is cross-origin');
|
||||
assert_equals(w.crossOriginUseCredentials, 'found',
|
||||
'Modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is cross-origin');
|
||||
|
||||
assert_equals(w.sameOriginNoneDecendent, 'not found',
|
||||
'Decendent modules should be loaded without the credentials when the crossOrigin attribute is not specified and the target is same-origin');
|
||||
assert_equals(w.sameOriginAnonymousDecendent, 'found',
|
||||
'Decendent modules should be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is same-origin');
|
||||
assert_equals(w.sameOriginUseCredentialsDecendent, 'found',
|
||||
'Decendent modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is same-origin');
|
||||
assert_equals(w.crossOriginNoneDecendent, 'not found',
|
||||
'Decendent modules should be loaded without the credentials when the crossOrigin attribute is not specified and the target is cross-origin');
|
||||
assert_equals(w.crossOriginAnonymousDecendent, 'not found',
|
||||
'Decendent modules should be loaded without the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is cross-origin');
|
||||
assert_equals(w.crossOriginUseCredentialsDecendent, 'found',
|
||||
'Decendent modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is cross-origin');
|
||||
assert_equals(w.sameOriginNoneDescendant, 'found',
|
||||
'Descendant modules should be loaded with the credentials when the crossOrigin attribute is not specified and the target is same-origin');
|
||||
assert_equals(w.sameOriginAnonymousDescendant, 'found',
|
||||
'Descendant modules should be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is same-origin');
|
||||
assert_equals(w.sameOriginUseCredentialsDescendant, 'found',
|
||||
'Descendant modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is same-origin');
|
||||
assert_equals(w.crossOriginNoneDescendant, 'not found',
|
||||
'Descendant modules should not be loaded with the credentials when the crossOrigin attribute is not specified and the target is cross-origin');
|
||||
assert_equals(w.crossOriginAnonymousDescendant, 'not found',
|
||||
'Descendant modules should not be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is cross-origin');
|
||||
assert_equals(w.crossOriginUseCredentialsDescendant, 'found',
|
||||
'Descendant modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is cross-origin');
|
||||
});
|
||||
}, 'Modules should be loaded with or without the credentials based on the same-origin-ness and the crossOrigin attribute');
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
host_info = get_host_info();
|
||||
|
||||
document.cookie = 'same=1';
|
||||
|
||||
const setCookiePromise = fetch(
|
||||
'http://{{domains[www2]}}:{{ports[http][0]}}/cookies/resources/set-cookie.py?name=cross&path=/html/semantics/scripting-1/the-script-element/module/',
|
||||
{
|
||||
mode: 'no-cors',
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
const windowLoadPromise = new Promise(resolve => {
|
||||
window.addEventListener('load', () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
promise_test(t => {
|
||||
const iframe = document.createElement('iframe');
|
||||
|
||||
return Promise.all([setCookiePromise, windowLoadPromise]).then(() => {
|
||||
const messagePromise = new Promise(resolve => {
|
||||
window.addEventListener('message', event => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
iframe.src = '../resources/dynamic-import-credentials-iframe.sub.html';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
return messagePromise;
|
||||
}).then(() => {
|
||||
const w = iframe.contentWindow;
|
||||
|
||||
assert_equals(w.sameOriginNoneDynamicDescendant, 'found',
|
||||
'Dynamic descendant modules should be loaded with the credentials when the crossOrigin attribute is not specified and the target is same-origin');
|
||||
assert_equals(w.sameOriginAnonymousDynamicDescendant, 'found',
|
||||
'Dynamic descendant modules should be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is same-origin');
|
||||
assert_equals(w.sameOriginUseCredentialsDynamicDescendant, 'found',
|
||||
'Dynamic descendant modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is same-origin');
|
||||
assert_equals(w.crossOriginNoneDynamicDescendant, 'not found',
|
||||
'Dynamic descendant modules should not be loaded with the credentials when the crossOrigin attribute is not specified and the target is cross-origin');
|
||||
assert_equals(w.crossOriginAnonymousDynamicDescendant, 'not found',
|
||||
'Dynamic descendant modules should not be loaded with the credentials when the crossOrigin attribute is specified with "anonymous" as its value and the target is cross-origin');
|
||||
assert_equals(w.crossOriginUseCredentialsDynamicDescendant, 'found',
|
||||
'Dynamic descendant modules should be loaded with the credentials when the crossOrigin attribute is specified with "use-credentials" as its value and the target is cross-origin');
|
||||
});
|
||||
}, 'Dynamic imports should be loaded with or without the credentials based on the same-origin-ness and the parent script\'s crossOrigin attribute');
|
||||
</script>
|
||||
<body>
|
||||
</body>
|
|
@ -25,22 +25,22 @@
|
|||
</script>
|
||||
|
||||
<script type="module">
|
||||
import "./check-cookie.py?id=sameOriginNoneDecendent&cookieName=same";
|
||||
import "./check-cookie.py?id=sameOriginNoneDescendant&cookieName=same";
|
||||
</script>
|
||||
<script type="module" crossOrigin="anonymous">
|
||||
import "./check-cookie.py?id=sameOriginAnonymousDecendent&cookieName=same";
|
||||
import "./check-cookie.py?id=sameOriginAnonymousDescendant&cookieName=same";
|
||||
</script>
|
||||
<script type="module" crossOrigin="use-credentials">
|
||||
import "./check-cookie.py?id=sameOriginUseCredentialsDecendent&cookieName=same";
|
||||
import "./check-cookie.py?id=sameOriginUseCredentialsDescendant&cookieName=same";
|
||||
</script>
|
||||
<script type="module">
|
||||
import "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginNoneDecendent&cookieName=cross";
|
||||
import "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginNoneDescendant&cookieName=cross";
|
||||
</script>
|
||||
<script type="module" crossOrigin="anonymous">
|
||||
import "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginAnonymousDecendent&cookieName=cross";
|
||||
import "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginAnonymousDescendant&cookieName=cross";
|
||||
</script>
|
||||
<script type="module" crossOrigin="use-credentials">
|
||||
import "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginUseCredentialsDecendent&cookieName=cross";
|
||||
import "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginUseCredentialsDescendant&cookieName=cross";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<script type="module">
|
||||
import("./check-cookie.py?id=sameOriginNoneDynamicDescendant&cookieName=same");
|
||||
</script>
|
||||
<script type="module" crossOrigin="anonymous">
|
||||
import("./check-cookie.py?id=sameOriginAnonymousDynamicDescendant&cookieName=same");
|
||||
</script>
|
||||
<script type="module" crossOrigin="use-credentials">
|
||||
import("./check-cookie.py?id=sameOriginUseCredentialsDynamicDescendant&cookieName=same");
|
||||
</script>
|
||||
<script type="module">
|
||||
import("http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginNoneDynamicDescendant&cookieName=cross");
|
||||
</script>
|
||||
<script type="module" crossOrigin="anonymous">
|
||||
import("http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginAnonymousDynamicDescendant&cookieName=cross");
|
||||
</script>
|
||||
<script type="module" crossOrigin="use-credentials">
|
||||
import("http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/check-cookie.py?id=crossOriginUseCredentialsDynamicDescendant&cookieName=cross");
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('load', event => {
|
||||
window.parent.postMessage({}, '*');
|
||||
});
|
||||
</script>
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>HTML Templates: ownerDocument property of the element in template</title>
|
||||
<meta name="timeout" content="long">
|
||||
<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<meta name="assert" content="ownerDocument property of the element appended to template must be set to the template contents owner of the ownerDocument of the template element">
|
||||
|
|
|
@ -655,6 +655,8 @@ CSS-COLLIDING-REF-NAME: css/vendor-imports/mozilla/mozilla-central-reftests/cont
|
|||
CSS-COLLIDING-REF-NAME: css/css-contain/reference/contain-size-grid-001-ref.html
|
||||
CSS-COLLIDING-REF-NAME: css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-grid-001-ref.html
|
||||
CSS-COLLIDING-SUPPORT-NAME: css/css-backgrounds/support/red.png
|
||||
CSS-COLLIDING-REF-NAME: css/css-contain/reference/contain-size-fieldset-001-ref.html
|
||||
CSS-COLLIDING-REF-NAME: css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-fieldset-001-ref.html
|
||||
CSS-COLLIDING-SUPPORT-NAME: css/compositing/mix-blend-mode/support/red.png
|
||||
CSS-COLLIDING-SUPPORT-NAME: css/compositing/background-blending/support/red.png
|
||||
CSS-COLLIDING-SUPPORT-NAME: css/CSS2/normal-flow/support/replaced-min-max-3.png
|
||||
|
|
|
@ -291,7 +291,8 @@ promise_test(t => {
|
|||
|
||||
async_test(t => {
|
||||
var validTypes = [ 'file', 'media-source' ];
|
||||
var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource' ];
|
||||
var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource',
|
||||
'record', 'transmission' ];
|
||||
|
||||
var validPromises = [];
|
||||
var invalidCaught = 0;
|
||||
|
|
|
@ -0,0 +1,328 @@
|
|||
<!DOCTYPE html>
|
||||
<title>MediaCapabilities.decodingInfo()</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
// Minimal VideoConfiguration that will be allowed per spec. All optional
|
||||
// properties are missing.
|
||||
var minimalVideoConfiguration = {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: 24,
|
||||
};
|
||||
|
||||
// Minimal AudioConfiguration that will be allowed per spec. All optional
|
||||
// properties are missing.
|
||||
var minimalAudioConfiguration = {
|
||||
contentType: 'audio/webm; codecs="opus"',
|
||||
};
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo());
|
||||
}, "Test that encodingInfo rejects if it doesn't get a configuration");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({}));
|
||||
}, "Test that encodingInfo rejects if the MediaConfiguration isn't valid");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
video: minimalVideoConfiguration,
|
||||
audio: minimalAudioConfiguration,
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the MediaConfiguration does not have a type");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the configuration doesn't have an audio or video field");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: -1,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration has a negative framerate");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: 0,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration has a framerate set to 0");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: Infinity,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration has a framerate set to Infinity");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'fgeoa',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: 24,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration contentType doesn't parse");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'audio/fgeoa',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: 24,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration contentType isn't of type video");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"; foo="bar"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: 24,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration contentType has more than one parameter");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; foo="bar"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: 24,
|
||||
},
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the video configuration contentType has one parameter that isn't codecs");
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '24000/1001',
|
||||
}
|
||||
});
|
||||
}, "Test that encodingInfo() accepts framerate in the form of x/y");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '24000/0',
|
||||
}
|
||||
}));
|
||||
}, "Test that encodingInfo() rejects framerate in the form of x/0");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '0/10001',
|
||||
}
|
||||
}));
|
||||
}, "Test that encodingInfo() rejects framerate in the form of 0/y");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '-24000/10001',
|
||||
}
|
||||
}));
|
||||
}, "Test that encodingInfo() rejects framerate in the form of -x/y");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '24000/-10001',
|
||||
}
|
||||
}));
|
||||
}, "Test that encodingInfo() rejects framerate in the form of x/-y");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '24000/',
|
||||
}
|
||||
}));
|
||||
}, "Test that encodingInfo() rejects framerate in the form of x/");
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '24000/1e4',
|
||||
}
|
||||
});
|
||||
}, "Test that encodingInfo() accepts framerate with 'e'");
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '24/1.0001',
|
||||
}
|
||||
});
|
||||
}, "Test that encodingInfo() accepts framerate as fraction with decimals");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: {
|
||||
contentType: 'video/webm; codecs="vp09.00.10.08"',
|
||||
width: 800,
|
||||
height: 600,
|
||||
bitrate: 3000,
|
||||
framerate: '1/3x',
|
||||
}
|
||||
}));
|
||||
}, "Test that encodingInfo() rejects framerate with trailing unallowed characters");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
audio: { contentType: 'fgeoa' },
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the audio configuration contenType doesn't parse");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
audio: { contentType: 'video/fgeoa' },
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the audio configuration contentType isn't of type audio");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
audio: { contentType: 'audio/webm; codecs="opus"; foo="bar"' },
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the audio configuration contentType has more than one parameters");
|
||||
|
||||
promise_test(t => {
|
||||
return promise_rejects(t, new TypeError(), navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
audio: { contentType: 'audio/webm; foo="bar"' },
|
||||
}));
|
||||
}, "Test that encodingInfo rejects if the audio configuration contentType has one parameter that isn't codecs");
|
||||
|
||||
promise_test(t => {
|
||||
return navigator.mediaCapabilities.encodingInfo({
|
||||
type: 'record',
|
||||
video: minimalVideoConfiguration,
|
||||
audio: minimalAudioConfiguration,
|
||||
}).then(ability => {
|
||||
assert_idl_attribute(ability, 'supported');
|
||||
assert_idl_attribute(ability, 'smooth');
|
||||
assert_idl_attribute(ability, 'powerEfficient');
|
||||
});
|
||||
}, "Test that encodingInfo returns a valid MediaCapabilitiesInfo objects");
|
||||
|
||||
async_test(t => {
|
||||
var validTypes = [ 'record', 'transmission' ];
|
||||
var invalidTypes = [ undefined, null, '', 'foobar', 'mse', 'MediaSource',
|
||||
'file', 'media-source', ];
|
||||
|
||||
var validPromises = [];
|
||||
var invalidCaught = 0;
|
||||
|
||||
validTypes.forEach(type => {
|
||||
validPromises.push(navigator.mediaCapabilities.encodingInfo({
|
||||
type: type,
|
||||
video: minimalVideoConfiguration,
|
||||
audio: minimalAudioConfiguration,
|
||||
}));
|
||||
});
|
||||
|
||||
// validTypes are tested via Promise.all(validPromises) because if one of the
|
||||
// promises fail, Promise.all() will reject. This mechanism can't be used for
|
||||
// invalid types which will be tested individually and increment invalidCaught
|
||||
// when rejected until the amount of rejection matches the expectation.
|
||||
Promise.all(validPromises).then(t.step_func(() => {
|
||||
for (var i = 0; i < invalidTypes.length; ++i) {
|
||||
navigator.mediaCapabilities.encodingInfo({
|
||||
type: invalidTypes[i],
|
||||
video: minimalVideoConfiguration,
|
||||
audio: minimalAudioConfiguration,
|
||||
}).then(t.unreached_func(), t.step_func(e => {
|
||||
assert_equals(e.name, 'TypeError');
|
||||
++invalidCaught;
|
||||
if (invalidCaught == invalidTypes.length)
|
||||
t.done();
|
||||
}));
|
||||
}
|
||||
}), t.unreached_func('Promise.all should not reject for valid types'));
|
||||
}, "Test that encodingInfo rejects if the MediaConfiguration does not have a valid type");
|
||||
|
||||
</script>
|
|
@ -13,7 +13,7 @@
|
|||
// mic/camera has been explicitly allowed by feature policy.
|
||||
function promise_factory(allowed_features) {
|
||||
return new Promise((resolve, reject) => {
|
||||
navigator.getUserMedia({video: true, audio: true}).then(
|
||||
navigator.mediaDevices.getUserMedia({video: true, audio: true}).then(
|
||||
function(stream) {
|
||||
// If microphone is allowed, there should be at least one microphone
|
||||
// in the result. If camera is allowed, there should be at least one
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Test domInteractive on image document.</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-media"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
const t = async_test("Test domInteractive on image document");
|
||||
function frameLoaded() {
|
||||
const timing = document.querySelector("iframe").contentWindow.performance.timing;
|
||||
assert_greater_than(timing.domInteractive, 0,
|
||||
"Expect domInteractive to be positive value.");
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This tests that a image document has positive-value domInteractive.</p>
|
||||
<iframe src="../images/smiley.png" onload="frameLoaded()"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Test domInteractive on media document.</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-media"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<script>
|
||||
const t = async_test("Test domInteractive on media document");
|
||||
function frameLoaded() {
|
||||
const timing = document.querySelector("iframe").contentWindow.performance.timing;
|
||||
assert_greater_than(timing.domInteractive, 0,
|
||||
"Expect domInteractive to be positive value.");
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This tests that a media document has positive-value domInteractive.</p>
|
||||
<iframe src="../media/A4.mp4" onload="frameLoaded()"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,149 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- Copyright © 2017 Mozilla and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
|
||||
<meta charset="utf-8">
|
||||
<title>Test for validity of payment method identifiers during construction</title>
|
||||
<link rel="help" href="https://w3c.github.io/browser-payment-api/#constructor">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
"use strict";
|
||||
const validAmount = Object.freeze({
|
||||
currency: "USD",
|
||||
value: "1.0",
|
||||
});
|
||||
const validTotal = Object.freeze({
|
||||
label: "Default Total",
|
||||
amount: validAmount,
|
||||
});
|
||||
const defaultDetails = Object.freeze({
|
||||
total: validTotal,
|
||||
});
|
||||
|
||||
test(() => {
|
||||
const validMethods = [
|
||||
"https://wpt",
|
||||
"https://wpt.fyi/",
|
||||
"https://wpt.fyi/payment",
|
||||
"https://wpt.fyi/payment-request",
|
||||
"https://wpt.fyi/payment-request?",
|
||||
"https://wpt.fyi/payment-request?this=is",
|
||||
"https://wpt.fyi/payment-request?this=is&totally",
|
||||
"https://wpt.fyi:443/payment-request?this=is&totally",
|
||||
"https://wpt.fyi:443/payment-request?this=is&totally#fine",
|
||||
"https://:@wpt.fyi:443/payment-request?this=is&totally#👍",
|
||||
" \thttps://wpt\n ",
|
||||
"https://xn--c1yn36f",
|
||||
"https://點看",
|
||||
];
|
||||
for (const validMethod of validMethods) {
|
||||
try {
|
||||
const methods = [{ supportedMethods: validMethod }];
|
||||
new PaymentRequest(methods, defaultDetails);
|
||||
} catch (err) {
|
||||
assert_unreached(
|
||||
`Unexpected exception with valid standardized PMI: ${validMethod}. ${err}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}, "Must support valid standard URL PMIs");
|
||||
|
||||
test(() => {
|
||||
const validMethods = [
|
||||
"e",
|
||||
"n6jzof05mk2g4lhxr-u-q-w1-c-i-pa-ty-bdvs9-ho-ae7-p-md8-s-wq3-h-qd-e-q-sa",
|
||||
"a-b-q-n-s-pw0",
|
||||
"m-u",
|
||||
"s-l5",
|
||||
"k9-f",
|
||||
"m-l",
|
||||
"u4-n-t",
|
||||
"i488jh6-g18-fck-yb-v7-i",
|
||||
"x-x-t-t-c34-o",
|
||||
"basic-card",
|
||||
// gets coerced to "basic-card", for compat with old version of spec
|
||||
["basic-card"],
|
||||
];
|
||||
for (const validMethod of validMethods) {
|
||||
try {
|
||||
const methods = [{ supportedMethods: validMethod }];
|
||||
new PaymentRequest(methods, defaultDetails);
|
||||
} catch (err) {
|
||||
assert_unreached(
|
||||
`Unexpected exception with valid standardized PMI: ${validMethod}. ${err}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}, "Must not throw on syntactically valid standardized payment method identifiers, even if they are not supported");
|
||||
|
||||
test(() => {
|
||||
const invalidMethods = [
|
||||
"basic-💳",
|
||||
"¡basic-*-card!",
|
||||
"Basic-Card",
|
||||
"0",
|
||||
"-",
|
||||
"--",
|
||||
"a--b",
|
||||
"-a--b",
|
||||
"a-b-",
|
||||
"0-",
|
||||
"0-a",
|
||||
"a0--",
|
||||
"A-",
|
||||
"A-B",
|
||||
"A-b",
|
||||
"a-0",
|
||||
"a-0b",
|
||||
" a-b",
|
||||
"\t\na-b",
|
||||
"a-b ",
|
||||
"a-b\n\t",
|
||||
"basic-card?not-really",
|
||||
"basic-card://not-ok",
|
||||
"basic card",
|
||||
"/basic card/",
|
||||
"BaSicCarD",
|
||||
"BASIC-CARD",
|
||||
" basic-card ",
|
||||
"this is not supported",
|
||||
" ",
|
||||
"foo,var",
|
||||
["visa","mastercard"], // stringifies to "visa,mastercard"
|
||||
];
|
||||
for (const invalidMethod of invalidMethods) {
|
||||
assert_throws(
|
||||
new RangeError(),
|
||||
() => {
|
||||
const methods = [{ supportedMethods: invalidMethod }];
|
||||
new PaymentRequest(methods, defaultDetails);
|
||||
},
|
||||
`expected RangeError processing invalid standardized PMI "${invalidMethod}"`
|
||||
);
|
||||
}
|
||||
}, "Must throw on syntactically invalid standardized payment method identifiers");
|
||||
|
||||
test(() => {
|
||||
const invalidMethods = [
|
||||
"https://username@example.com/pay",
|
||||
"https://:password@example.com/pay",
|
||||
"https://username:password@example.com/pay",
|
||||
"http://username:password@example.com/pay",
|
||||
"http://foo.com:100000000/pay",
|
||||
"not-https://wpt.fyi/payment-request",
|
||||
"../realitive/url",
|
||||
"/absolute/../path?",
|
||||
"https://",
|
||||
];
|
||||
for (const invalidMethod of invalidMethods) {
|
||||
assert_throws(
|
||||
new RangeError(),
|
||||
() => {
|
||||
const methods = [{ supportedMethods: invalidMethod }];
|
||||
new PaymentRequest(methods, defaultDetails);
|
||||
},
|
||||
`expected RangeError processing invalid URL PMI "${invalidMethod}"`
|
||||
);
|
||||
}
|
||||
}, "Constructor MUST throw if given an invalid URL-based payment method identifier");
|
||||
|
||||
</script>
|
|
@ -9,8 +9,8 @@
|
|||
<script>
|
||||
promise_test(async t => {
|
||||
const video = await loadVideo();
|
||||
return requestPictureInPictureWithTrustedClick(video);
|
||||
}, 'request Picture-in-Picture resolves on user click');
|
||||
return promise_rejects(t, 'NotAllowedError', video.requestPictureInPicture());
|
||||
}, 'request Picture-in-Picture requires a user gesture');
|
||||
|
||||
promise_test(t => {
|
||||
const video = document.createElement('video');
|
||||
|
@ -31,6 +31,6 @@ promise_test(async t => {
|
|||
|
||||
promise_test(async t => {
|
||||
const video = await loadVideo();
|
||||
return promise_rejects(t, 'NotAllowedError', video.requestPictureInPicture());
|
||||
}, 'request Picture-in-Picture requires a user gesture');
|
||||
return requestPictureInPictureWithTrustedClick(video);
|
||||
}, 'request Picture-in-Picture resolves on user click');
|
||||
</script>
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
These tests exercise differnt ways to load an image, generated via
|
||||
```/referrer-policy/generic/subresource/image.py?id=<UUID>``` and later
|
||||
verify the headers used to request that image.
|
||||
These tests exercise different ways to fetch a resource (image, font-face, svg
|
||||
references), generated via the sub-resource python script in
|
||||
```./generic/subresource/``` (for example, loading an image:
|
||||
```/referrer-policy/generic/subresource/image.py?id=<UUID>```) and later verify
|
||||
the headers used to fetch the resource.
|
||||
|
||||
Since there is no way to wait for a resource referenced from CSS to be loaded,
|
||||
all tests use ```step_timeout()``` to delay the verification step until
|
||||
after the image (hopefully) was loaded.
|
||||
after the resource (hopefully) was loaded.
|
||||
|
||||
Since there is also no way to retrieve headers (or other information) from
|
||||
images loaded via CSS, we store the headers with the given ```UUID``` as key
|
||||
on the server, and retrieve them later via an XHR to
|
||||
resources loaded via CSS, we store the headers with the given ```UUID``` as key
|
||||
on the server, and retrieve them later via an XHR, for example:
|
||||
```/referrer-policy/generic/subresource/image.py?id=<UUID>&report-headers```.
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Child css from external stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that child css are loaded with the referrer and referrer policy
|
||||
from the external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Child css from external stylesheet.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&import-rule" + "&referrer-policy=no-referrer";
|
||||
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let link = document.createElement("link");
|
||||
link.href = css_url;
|
||||
link.rel = "stylesheet";
|
||||
link.onload = function() {
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_equals(message.referrer, undefined);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Child css from internal stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that child css are loaded with the referrer and referrer policy
|
||||
from the internal stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Child css from internal stylesheet.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule";
|
||||
let check_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let style = document.createElement("style");
|
||||
style.type = 'text/css';
|
||||
style.appendChild(document.createTextNode("@import url('" + css_url + "');"));
|
||||
document.head.appendChild(style);
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_url);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - child css via a ProcessingInstruction</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that child css are loaded with the referrer and referrer policy the
|
||||
external stylesheet(referenced from a ProcessingInstruction).</p>
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Child css via a ProcessingInstruction.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
|
||||
id;
|
||||
let css_url = url_prefix + "&import-rule";
|
||||
let expected = url_prefix + "&import-rule";
|
||||
let check_url = url_prefix + "&report-headers";
|
||||
|
||||
let processingInstruction =
|
||||
document.createProcessingInstruction(
|
||||
"xml-stylesheet", "href=\"" +css_url + "\" type=\"text/css\"");
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, expected);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
document.insertBefore(processingInstruction, document.firstChild);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,66 @@
|
|||
var svg_ns = "http://www.w3.org/2000/svg";
|
||||
var url_prefix = location.protocol + "//" + location.hostname + ":" +
|
||||
location.port + "/referrer-policy/generic/subresource/";
|
||||
|
||||
var svg_test_properties = [
|
||||
'fill',
|
||||
'stroke',
|
||||
'filter',
|
||||
'clip-path',
|
||||
'marker-start',
|
||||
'marker-mid',
|
||||
'marker-end',
|
||||
'mask',
|
||||
'mask-image',
|
||||
];
|
||||
|
||||
// Schedules async_test's for each of the test properties
|
||||
// Parameters:
|
||||
// testProperties: An array of test properties.
|
||||
// testDescription: A test description
|
||||
// testFunction: A function call which sets up the expect result and runs
|
||||
// the actual test
|
||||
function runSvgTests(testProperties, testDescription, testFunction) {
|
||||
let runNextTest = function () {
|
||||
let property = testProperties.shift();
|
||||
if (property === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
let current = {
|
||||
test: async_test(testDescription + " " + property),
|
||||
id: token(),
|
||||
property: property,
|
||||
};
|
||||
|
||||
testFunction(current);
|
||||
|
||||
let check_url = url_prefix + "svg.py" + "?id=" + current.id +
|
||||
"&report-headers";
|
||||
current.test.step_timeout(
|
||||
queryXhr.bind(this, check_url,
|
||||
function(message) {
|
||||
current.test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, current.expected);
|
||||
});
|
||||
current.test.done();
|
||||
}),
|
||||
800);
|
||||
|
||||
};
|
||||
|
||||
add_result_callback(runNextTest);
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function createSvg() {
|
||||
let svg = document.createElementNS(svg_ns, 'svg');
|
||||
svg.setAttribute('width', '400');
|
||||
svg.setAttribute('height', '400');
|
||||
let path = document.createElementNS(svg_ns, 'path');
|
||||
path.setAttribute('d', 'M 50,5 95,100 5,100 z');
|
||||
svg.appendChild(path);
|
||||
return svg;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from imported stylesheet (external)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from imported stylesheets (loaded from external
|
||||
stylesheets) are loaded with the referrer and referrer policy from the
|
||||
external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from imported stylesheet (external).");
|
||||
let id = token();
|
||||
let css_url = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&import-rule" + "&type=font";
|
||||
let url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
|
||||
let css_referrer = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
|
||||
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
|
||||
"?id=" + id + "&report-headers" + "&type=font";
|
||||
|
||||
let link = document.createElement("link");
|
||||
link.href = css_url;
|
||||
link.rel = "stylesheet";
|
||||
link.onload = function() {
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_referrer);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from external stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets are loaded with
|
||||
the referrer and referrer policy from the external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from external stylesheet.");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&type=font";
|
||||
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let link = document.createElement("link");
|
||||
link.href = css_url;
|
||||
link.rel = "stylesheet";
|
||||
link.onload = function() {
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_url);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
};
|
||||
document.head.appendChild(link);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from imported stylesheet (internal)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from stylesheets (imported from internal
|
||||
stylesheets) are loaded with the referrer and referrer policy from from the
|
||||
imported style sheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from imported stylesheet (internal).");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port + "/referrer-policy/generic/subresource/";
|
||||
let css_url = url_prefix + "stylesheet.py?id=" + id + "&type=font";
|
||||
let font_url = url_prefix + "font.py?report-headers&id=" + id;
|
||||
|
||||
let style = document.createElement("style");
|
||||
style.textContent = "@import url('" + css_url + "');";
|
||||
document.head.appendChild(style);
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, css_url);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from internal stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from internal stylesheets are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from internal stylesheet.");
|
||||
let id = token();
|
||||
let css_url = location.protocol + "//www1." + location.hostname + ":" +
|
||||
location.port +
|
||||
"/referrer-policy/generic/subresource/font.py" + "?id=" +
|
||||
id + "&type=font";
|
||||
let font_url = css_url + "&report-headers";
|
||||
|
||||
let style = document.createElement("style");
|
||||
style.textContent = "@font-face { font-family: 'wpt'; font-style: normal; font-weight: normal; src: url(" + css_url + "); format('truetype'); } body { font-family: 'wpt';}";
|
||||
document.head.appendChild(style);
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, location.origin + "/");
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - Font from external stylesheet inserted via a ProcessingInstruction</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets (referenced from a
|
||||
ProcessingInstruction) are loaded with the referrer and referrer policy
|
||||
from the external stylesheet.</p>
|
||||
|
||||
<div class="styled"></div>
|
||||
|
||||
<script>
|
||||
let css_test = async_test("Font from external stylesheet (from ProcessingInstruction).");
|
||||
let id = token();
|
||||
let url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
let css_url = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
|
||||
id + "&type=font";
|
||||
let expected = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" +
|
||||
id + "&type=font";
|
||||
let font_url = url_prefix + "/referrer-policy/generic/subresource/font.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
||||
let processingInstruction =
|
||||
document.createProcessingInstruction(
|
||||
"xml-stylesheet", "href=\"" + css_url + "\" type=\"text/css\"");
|
||||
css_test.step_timeout(
|
||||
queryXhr.bind(this, font_url,
|
||||
function(message) {
|
||||
css_test.step(function() {
|
||||
assert_own_property(message, "headers");
|
||||
assert_own_property(message, "referrer");
|
||||
assert_equals(message.referrer, expected);
|
||||
});
|
||||
css_test.done();
|
||||
}),
|
||||
1000);
|
||||
document.insertBefore(processingInstruction, document.firstChild);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -19,10 +19,13 @@
|
|||
<script>
|
||||
var css_test = async_test("Image from imported stylesheet (external).");
|
||||
var id = token();
|
||||
var cross_origin_url_prefix = location.protocol + "//www1." + location.hostname + ":" + location.port;
|
||||
var css_url = cross_origin_url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id + "&import-rule";
|
||||
var css_url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&import-rule" + "&type=image";
|
||||
var url_prefix = location.protocol + "//" + location.hostname + ":" + location.port;
|
||||
var css_referrer = url_prefix + "/referrer-policy/generic/subresource/stylesheet.py?id=" + id;
|
||||
var css_referrer = url_prefix +
|
||||
"/referrer-policy/generic/subresource/stylesheet.py?id=" + id +
|
||||
"&type=image";
|
||||
var img_url = url_prefix + "/referrer-policy/generic/subresource/image.py" +
|
||||
"?id=" + id + "&report-headers";
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from external stylesheet</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="never">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets are loaded with
|
||||
the referrer and referrer policy from the external stylesheet.</p>
|
||||
|
||||
<script>
|
||||
function addLinkStyleSheet(test) {
|
||||
let css_url = url_prefix + "stylesheet.py?id=" + test.id +
|
||||
"&type=svg" + "&property=" + test.property;
|
||||
test.expected = css_url;
|
||||
|
||||
let stylesheet =
|
||||
document.createElementNS("http://www.w3.org/1999/xhtml", "link");
|
||||
stylesheet.setAttribute("type", "text/css");
|
||||
stylesheet.setAttribute("rel", "stylesheet");
|
||||
stylesheet.setAttribute("href", css_url);
|
||||
let svg = createSvg();
|
||||
document.body.appendChild(svg);
|
||||
svg.appendChild(stylesheet);
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Test styling SVG from external style",
|
||||
addLinkStyleSheet);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from inline style</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from inline styles are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
<script>
|
||||
function setInlineStyle(test)
|
||||
{
|
||||
test.expected = location.origin + "/";
|
||||
let svg = createSvg();
|
||||
document.body.appendChild(svg);
|
||||
let element = svg.getElementsByTagName('path')[0];
|
||||
element.style = test.property + ": url(" + url_prefix + "svg.py?id=" +
|
||||
test.id + "#invalidFragment);";
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Styling SVG from inline styles",
|
||||
setInlineStyle);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from internal style</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from internal styles are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
<script>
|
||||
function setInternalStyle(test) {
|
||||
test.expected = location.origin + "/";
|
||||
let style = document.createElementNS(svg_ns, "style");
|
||||
style.textContent = "path { " + test.property + ": url(" + url_prefix +
|
||||
"svg.py?id=" + test.id + "#invalidFragment);";
|
||||
let svg = createSvg();
|
||||
svg.appendChild(style);
|
||||
document.body.appendChild(svg);
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Styling SVG from internal styles",
|
||||
setInternalStyle);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from external stylesheet from
|
||||
presentation attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from presentation attributes are loaded with
|
||||
the referrer and referrer policy from the document.</p>
|
||||
<script>
|
||||
function setPresentationAttribute(test)
|
||||
{
|
||||
test.expected = location.origin + "/";
|
||||
let svg = createSvg();
|
||||
document.body.appendChild(svg);
|
||||
let element = svg.getElementsByTagName("path")[0];
|
||||
// The test property should have map 1:1 with presentation attribute.
|
||||
let attr = test.property;
|
||||
element.setAttribute(attr, "url(" + url_prefix + "svg.py?id=" +
|
||||
test.id + "#invalidFragment)");
|
||||
}
|
||||
|
||||
// mask-image is not the presentation attribute.
|
||||
runSvgTests(svg_test_properties.filter(p => p != 'mask-image'),
|
||||
"Styling SVG from presentation attributes",
|
||||
setPresentationAttribute);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS integration - styling SVG from external stylesheet via
|
||||
ProcessingInstruction</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<!-- Common global functions for referrer-policy tests. -->
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
<!-- Helper functions for referrer-policy css tests. -->
|
||||
<script src="/referrer-policy/css-integration/css-test-helper.js"></script>
|
||||
<meta name="referrer" content="origin">
|
||||
</head>
|
||||
<body>
|
||||
<p>Check that resources from external stylesheets (referenced from a
|
||||
ProcessingInstruction) are loaded with the referrer and referrer policy
|
||||
from the external stylesheet.</p>
|
||||
<script>
|
||||
function addProcessingInstruction(test) {
|
||||
let svg_url = url_prefix + "svg.py?id=" + test.id + "&type=svg" +
|
||||
"&property=" + test.property + "&embedded-svg";
|
||||
let iframe = document.createElement("iframe");
|
||||
test.expected = url_prefix + "stylesheet.py?id=" + test.id +
|
||||
"&type=svg" + "&property=" + test.property;
|
||||
iframe.src = svg_url;
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
runSvgTests(svg_test_properties,
|
||||
"Styling SVG from ProcessingInstruction",
|
||||
addProcessingInstruction);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
import os, sys, json, base64
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import subresource
|
||||
|
||||
def generate_payload(request, server_data):
|
||||
data = ('{"headers": %(headers)s}') % server_data
|
||||
if "id" in request.GET:
|
||||
request.server.stash.put(request.GET["id"], data)
|
||||
# Simple base64 encoded .tff font
|
||||
return base64.decodestring("AAEAAAANAIAAAwBQRkZUTU6u6MkAAAXcAAAAHE9TLzJWYW"
|
||||
"QKAAABWAAAAFZjbWFwAA8D7wAAAcAAAAFCY3Z0IAAhAnkA"
|
||||
"AAMEAAAABGdhc3D//wADAAAF1AAAAAhnbHlmCC6aTwAAAx"
|
||||
"QAAACMaGVhZO8ooBcAAADcAAAANmhoZWEIkAV9AAABFAAA"
|
||||
"ACRobXR4EZQAhQAAAbAAAAAQbG9jYQBwAFQAAAMIAAAACm"
|
||||
"1heHAASQA9AAABOAAAACBuYW1lehAVOgAAA6AAAAIHcG9z"
|
||||
"dP+uADUAAAWoAAAAKgABAAAAAQAAMhPyuV8PPPUACwPoAA"
|
||||
"AAAMU4Lm0AAAAAxTgubQAh/5wFeAK8AAAACAACAAAAAAAA"
|
||||
"AAEAAAK8/5wAWgXcAAAAAAV4AAEAAAAAAAAAAAAAAAAAAA"
|
||||
"AEAAEAAAAEAAwAAwAAAAAAAgAAAAEAAQAAAEAALgAAAAAA"
|
||||
"AQXcAfQABQAAAooCvAAAAIwCigK8AAAB4AAxAQIAAAIABg"
|
||||
"kAAAAAAAAAAAABAAAAAAAAAAAAAAAAUGZFZABAAEEAQQMg"
|
||||
"/zgAWgK8AGQAAAABAAAAAAAABdwAIQAAAAAF3AAABdwAZA"
|
||||
"AAAAMAAAADAAAAHAABAAAAAAA8AAMAAQAAABwABAAgAAAA"
|
||||
"BAAEAAEAAABB//8AAABB////wgABAAAAAAAAAQYAAAEAAA"
|
||||
"AAAAAAAQIAAAACAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAhAnkAAAAqACoAKgBGAAAAAgAhAA"
|
||||
"ABKgKaAAMABwAusQEALzyyBwQA7TKxBgXcPLIDAgDtMgCx"
|
||||
"AwAvPLIFBADtMrIHBgH8PLIBAgDtMjMRIREnMxEjIQEJ6M"
|
||||
"fHApr9ZiECWAAAAwBk/5wFeAK8AAMABwALAAABNSEVATUh"
|
||||
"FQE1IRUB9AH0/UQDhPu0BRQB9MjI/tTIyP7UyMgAAAAAAA"
|
||||
"4ArgABAAAAAAAAACYATgABAAAAAAABAAUAgQABAAAAAAAC"
|
||||
"AAYAlQABAAAAAAADACEA4AABAAAAAAAEAAUBDgABAAAAAA"
|
||||
"AFABABNgABAAAAAAAGAAUBUwADAAEECQAAAEwAAAADAAEE"
|
||||
"CQABAAoAdQADAAEECQACAAwAhwADAAEECQADAEIAnAADAA"
|
||||
"EECQAEAAoBAgADAAEECQAFACABFAADAAEECQAGAAoBRwBD"
|
||||
"AG8AcAB5AHIAaQBnAGgAdAAgACgAYwApACAAMgAwADAAOA"
|
||||
"AgAE0AbwB6AGkAbABsAGEAIABDAG8AcgBwAG8AcgBhAHQA"
|
||||
"aQBvAG4AAENvcHlyaWdodCAoYykgMjAwOCBNb3ppbGxhIE"
|
||||
"NvcnBvcmF0aW9uAABNAGEAcgBrAEEAAE1hcmtBAABNAGUA"
|
||||
"ZABpAHUAbQAATWVkaXVtAABGAG8AbgB0AEYAbwByAGcAZQ"
|
||||
"AgADIALgAwACAAOgAgAE0AYQByAGsAQQAgADoAIAA1AC0A"
|
||||
"MQAxAC0AMgAwADAAOAAARm9udEZvcmdlIDIuMCA6IE1hcm"
|
||||
"tBIDogNS0xMS0yMDA4AABNAGEAcgBrAEEAAE1hcmtBAABW"
|
||||
"AGUAcgBzAGkAbwBuACAAMAAwADEALgAwADAAMAAgAABWZX"
|
||||
"JzaW9uIDAwMS4wMDAgAABNAGEAcgBrAEEAAE1hcmtBAAAA"
|
||||
"AgAAAAAAAP+DADIAAAABAAAAAAAAAAAAAAAAAAAAAAAEAA"
|
||||
"AAAQACACQAAAAAAAH//wACAAAAAQAAAADEPovuAAAAAMU4"
|
||||
"Lm0AAAAAxTgubQ==");
|
||||
|
||||
def generate_report_headers_payload(request, server_data):
|
||||
stashed_data = request.server.stash.take(request.GET["id"])
|
||||
return stashed_data
|
||||
|
||||
def main(request, response):
|
||||
handler = lambda data: generate_payload(request, data)
|
||||
content_type = 'application/x-font-truetype'
|
||||
|
||||
if "report-headers" in request.GET:
|
||||
handler = lambda data: generate_report_headers_payload(request, data)
|
||||
content_type = 'application/json'
|
||||
|
||||
subresource.respond(request,
|
||||
response,
|
||||
payload_generator = handler,
|
||||
content_type = content_type,
|
||||
access_control_allow_origin = "*")
|
|
@ -3,24 +3,66 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|||
import subresource
|
||||
|
||||
def generate_payload(request, server_data):
|
||||
return subresource.get_template("stylesheet.css.template") % {"id": request.GET["id"]}
|
||||
data = ('{"headers": %(headers)s}') % server_data
|
||||
type = 'image'
|
||||
if "type" in request.GET:
|
||||
type = request.GET["type"]
|
||||
|
||||
if "id" in request.GET:
|
||||
request.server.stash.put(request.GET["id"], data)
|
||||
|
||||
if type == 'image':
|
||||
return subresource.get_template("image.css.template") % {"id": request.GET["id"]}
|
||||
|
||||
elif type == 'font':
|
||||
return subresource.get_template("font.css.template") % {"id": request.GET["id"]}
|
||||
|
||||
elif type == 'svg':
|
||||
return subresource.get_template("svg.css.template") % {
|
||||
"id": request.GET["id"],
|
||||
"property": request.GET["property"]}
|
||||
|
||||
def generate_import_rule(request, server_data):
|
||||
data = "@import url('%(url)s?id=%(id)s');" % {
|
||||
type = 'image'
|
||||
property = None;
|
||||
if "type" in request.GET:
|
||||
type = request.GET["type"]
|
||||
if type == "svg" and "property" in request.GET:
|
||||
property = request.GET["property"]
|
||||
if property is None:
|
||||
return "@import url('%(url)s?id=%(id)s&type=%(type)s');" % {
|
||||
"id": request.GET["id"],
|
||||
"url": subresource.create_redirect_url(request, cross_origin = True),
|
||||
"type": type
|
||||
}
|
||||
return "@import url('%(url)s?id=%(id)s&type=%(type)s&property=%(property)s');" % {
|
||||
"id": request.GET["id"],
|
||||
"url": subresource.create_redirect_url(request, cross_origin = True)
|
||||
"url": subresource.create_redirect_url(request, cross_origin = True),
|
||||
"type": type,
|
||||
"property": property
|
||||
}
|
||||
return data
|
||||
|
||||
def generate_report_headers_payload(request, server_data):
|
||||
stashed_data = request.server.stash.take(request.GET["id"])
|
||||
return stashed_data
|
||||
|
||||
def main(request, response):
|
||||
payload_generator = lambda data: generate_payload(request, data)
|
||||
content_type = "text/css"
|
||||
referrer_policy = "unsafe-url"
|
||||
if "import-rule" in request.GET:
|
||||
payload_generator = lambda data: generate_import_rule(request, data)
|
||||
|
||||
if "report-headers" in request.GET:
|
||||
payload_generator = lambda data: generate_report_headers_payload(request, data)
|
||||
content_type = 'application/json'
|
||||
|
||||
if "referrer-policy" in request.GET:
|
||||
referrer_policy = request.GET["referrer-policy"]
|
||||
|
||||
subresource.respond(
|
||||
request,
|
||||
response,
|
||||
payload_generator = payload_generator,
|
||||
content_type = "text/css",
|
||||
maybe_additional_headers = { "Referrer-Policy": "unsafe-url" })
|
||||
|
||||
content_type = content_type,
|
||||
maybe_additional_headers = { "Referrer-Policy": referrer_policy })
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import os, sys, json
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
import subresource
|
||||
|
||||
def generate_payload(request, server_data):
|
||||
data = ('{"headers": %(headers)s}') % server_data
|
||||
if "id" in request.GET:
|
||||
with request.server.stash.lock:
|
||||
request.server.stash.take(request.GET["id"])
|
||||
request.server.stash.put(request.GET["id"], data)
|
||||
return "<svg xmlns='http://www.w3.org/2000/svg'></svg>";
|
||||
|
||||
def generate_payload_embedded(request, server_data):
|
||||
return subresource.get_template("svg.embedded.template") % {
|
||||
"id": request.GET["id"],
|
||||
"property": request.GET["property"]};
|
||||
|
||||
def generate_report_headers_payload(request, server_data):
|
||||
stashed_data = request.server.stash.take(request.GET["id"])
|
||||
return stashed_data
|
||||
|
||||
def main(request, response):
|
||||
handler = lambda data: generate_payload(request, data)
|
||||
content_type = 'image/svg+xml'
|
||||
|
||||
if "embedded-svg" in request.GET:
|
||||
handler = lambda data: generate_payload_embedded(request, data)
|
||||
|
||||
if "report-headers" in request.GET:
|
||||
handler = lambda data: generate_report_headers_payload(request, data)
|
||||
content_type = 'application/json'
|
||||
|
||||
subresource.respond(request,
|
||||
response,
|
||||
payload_generator = handler,
|
||||
content_type = content_type)
|
|
@ -0,0 +1,9 @@
|
|||
@font-face {
|
||||
font-family: 'wpt';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: url(/referrer-policy/generic/subresource/font.py?id=%(id)s) format('truetype');
|
||||
}
|
||||
body {
|
||||
font-family: 'wpt';
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
path {
|
||||
%(property)s: url(/referrer-policy/generic/subresource/svg.py?id=%(id)s#invalidFragment);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version='1.0' standalone='no'?>
|
||||
<?xml-stylesheet href='stylesheet.py?id=%(id)s&type=svg&property=%(property)s' type='text/css'?>
|
||||
<svg xmlns='http://www.w3.org/2000/svg'>
|
||||
<path d='M 50,5 95,100 5,100 z' />
|
||||
</svg>
|
After Width: | Height: | Size: 228 B |
|
@ -17,22 +17,22 @@ def main(request, response):
|
|||
# case-sensitive match for origin, pass
|
||||
response.headers.set('Timing-Allow-Origin', origin)
|
||||
elif tao == 'space':
|
||||
# space seperated list of origin and wildcard, fail
|
||||
# space separated list of origin and wildcard, fail
|
||||
response.headers.set('Timing-Allow-Origin', (origin + ' *'))
|
||||
elif tao == 'multi':
|
||||
# more than one TAO values, seperated by comma, pass
|
||||
# more than one TAO values, separated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', origin)
|
||||
response.headers.append('Timing-Allow-Origin', '*')
|
||||
elif tao == 'multi_wildcard':
|
||||
# multiple wildcards, seperated by comma, pass
|
||||
# multiple wildcards, separated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', '*')
|
||||
response.headers.append('Timing-Allow-Origin', '*')
|
||||
elif tao == 'match_origin':
|
||||
# contains a match of origin, seperated by comma, pass
|
||||
# contains a match of origin, separated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', origin)
|
||||
response.headers.append('Timing-Allow-Origin', "fake")
|
||||
elif tao == 'match_wildcard':
|
||||
# contains a wildcard, seperated by comma, pass
|
||||
# contains a wildcard, separated by comma, pass
|
||||
response.headers.set('Timing-Allow-Origin', "fake")
|
||||
response.headers.append('Timing-Allow-Origin', '*')
|
||||
elif tao == 'uppercase':
|
||||
|
|
|
@ -2,11 +2,12 @@ import io
|
|||
import json
|
||||
import os
|
||||
import ssl
|
||||
import urllib2
|
||||
|
||||
import html5lib
|
||||
import pytest
|
||||
from selenium import webdriver
|
||||
from six import text_type
|
||||
from six.moves import urllib
|
||||
|
||||
from wptserver import WPTServer
|
||||
|
||||
|
@ -63,8 +64,8 @@ class HTMLItem(pytest.Item, pytest.Collector):
|
|||
# Some tests are reliant on the WPT servers substitution functionality,
|
||||
# so tests must be retrieved from the server rather than read from the
|
||||
# file system directly.
|
||||
handle = urllib2.urlopen(self.url,
|
||||
context=parent.session.config.ssl_context)
|
||||
handle = urllib.request.urlopen(self.url,
|
||||
context=parent.session.config.ssl_context)
|
||||
try:
|
||||
markup = handle.read()
|
||||
finally:
|
||||
|
@ -87,7 +88,7 @@ class HTMLItem(pytest.Item, pytest.Collector):
|
|||
continue
|
||||
if element.tag == 'script':
|
||||
if element.attrib.get('id') == 'expected':
|
||||
self.expected = json.loads(unicode(element.text))
|
||||
self.expected = json.loads(text_type(element.text))
|
||||
|
||||
src = element.attrib.get('src', '')
|
||||
|
||||
|
@ -186,7 +187,7 @@ class HTMLItem(pytest.Item, pytest.Collector):
|
|||
@staticmethod
|
||||
def _assert_sequence(nums):
|
||||
if nums and len(nums) > 0:
|
||||
assert nums == range(1, nums[-1] + 1)
|
||||
assert nums == list(range(1, nums[-1] + 1))
|
||||
|
||||
@staticmethod
|
||||
def _scrub_stack(test_obj):
|
||||
|
|
|
@ -147,8 +147,8 @@
|
|||
var A = function(){this.a = "a"}
|
||||
A.prototype = {b:"b"}
|
||||
var a = new A();
|
||||
assert_exists(a, "a");
|
||||
assert_not_exists(a, "b");
|
||||
assert_own_property(a, "a");
|
||||
assert_false(a.hasOwnProperty("b"), "unexpected property found: \"b\"");
|
||||
assert_inherits(a, "b");
|
||||
}
|
||||
test(testAssertInherits, "test for assert[_not]_exists and insert_inherits")
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Log insertion</title>
|
||||
<meta name="variant" content="">
|
||||
<meta name="variant" content="?keep-promise">
|
||||
<script src="../../variants.js"></script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
window.onload = t.step_func_done(function() {
|
||||
var body = document.body;
|
||||
assert_not_equals(body, null);
|
||||
|
||||
var log = document.getElementById("log");
|
||||
assert_equals(log.parentNode, body);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/json" id="expected">
|
||||
{
|
||||
"summarized_status": {
|
||||
"status_string": "OK",
|
||||
"message": null
|
||||
},
|
||||
"summarized_tests": [{
|
||||
"status_string": "PASS",
|
||||
"name": "Log insertion",
|
||||
"message": null,
|
||||
"properties": {}
|
||||
}],
|
||||
"type": "complete"
|
||||
}
|
||||
</script>
|
|
@ -1,6 +1,6 @@
|
|||
[tox]
|
||||
# wptserve etc. are Python2-only.
|
||||
envlist = py27
|
||||
# Note that only py27 is run in CI.
|
||||
envlist = py27,py36
|
||||
skipsdist=True
|
||||
|
||||
[testenv]
|
||||
|
@ -11,6 +11,7 @@ deps =
|
|||
pytest>=2.9
|
||||
pyvirtualdisplay
|
||||
selenium
|
||||
six
|
||||
requests
|
||||
|
||||
commands = pytest {posargs} -vv tests
|
||||
|
|
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