Update web-platform-tests to revision a806d658df3bcc3f05675ad8d08a6e109177c6b0

This commit is contained in:
WPT Sync Bot 2018-09-05 21:34:01 -04:00
parent af777fcf15
commit 23dfe7c81e
155 changed files with 2487 additions and 546 deletions

View file

@ -7,7 +7,7 @@
<title>blob-urls-do-not-match-self</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src"]'></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src-elem"]'></script>
<script src='../support/alertAssert.sub.js?alerts=[]'></script>
</head>

View file

@ -12,7 +12,7 @@
<title>default-src-inline-blocked</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src","violated-directive=script-src"]'></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src-elem","violated-directive=script-src-elem"]'></script>
<script src='../support/alertAssert.sub.js?alerts=[]'></script>
</head>

View file

@ -7,7 +7,7 @@
<title>filesystem-urls-do-not-match-self</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src"]'></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src-elem"]'></script>
<script src="../support/alertAssert.sub.js?alerts=[]"></script>
</head>
@ -19,7 +19,7 @@
window.addEventListener('securitypolicyviolation', function(e) {
log("violated-directive=" + e.violatedDirective);
});
if(!window.webkitRequestFileSystem) {
t_log = async_test();
t_log.set_status(t_log.NOTRUN, "No filesystem:// support, cannot run test.");

View file

@ -16,9 +16,9 @@
var scriptsrc2 = async_test("Verify cascading of default-src to script-src policy: allow");
var allowedScriptRan = false;
var t_spv = async_test("Should fire violation events for every failed violation");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
</script>

View file

@ -2,16 +2,16 @@
<html>
<head>
<title>implicit port number matching fails with a different port</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' www.{{host}} 'unsafe-inline';">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' www.{{host}} 'unsafe-inline';">
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='negativeTests.js'></script>
<script>
var t_spv = async_test("Should fire violation events for every failed violation");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';

View file

@ -9,9 +9,9 @@
<script>
var t_spv = async_test("Should fire violation events for every failed violation");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';

View file

@ -9,9 +9,9 @@
<script>
var t_spv = async_test("Should fire violation events for every failed violation");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';

View file

@ -9,9 +9,9 @@
<script>
var t_spv = async_test("Should fire violation events for every failed violation");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';

View file

@ -7,7 +7,7 @@
<title>combine-header-and-meta-policies</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["TEST COMPLETE", "violated-directive=img-src", "violated-directive=style-src"]'></script>
<script src='../support/logTest.sub.js?logs=["TEST COMPLETE", "violated-directive=img-src", "violated-directive=style-src-elem"]'></script>
<script src="../support/alertAssert.sub.js?alerts=[]"></script>
<!-- enforcing multiple policies:
Content-Security-Policy: script-src 'self' 'unsafe-inline'; connect-src 'self'; style-src 'self'
@ -23,7 +23,7 @@ Content-Security-Policy: img-src 'none'
window.addEventListener('securitypolicyviolation', function(e) {
log("violated-directive=" + e.violatedDirective);
});
var img = document.createElement('img');
img.src = '../support/fail.png';
img.onerror = function() {

View file

@ -13,7 +13,7 @@
if (e.target != element)
return;
assert_equals(e.blockedURI, "inline");
assert_equals(e.effectiveDirective, "script-src");
assert_equals(e.effectiveDirective, "script-src-elem");
assert_equals(element.contentDocument.body.innerText, "", "Ensure that 'Fail' doesn't appear in the child document.");
element.remove();
test.done();
@ -36,7 +36,7 @@
var i = document.createElement("iframe");
i.src = "javascript:'Fail.'";
assert_csp_event_for_element(t, i);
assert_csp_event_for_element(t, i);
document.body.appendChild(i);
}, "<iframe src='javascript:'> blocked without 'unsafe-inline'.");
@ -44,7 +44,7 @@
async_test(t => {
var i = document.createElement("iframe");
assert_csp_event_for_element(t, i);
assert_csp_event_for_element(t, i);
navigate_to_javascript_onload(t, i);
document.body.appendChild(i);
@ -54,17 +54,17 @@
var i = document.createElement("iframe");
i.src = "../support/echo-policy.py?policy=" + encodeURIComponent("script-src 'unsafe-inline'");
assert_csp_event_for_element(t, i);
assert_csp_event_for_element(t, i);
navigate_to_javascript_onload(t, i);
document.body.appendChild(i);
}, "<iframe src='...'> with 'unsafe-inline' navigated to 'javascript:' blocked in this document");
async_test(t => {
var i = document.createElement("iframe");
i.src = "../support/echo-policy.py?policy=" + encodeURIComponent("script-src 'none'");
assert_csp_event_for_element(t, i);
assert_csp_event_for_element(t, i);
navigate_to_javascript_onload(t, i);
document.body.appendChild(i);

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-attr 'unsafe-inline';
script-src 'nonce-abc';">
<script nonce='abc' src="/resources/testharness.js"></script>
<script nonce='abc' src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var t = async_test("Should not fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have fired a spv event"));
</script>
<img src="../support/pass.png" onload="t.done()">
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-attr 'none';
script-src 'unsafe-inline' 'self';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
var t = async_test("Should fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src-attr');
assert_equals(e.blockedURI, 'inline');
}));
</script>
<img src="../support/pass.png" onload="t.unreached_func('Should not have executed the inline handler')">
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-elem 'self' 'unsafe-inline';
script-src-attr 'none';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
var t = async_test("Should fire a security policy violation for the attribute");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src-attr');
assert_equals(e.blockedURI, 'inline');
}));
var t1 = async_test("Should execute the inline script block");
</script>
<script>
t1.done();
</script>
<img src="../support/pass.png" onload="t.unreached_func('should not have run this event handler')">
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-elem 'nonce-abc' 'nonce-def';
script-src 'nonce-abc';">
<script nonce='abc' src="/resources/testharness.js"></script>
<script nonce='abc' src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var t = async_test("Should not fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have fired a spv event"));
</script>
<script nonce='def'>
t.done();
</script>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-elem 'nonce-abc' 'self';
script-src-attr 'unsafe-inline'">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var t = async_test("Should fire a security policy violation for the attribute");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));
var t1 = async_test("Should execute the inline script attribute");
</script>
<script>
t.step_func(function() {
assert_unreached("Should not have executed the inline script block");
})
</script>
<img src="../support/pass.png" onload="t1.done()">
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-elem 'nonce-abc';
script-src 'nonce-abc' 'nonce-def';">
<script nonce='abc' src="/resources/testharness.js"></script>
<script nonce='abc' src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var t = async_test("Should fire a spv event");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));
</script>
<script nonce='def'>
t.step_func(function() {
assert_unreached("Should not have executed the inline block");
});
</script>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src-elem 'strict-dynamic' 'nonce-abc';
script-src 'nonce-abc';">
<script nonce='abc' src="/resources/testharness.js"></script>
<script nonce='abc' src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var t = async_test("Should not fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have fired a spv event"));
var s = document.createElement('script');
s.src = 'support/t_done.js';
document.head.appendChild(s);
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'strict-dynamic' 'nonce-abc';
script-src-elem 'nonce-abc';">
<script nonce='abc' src="/resources/testharness.js"></script>
<script nonce='abc' src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var t = async_test("Should fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src-elem");
assert_equals(e.blockedURI, "{{location[scheme]}}://{{location[host]}}/content-security-policy/script-src-attr-elem/support/t_fail.js");
}));
var s = document.createElement('script');
s.src = 'support/t_fail.js';
document.head.appendChild(s);
</script>
</body>
</html>

View file

@ -0,0 +1,3 @@
t.step(function() {
assert_unreached("Should not loaded the script");
});

View file

@ -3,7 +3,7 @@
var test_count = 2;
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
if (--test_count <= 0) {
t_spv.done();
}
@ -25,4 +25,4 @@
document.writeln('<script>dmTest.step(function() {assert_unreached("Unsafe inline script ran - document.writeln")});</script>');
dmTest.done();
})();
})();

View file

@ -7,7 +7,7 @@
<title>injected-inline-script-blocked</title>
<script nonce='abc' src="/resources/testharness.js"></script>
<script nonce='abc' src="/resources/testharnessreport.js"></script>
<script nonce='abc' src='../support/logTest.sub.js?logs=["violated-directive=script-src",]'></script>
<script nonce='abc' src='../support/logTest.sub.js?logs=["violated-directive=script-src-elem",]'></script>
<script nonce='abc' src='../support/alertAssert.sub.js?alerts=[]'></script>
</head>

View file

@ -1,13 +1,22 @@
var t1 = async_test("Inline script block");
var t2 = async_test("Inline event handler");
onload = function() {t1.done(); t2.done()}
onload = function() {t1.done(); t2.done();};
var t_spv = async_test("Should not fire policy violation events");
var test_count = 2;
var t_spv = async_test("Should fire policy violation events");
var block_event_fired = false;
var handler_event_fired = false;
window.addEventListener("securitypolicyviolation", t_spv.step_func(function(e) {
assert_equals(e.violatedDirective, "script-src");
if (--test_count <= 0) {
t_spv.done();
if (e.violatedDirective == "script-src-elem") {
assert_false(block_event_fired);
block_event_fired = true;
} else if (e.violatedDirective == "script-src-attr") {
assert_false(handler_event_fired);
handler_event_fired = true;
} else {
assert_unreached("Unexpected directive broken");
}
if (block_event_fired && handler_event_fired) {
t_spv.done();
}
}));

View file

@ -11,7 +11,7 @@
var t = async_test("Check that a securitypolicyviolation event is fired");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.blockedURI, "inline");
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
window.open('javascript:test(function() { assert_unreached("FAIL")});', 'new');

View file

@ -10,7 +10,7 @@
<script nonce="abc">
var t_spv = async_test("Should fire securitypolicyviolation event");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
assert_equals(e.disposition, "report");
}));
var externalRan = false;

View file

@ -11,7 +11,7 @@
var t = async_test("Test that script executes if allowed by proper hash values");
var t_spv = async_test("Test that the securitypolicyviolation event is fired");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
assert_equals(e.disposition, "report");
assert_equals(e.blockedURI, "inline");
}));

View file

@ -21,7 +21,7 @@
}
}));
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.effectiveDirective, 'script-src');
assert_equals(e.effectiveDirective, 'script-src-elem');
}));
}, 'Whitelisted script without a correct nonce is not allowed with `strict-dynamic`.');
</script>
@ -29,4 +29,4 @@
</body>
</html>
</html>

View file

@ -28,7 +28,7 @@
if (violation.blockedURI.split('?')[1] !== 'unNonced-appendChild') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -65,4 +65,4 @@
</script>
</body>
</html>
</html>

View file

@ -44,7 +44,7 @@
if (violation.blockedURI.split('?')[1] !== 'nonWhitelisted-appendChild') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
assert_equals(violation.originalPolicy, "script-src 'self' 'nonce-dummy'");
t.done();
}));
@ -58,4 +58,4 @@
</script>
</body>
</html>
</html>

View file

@ -27,7 +27,7 @@
if (violation.blockedURI.split('?')[1] !== 'appendChild-reportOnly') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
// Check that the violation comes from the Report-Only policy.
assert_equals(violation.originalPolicy, "script-src 'none'");
t.done();
@ -41,4 +41,4 @@
</script>
</body>
</html>
</html>

View file

@ -20,7 +20,7 @@
async_test(function(t) {
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_false(javascriptUriScriptRan);
assert_equals(e.effectiveDirective, 'script-src');
assert_equals(e.effectiveDirective, 'script-src-elem');
}));
document.getElementById('javascriptUri').click();

View file

@ -16,7 +16,7 @@
<script nonce='dummy'>
async_test(function(t) {
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.effectiveDirective, 'script-src');
assert_equals(e.effectiveDirective, 'script-src-elem');
}));
}, 'All the expected CSP violation reports have been fired.');
</script>
@ -26,4 +26,4 @@
</script>
</body>
</html>
</html>

View file

@ -24,7 +24,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWrite') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -43,7 +43,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWriteln') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -62,7 +62,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWrite-deferred') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -81,7 +81,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWriteln-deferred') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -100,7 +100,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWrite-async') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -119,7 +119,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWriteln-async') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -138,7 +138,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWrite-deferred-async') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -157,7 +157,7 @@
if (violation.blockedURI.split('?')[1] !== 'documentWriteln-deferred-async') {
return;
}
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-elem');
t.done();
}));
@ -173,7 +173,7 @@
return;
}
assert_false(innerHTMLScriptRan);
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-attr');
t.done();
}));
@ -191,7 +191,7 @@
return;
}
assert_false(insertAdjacentHTMLScriptRan);
assert_equals(violation.effectiveDirective, 'script-src');
assert_equals(violation.effectiveDirective, 'script-src-attr');
t.done();
}));
@ -202,4 +202,4 @@
</script>
</body>
</html>
</html>

View file

@ -20,9 +20,9 @@
<script nonce="nonceynonce">
var t_spv = async_test("Should fire securitypolicyviolation");
window.addEventListener('securitypolicyviolation', t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
assert_equals(e.violatedDirective, "script-src-elem");
}));
var matchingContent = 'Å';
var nonMatchingContent = 'Å';

View file

@ -18,9 +18,9 @@
window.addEventListener('securitypolicyviolation', function(e) {
alert_assert("violated-directive=" + e.violatedDirective);
});
var t_alert = async_test('Expecting alerts: ["PASS (1/3)","PASS (2/3)","PASS (3/3)"]');
var expected_alerts = ["PASS (1/3)", "PASS (2/3)", "PASS (3/3)", "violated-directive=script-src", "violated-directive=script-src"];
var expected_alerts = ["PASS (1/3)", "PASS (2/3)", "PASS (3/3)", "violated-directive=script-src-elem", "violated-directive=script-src-elem"];
function alert_assert(msg) {
t_alert.step(function() {

View file

@ -7,7 +7,7 @@
<title>scriptnonce-basic-blocked</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/alertAssert.sub.js?alerts=["PASS (closely-quoted nonce)","PASS (nonce w/whitespace)", "violated-directive=script-src", "violated-directive=script-src", "violated-directive=script-src"]'></script>
<script src='../support/alertAssert.sub.js?alerts=["PASS (closely-quoted nonce)","PASS (nonce w/whitespace)", "violated-directive=script-src-elem", "violated-directive=script-src-elem", "violated-directive=script-src-elem"]'></script>
<script nonce="noncynonce">
alert_assert('PASS (closely-quoted nonce)');

View file

@ -19,8 +19,8 @@
});
</script>
<script nonce='noncynonce'>
var t_alert = async_test('Expecting alerts: ["PASS (1/2)","PASS (2/2)", "violated-directive=script-src"]');
var expected_alerts = ["PASS (1/2)", "PASS (2/2)", "violated-directive=script-src"];
var t_alert = async_test('Expecting alerts: ["PASS (1/2)","PASS (2/2)", "violated-directive=script-src-elem"]');
var expected_alerts = ["PASS (1/2)", "PASS (2/2)", "violated-directive=script-src-elem"];
function alert_assert(msg) {
t_alert.step(function() {

View file

@ -7,25 +7,25 @@
<title>srcdoc-doesnt-bypass-script-src</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src"]'></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=script-src-elem"]'></script>
</head>
<body>
<script nonce='abc'>
window.onmessage = function(e) {
log(e.data);
}
var i = document.createElement('iframe');
i.addEventListener('securitypolicyviolation', function(e) {
log("violated-directive=" + e.violatedDirective);
});
i.srcdoc = "<sc" + "ript nonce='abc'>" +
"window.addEventListener('securitypolicyviolation', function(e) {" +
i.srcdoc = "<sc" + "ript nonce='abc'>" +
"window.addEventListener('securitypolicyviolation', function(e) {" +
"window.parent.postMessage('violated-directive=' + e.violatedDirective, '*');});" +
"</scr" + "ipt>" +
"</scr" + "ipt>" +
"<scr" + "ipt>window.parent.log('FAIL')</scr" + "ipt>";
document.body.appendChild(i);
</script>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src-attr 'unsafe-inline';
style-src 'none';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Should apply the style attribute");
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have fired a spv event"));
</script>
</head>
<body style="background: green">
<script>
t.step(function() {
assert_true(document.body.style.length > 0);
t.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src-attr 'none';
style-src 'unsafe-inline';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Should fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src-attr');
assert_equals(e.blockedURI, 'inline');
}));
</script>
</head>
<body style="background: green">
<script>
async_test(function(test) {
assert_equals(document.body.style.length, 0);
test.done();
}, "The attribute style should not be applied");
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'unsafe-inline';
style-src-attr 'none';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Should fire a security policy violation for the attribute");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src-attr');
assert_equals(e.blockedURI, 'inline');
}));
</script>
</head>
<body style="background: green">
<style>
body {background: blue;}
</style>
<script>
async_test(function(test) {
assert_equals(document.body.style.length, 0);
assert_equals(document.styleSheets.length, 1);
test.done();
}, "The attribute style should not be applied and the inline style should be applied");
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'unsafe-inline';
style-src 'none';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Inline style should be applied");
window.addEventListener('securitypolicyviolation', t.unreached_func("Should not have fired a spv event"));
</script>
</head>
<body>
<style>
body {background: green;}
</style>
<script>
t.step(function() {
assert_equals(document.styleSheets.length, 1);
t.done();
});
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'none';
script-src-attr 'unsafe-inline'">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Should fire a security policy violation for the inline block");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src-elem');
assert_equals(e.blockedURI, 'inline');
}));
</script>
</head>
<body style="background: green">
<style>
body {background: blue;}
</style>
<script>
async_test(function(test) {
assert_true(document.body.style.length > 0);
assert_equals(document.styleSheets.length, 0);
test.done();
}, "The inline style should not be applied and the attribute style should be applied");
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'none';
style-src 'unsafe-inline';">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var t = async_test("Should fire a security policy violation event");
window.addEventListener('securitypolicyviolation', t.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src-elem');
assert_equals(e.blockedURI, 'inline');
}));
</script>
</head>
<body>
<style>
body {background: green;}
</style>
<script>
async_test(function(test) {
assert_equals(document.styleSheets.length, 0);
test.done();
}, "The inline style should not be applied");
</script>
</body>
</html>

View file

@ -7,7 +7,7 @@
<title>injected-inline-style-blocked</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=style-src","PASS"]'></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=style-src-elem","PASS"]'></script>
<script src="../support/alertAssert.sub.js?alerts=[]"></script>
</head>
@ -17,14 +17,14 @@
log("violated-directive=" + e.violatedDirective);
});
</script>
<div id="test1">
PASS 1/2
</div>
<div id="test2">
PASS 2/2
</div>
<script src="support/inject-style.js"></script>
<script>
log(document.styleSheets.length == 0 ? "PASS" : "FAIL");

View file

@ -7,7 +7,7 @@
<title>inline-style-attribute-blocked</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=style-src","PASS"]'></script>
<script src='../support/logTest.sub.js?logs=["violated-directive=style-src-attr","PASS"]'></script>
<script src="../support/alertAssert.sub.js?alerts=[]"></script>
<script>
window.addEventListener('securitypolicyviolation', function(e) {
@ -16,7 +16,7 @@
</script>
</head>
<body style="background-color: blue;">
<script>
log(document.body.style.length > 0 ? 'FAIL' : 'PASS');

View file

@ -12,7 +12,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
var l = document.createElement("link");

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>
</head>

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-attr", e.violatedDirective);
}));
onload = t.step_func_done(function(e) {
var contentEl = document.getElementById("content");

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>
<style>

View file

@ -9,7 +9,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>
<style id="style1" nonce="not-nonceynonce"

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>
<style nonce="not-nonceynonce">

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>
<link href="/content-security-policy/style-src/resources/style-src.css" rel=stylesheet type=text/css>

View file

@ -10,7 +10,7 @@
var t_spv = async_test("Should fire a securitypolicyviolation event");
document.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals("style-src", e.violatedDirective);
assert_equals("style-src-elem", e.violatedDirective);
}));
</script>
<link nonce="not-nonceynonce" href="/content-security-policy/style-src/resources/style-src.css?pipe=sub" rel=stylesheet type=text/css>

View file

@ -12,9 +12,9 @@
window.addEventListener('securitypolicyviolation', function(e) {
alert_assert("violated-directive=" + e.violatedDirective);
});
var t_alert = async_test('Expecting alerts: ["PASS: The \'p\' element\'s text is green, which means the style was correctly applied.", "violated-directive=style-src"]');
var expected_alerts = ["PASS: The 'p' element's text is green, which means the style was correctly applied.", "violated-directive=style-src"];
var t_alert = async_test('Expecting alerts: ["PASS: The \'p\' element\'s text is green, which means the style was correctly applied.", "violated-directive=style-src-elem"]');
var expected_alerts = ["PASS: The 'p' element's text is green, which means the style was correctly applied.", "violated-directive=style-src-elem"];
function alert_assert(msg) {
t_alert.step(function() {

View file

@ -12,11 +12,11 @@
<script>
var t_spv = async_test("Should fire securitypolicyviolation");
window.addEventListener('securitypolicyviolation', t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "style-src");
assert_equals(e.violatedDirective, "style-src-elem");
}));
</script>
<style nonce="noncynonce">
#test1 {
color: green;

View file

@ -13,8 +13,8 @@
<script>
var t_spv = async_test("Should fire securitypolicyviolation");
window.addEventListener('securitypolicyviolation', t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "style-src");
}));
assert_equals(e.violatedDirective, "style-src-elem");
}));
</script>
<style nonce="noncynonce">
#test {

View file

@ -8,10 +8,10 @@
<script>
var t_spv = async_test("Should fire violation event");
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
assert_equals(e.violatedDirective, "script-src");
}));
assert_equals(e.violatedDirective, "script-src-elem");
}));
</script>
</head>
<body>
@ -20,7 +20,7 @@
not redirect to a different resource.</p>
<div id="log"></div>
<?xml version="1.0" standalone="no"?>
<svg width="6cm" height="5cm" viewBox="0 0 600 500"
xmlns="http://www.w3.org/2000/svg" version="1.1">

View file

@ -18,7 +18,7 @@
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -18,7 +18,7 @@
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -19,7 +19,7 @@
window.onmessage = t1.unreached_func("Should have not received any message");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -18,7 +18,7 @@
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -18,7 +18,7 @@
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -19,7 +19,7 @@
window.onmessage = t1.unreached_func("Should have not received any message");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-elem');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -6,16 +6,16 @@
<title>Event handlers should not be allowed if a matching hash is present without 'unsafe-hashes'</title>
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the inline event handler is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-attr');
assert_equals(e.blockedURI, 'inline');
}));
</script>

View file

@ -12,9 +12,9 @@
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the inline event handler is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.violatedDirective, 'script-src-attr');
assert_equals(e.blockedURI, 'inline');
}));
</script>

View file

@ -16,9 +16,9 @@
<div id='log'></div>
<script>
var t1 = async_test("Test that the inline style attribute is blocked");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src');
assert_equals(e.violatedDirective, 'style-src-attr');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -18,7 +18,7 @@
var t1 = async_test("Test that the inline style attribute is blocked");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src');
assert_equals(e.violatedDirective, 'style-src-attr');
assert_equals(e.blockedURI, 'inline');
}));

View file

@ -40,5 +40,5 @@
create_test(ORIGIN, ORIGIN, SameSiteStatus.STRICT, "Reloaded same-host auxiliary navigations are strictly same-site.");
create_test(SUBDOMAIN_ORIGIN, SUBDOMAIN_ORIGIN, SameSiteStatus.STRICT, "Reloaded subdomain auxiliary navigations are strictly same-site.");
create_test(CROSS_SITE_ORIGIN, CROSS_SITE_ORIGIN, SameSiteStatus.LAX, "Reloaded ross-site auxiliary navigations are laxly same-site");
create_test(CROSS_SITE_ORIGIN, CROSS_SITE_ORIGIN, SameSiteStatus.LAX, "Reloaded cross-site auxiliary navigations are laxly same-site");
</script>

View file

@ -83,9 +83,9 @@ simple_async.step(function (){
+ uuid_token, true)
client.setRequestHeader('Accept', 'jewelry')
client.setRequestHeader('accept-language', 'nn_NO,nn,en')
client.setRequestHeader('accept-language', 'nn-NO,nn,en')
client.setRequestHeader('content-type', 'text/plain; parameter=extra')
client.setRequestHeader('content-Language', 'nn_NO')
client.setRequestHeader('content-Language', 'nn-NO')
client.onload = simple_async.step_func(function() {
assert_equals(client.getResponseHeader('content-type'), "text/plain", 'content-type response header')

View file

@ -0,0 +1,10 @@
<title>In quirks mode a float should resolve its percentage height against its first ancestor with a defined height.</title>
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#Computing_widths_and_margins">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<p style="margin-top: 1em;">Test passes if there is a filled green square.</p>
<div style="width:100px; height:100px; background:red;">
<div>
<div></div>
<div style="float:left; width:100%; height:100%; background:green;"></div>
</div>
</div>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Containment Test: Size containment scrollbars</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-scrollbars-001-ref.html">
<meta name=assert content="This test checks that the size of an element with 'contain: size' includes the scrollbars too.">
<style>
div {
contain: size;
display: inline-block;
border: solid thick;
overflow: scroll;
}
</style>
<p>This test passes if it has the same output as the reference.</p>
<div></div>

View file

@ -0,0 +1,13 @@
<!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>
div {
display: inline-block;
border: solid thick;
overflow: scroll;
}
</style>
<p>This test passes if it has the same output as the reference.</p>
<div></div>

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Display: parsing display with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#display-prop">
<link rel="help" href="https://drafts.csswg.org/css-display/#the-display-properties">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-containers">
<meta name="assert" content="display supports only the spec grammar.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("display", "grid inline-grid");
test_invalid_value("display", "none grid");
</script>
</body>
</html>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Display: parsing display with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#display-prop">
<link rel="help" href="https://drafts.csswg.org/css-display/#the-display-properties">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-containers">
<meta name="assert" content="display supports the full spec grammar.">
<meta name="assert" content="display supports the new values 'grid | inline-grid'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// https://drafts.csswg.org/css-grid-1/#grid-containers
test_valid_value("display", "grid");
test_valid_value("display", "inline-grid");
// https://drafts.csswg.org/css2/visuren.html#display-prop
test_valid_value("display", "inline");
test_valid_value("display", "block");
test_valid_value("display", "list-item");
test_valid_value("display", "inline-block");
test_valid_value("display", "table");
test_valid_value("display", "inline-table");
test_valid_value("display", "table-row-group");
test_valid_value("display", "table-header-group");
test_valid_value("display", "table-footer-group");
test_valid_value("display", "table-row");
test_valid_value("display", "table-column-group");
test_valid_value("display", "table-column");
test_valid_value("display", "table-cell");
test_valid_value("display", "table-caption");
test_valid_value("display", "none");
</script>
</body>
</html>

View file

@ -0,0 +1,9 @@
<title>In quirks mode a flex item should resolve its percentage height against its first ancestor with a defined height.</title>
<link rel="help" href="https://quirks.spec.whatwg.org/#the-percentage-height-calculation-quirk">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<p style="margin-top: 1em;">Test passes if there is a filled green square.</p>
<div style="width: 200px; height: 200px;">
<div style="display: flex;">
<div style="width: 50%; height: 50%; background: green;"></div>
</div>
</div>

View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-area with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-area">
<meta name="assert" content="grid-area supports only the grammar '<grid-line> [ / <grid-line> ]{0,3}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("grid-area", "'string'");
test_invalid_value("grid-row", "1.0");
test_invalid_value("grid-column", "1 2");
test_invalid_value("grid-row-start", "+-3");
test_invalid_value("grid-column-start", "0");
test_invalid_value("grid-row-end", "span");
test_invalid_value("grid-column-end", "sPaN");
test_invalid_value("grid-column-end", '"1st"');
test_invalid_value("grid-column-end", "1st");
test_invalid_value("grid-area", "auto / initial");
test_invalid_value("grid-row", "auto / inherit");
test_invalid_value("grid-column", "auto / unset");
test_invalid_value("grid-area", "auto / auto / auto / auto / auto");
test_invalid_value("grid-row", "1 / 2 / 3")
test_invalid_value("grid-column", "a / b / c");
test_invalid_value("grid-row-end", "span 1 / span 2");
test_invalid_value("grid-area", "auto 2 auto 4");
test_invalid_value("grid-row", "33 -A0 auto");
test_invalid_value("grid-row", "auto i 2 j span 3 k");
// https://github.com/w3c/csswg-drafts/issues/2856
test_invalid_value("grid-row-end", "1 auto");
test_invalid_value("grid-row-end", "span 1 auto");
test_invalid_value("grid-row-end", "span auto 1");
test_invalid_value("grid-row-end", "1 auto span");
</script>
</body>
</html>

View file

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-area with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-area">
<meta name="assert" content="grid-area supports the full grammar '<grid-line> [ / <grid-line> ]{0,3}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// auto
test_valid_value("grid-area", "auto", "auto / auto / auto / auto");
test_valid_value("grid-area", "AuTo", "auto / auto / auto / auto");
test_valid_value("grid-row", "auto", "auto / auto");
test_valid_value("grid-column-end", "AuTo", "auto");
// <custom-ident>
test_valid_value("grid-area", "--a", "--a / --a / --a / --a");
test_valid_value("grid-row", "-zπ", "-zπ / -zπ");
test_valid_value("grid-row-start", "AZ");
test_valid_value("grid-column-start", "-_π");
test_valid_value("grid-row-end", "_9");
// <integer> && <custom-ident>?
test_valid_value("grid-area", "1", "1 / auto / auto / auto");
test_valid_value("grid-area", "+90 -a-", "90 -a- / auto / auto / auto");
test_valid_value("grid-row", "az 2", "2 az / auto");
test_valid_value("grid-column", "9", "9 / auto");
test_valid_value("grid-column", "-19 zA", "-19 zA / auto");
test_valid_value("grid-column", "-A0 33", "33 -A0 / auto");
test_valid_value("grid-row-start", "-19");
test_valid_value("grid-row-start", "9 -Z_");
test_valid_value("grid-column-start", "+90", "90");
test_valid_value("grid-column-start", "Z -44", "-44 Z");
test_valid_value("grid-row-end", "1 -πA");
test_valid_value("grid-column-end", "π_ +5", "5 π_");
// span && [ <integer> || <custom-ident> ]
test_valid_value("grid-area", "span 2 i", "span 2 i / auto / auto / auto");
test_valid_value("grid-area", "i 2 SpAn", "span 2 i / auto / auto / auto");
test_valid_value("grid-row", "span 2", "span 2 / auto");
test_valid_value("grid-column", "i SpAn", "span i / auto");
test_valid_value("grid-row-start", "span i", "span i");
test_valid_value("grid-column-start", "SpAn i 2", "span 2 i");
test_valid_value("grid-row-end", "2 i span", "span 2 i");
test_valid_value("grid-column-end", "2 SpAn", "span 2");
// <grid-line> [ / <grid-line> ]{0,3}
test_valid_value("grid-area", "auto / i", "auto / i / auto / i");
test_valid_value("grid-area", "auto / i / 2 j", "auto / i / 2 j / i");
test_valid_value("grid-area", "auto / i / 2 j / span 3 k");
test_valid_value("grid-row", "auto / i");
test_valid_value("grid-column", "2 j / span 3 k");
// https://github.com/w3c/csswg-drafts/issues/2858
// '\\31 st' in Blink, Firefox, '1st' in Edge, '"1st"' in Safari.
test_valid_value("grid-column-end", "\\31st", ["\\31 st", "1st", '"1st"']);
test_valid_value("grid-column-end", "\\31 st", ["\\31 st", "1st", '"1st"']);
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-auto-columns with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-columns">
<meta name="assert" content="grid-auto-columns supports only the grammar '<track-size>+'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// <track-breadth>
test_invalid_value("grid-auto-columns", "none");
test_invalid_value("grid-auto-columns", "-1px");
test_invalid_value("grid-auto-columns", "-4%");
// minmax( <inflexible-breadth> , <track-breadth> )
test_invalid_value("grid-auto-columns", "minmax(1px)");
test_invalid_value("grid-auto-columns", "minmax(1px, 2px, 3px)");
test_invalid_value("grid-auto-columns", "minmax(5fr, 1px)");
test_invalid_value("grid-auto-columns", "minmax(6px, -7%)");
test_invalid_value("grid-auto-columns", "minmax(8px, -9fr)");
// fit-content( <length-percentage> )
test_invalid_value("grid-auto-columns", "fit-content(-1px)");
test_invalid_value("grid-auto-columns", "fit-content(1px, 2px)");
test_invalid_value("grid-auto-columns", "fit-content(1px auto)");
// <track-size>+
test_invalid_value("grid-auto-columns", "2em / 3em");
test_invalid_value("grid-auto-columns", "auto, 10%");
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-auto-columns with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-columns">
<meta name="assert" content="grid-auto-columns supports the full grammar '<track-size>+'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// <track-breadth>
// <track-breadth> = <length-percentage> | <flex> | min-content | max-content | auto
test_valid_value("grid-auto-columns", "1px");
test_valid_value("grid-auto-columns", "2em");
test_valid_value("grid-auto-columns", "calc(2em + 3ex)");
test_valid_value("grid-auto-columns", "4%");
test_valid_value("grid-auto-columns", "5fr");
test_valid_value("grid-auto-columns", "min-content");
test_valid_value("grid-auto-columns", "max-content");
test_valid_value("grid-auto-columns", "auto");
// minmax( <inflexible-breadth> , <track-breadth> )
// <inflexible-breadth> = <length-percentage> | min-content | max-content | auto
test_valid_value("grid-auto-columns", "minmax(1px, 5fr)");
test_valid_value("grid-auto-columns", "minmax(2em, min-content)");
test_valid_value("grid-auto-columns", "minmax(calc(2em + 3ex), max-content)");
test_valid_value("grid-auto-columns", "minmax(4%, auto)");
test_valid_value("grid-auto-columns", "minmax(5vmin, 1px)");
test_valid_value("grid-auto-columns", "minmax(min-content, 2em)");
test_valid_value("grid-auto-columns", "minmax(max-content, calc(2em + 3ex))");
test_valid_value("grid-auto-columns", "minmax(auto, 4%)");
// fit-content( <length-percentage> )
test_valid_value("grid-auto-columns", "fit-content(1px)");
test_valid_value("grid-auto-columns", "fit-content(2em)");
test_valid_value("grid-auto-columns", "fit-content(calc(2em + 3ex))");
test_valid_value("grid-auto-columns", "fit-content(4%)");
test_valid_value("grid-auto-columns", "0px");
test_valid_value("grid-auto-columns", "0%");
test_valid_value("grid-auto-columns", "0fr");
test_valid_value("grid-auto-columns", "minmax(auto, 0%)");
test_valid_value("grid-auto-columns", "fit-content(0px)");
// <track-size>+
test_valid_value("grid-auto-columns", "1px 2px 3px 0px");
test_valid_value("grid-auto-columns", "fit-content(1px) minmax(2px, 3px) 4px");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-auto-flow with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-flow">
<meta name="assert" content="grid-auto-flow supports only the grammar '[ row | column ] || dense'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("grid-auto-flow", "auto");
test_invalid_value("grid-auto-flow", "row dense column");
test_invalid_value("grid-auto-flow", "dense row dense");
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-auto-flow with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-flow">
<meta name="assert" content="grid-auto-flow supports the full grammar '[ row | column ] || dense'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("grid-auto-flow", "row");
test_valid_value("grid-auto-flow", "column");
test_valid_value("grid-auto-flow", "row dense");
test_valid_value("grid-auto-flow", "dense column", "column dense");
// Blink/WebKit "dense", Edge/Firefox "row dense"
test_valid_value("grid-auto-flow", "dense", ["dense", "row dense"]);
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-auto-rows with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-rows">
<meta name="assert" content="grid-auto-rows supports only the grammar '<track-size>+'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// <track-breadth>
test_invalid_value("grid-auto-rows", "none");
test_invalid_value("grid-auto-rows", "-1px");
test_invalid_value("grid-auto-rows", "-4%");
// minmax( <inflexible-breadth> , <track-breadth> )
test_invalid_value("grid-auto-rows", "minmax(1px)");
test_invalid_value("grid-auto-rows", "minmax(1px, 2px, 3px)");
test_invalid_value("grid-auto-rows", "minmax(5fr, 1px)");
test_invalid_value("grid-auto-rows", "minmax(6px, -7%)");
// fit-content( <length-percentage> )
test_invalid_value("grid-auto-rows", "fit-content(-1px)");
test_invalid_value("grid-auto-rows", "fit-content(1px, 2px)");
test_invalid_value("grid-auto-rows", "fit-content(1px auto)");
// <track-size>+
test_invalid_value("grid-auto-rows", "2em / 3em");
test_invalid_value("grid-auto-rows", "auto, 10%");
</script>
</body>
</html>

View file

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-auto-rows with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-rows">
<meta name="assert" content="grid-auto-rows supports the full grammar '<track-size>+'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
// <track-breadth>
// <track-breadth> = <length-percentage> | <flex> | min-content | max-content | auto
test_valid_value("grid-auto-rows", "1px");
test_valid_value("grid-auto-rows", "2em");
test_valid_value("grid-auto-rows", "calc(2em + 3ex)");
test_valid_value("grid-auto-rows", "4%");
test_valid_value("grid-auto-rows", "5fr");
test_valid_value("grid-auto-rows", "min-content");
test_valid_value("grid-auto-rows", "max-content");
test_valid_value("grid-auto-rows", "auto");
// minmax( <inflexible-breadth> , <track-breadth> )
// <inflexible-breadth> = <length-percentage> | min-content | max-content | auto
test_valid_value("grid-auto-rows", "minmax(1px, 5fr)");
test_valid_value("grid-auto-rows", "minmax(2em, min-content)");
test_valid_value("grid-auto-rows", "minmax(calc(2em + 3ex), max-content)");
test_valid_value("grid-auto-rows", "minmax(4%, auto)");
test_valid_value("grid-auto-rows", "minmax(5vmin, 1px)");
test_valid_value("grid-auto-rows", "minmax(min-content, 2em)");
test_valid_value("grid-auto-rows", "minmax(max-content, calc(2em + 3ex))");
test_valid_value("grid-auto-rows", "minmax(auto, 4%)");
// fit-content( <length-percentage> )
test_valid_value("grid-auto-rows", "fit-content(1px)");
test_valid_value("grid-auto-rows", "fit-content(2em)");
test_valid_value("grid-auto-rows", "fit-content(calc(2em + 3ex))");
test_valid_value("grid-auto-rows", "fit-content(4%)");
test_valid_value("grid-auto-rows", "0px");
test_valid_value("grid-auto-rows", "0%");
test_valid_value("grid-auto-rows", "0fr");
test_valid_value("grid-auto-rows", "minmax(auto, 0%)");
test_valid_value("grid-auto-rows", "fit-content(0px)");
// <track-size>+
test_valid_value("grid-auto-rows", "1px 2px 3px 0px");
test_valid_value("grid-auto-rows", "fit-content(1px) minmax(2px, 3px) 4px");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-template-areas with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-areas">
<meta name="assert" content="grid-template-areas supports only the grammar 'none | <string>+'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("grid-template-areas", "auto");
test_invalid_value("grid-template-areas", 'none "first"');
test_invalid_value("grid-template-areas", '"first" none');
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: parsing grid-template-areas with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-areas">
<meta name="assert" content="grid-template-areas supports the full grammar 'none | <string>+'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("grid-template-areas", "none");
test_valid_value("grid-template-areas", '"first"');
test_valid_value("grid-template-areas", '"first second"');
test_valid_value("grid-template-areas", '"1st 2nd 3rd"');
test_valid_value("grid-template-areas", '"first second" "third fourth"');
test_valid_value("grid-template-areas", '"first second" "third ." "1st 2nd" "3rd 4th"');
// Firefox preserves specific whitespace and full stop sequences.
// Other browsers consolidate to ' ' and '.'
test_valid_value("grid-template-areas", '" a \t b "', '"a b"'); // Fails in Firefox
test_valid_value("grid-template-areas", '"c\td"', ['"c d"', '"c\\9 d"']);
test_valid_value("grid-template-areas", '"first ..."', ['"first ."', '"first ..."']);
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Masking: Test clip-path property and path function with nonzero fill</title>
<link rel="help" href="https://drafts.csswg.org/css-shapes-2/#funcdef-path">
<link rel="match" href="reference/clip-path-path-001-ref.html">
<meta name="assert" content="The clip-path property takes the basic shape
'path()' for clipping. Test nonzero path function. On pass you should
see a green square.">
</head>
<style>
#rect {
width: 100px;
height: 100px;
background-color: green;
clip-path: path(nonzero, 'M10,10h80v80h-80zM25,25h50v50h-50z');
}
</style>
<body>
<p>The test passes if there are a green filled rect.</p>
<div id="rect"></div>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Masking: Test clip-path property and path function with evenodd fill</title>
<link rel="help" href="https://drafts.csswg.org/css-shapes-2/#funcdef-path">
<link rel="match" href="reference/clip-path-path-002-ref.html">
<meta name="assert" content="The clip-path property takes the basic shape
'path()' for clipping. Test evenodd path function. On pass you should
see a hollow green square.">
</head>
<style>
#rect {
width: 100px;
height: 100px;
background-color: green;
clip-path: path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50z');
}
</style>
<body>
<p>The test passes if there are a green hollow rect.</p>
<div id="rect"></div>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Masking: Reference for clip-path's path function with nonzero</title>
<style type="text/css">
#rect {
width: 100px;
height: 100px;
background-color: green;
clip-path: url("#clip");
}
</style>
</head>
<body>
<p>The test passes if there are a green filled rect.</p>
<div id="rect"></div>
<svg height="0" width="0">
<defs>
<clipPath id="clip">
<path clip-rule="nonzero" d="M10,10h80v80h-80zM25,25h50v50h-50z"/>
</clipPath>
</defs>
</svg>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Masking: Reference for clip-path's path function with evenodd</title>
<style type="text/css">
#rect {
width: 100px;
height: 100px;
background-color: green;
clip-path: url("#clip");
}
</style>
</head>
<body>
<p>The test passes if there are a green hollow rect.</p>
<div id="rect"></div>
<svg height="0" width="0">
<defs>
<clipPath id="clip">
<path clip-rule="evenodd" d="M10,10h80v80h-80zM25,25h50v50h-50z"/>
</clipPath>
</defs>
</svg>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<title>position:sticky elements should respect an overflow:hidden ancestor</title>
<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
<meta name="assert" content="This test checks that position:sticky elements adhere to an overflow:hidden ancestor" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/sticky-util.js"></script>
<body></body>
<script>
test(() => {
const outer_scroller = document.createElement('div');
outer_scroller.style.width = '100px';
outer_scroller.style.height = '100px';
outer_scroller.style.overflow = 'scroll';
const inner_scroller = document.createElement('div');
inner_scroller.style.width = '80%';
inner_scroller.style.height = '200px';
inner_scroller.style.overflow = 'hidden';
const sticky = document.createElement('div');
sticky.style.width = '20px';
sticky.style.height = '20px';
sticky.style.position = 'sticky';
sticky.style.top = '0';
sticky.style.background = 'red';
const spacer = document.createElement('div');
spacer.style.height = '500px';
inner_scroller.appendChild(sticky);
inner_scroller.appendChild(spacer);
outer_scroller.appendChild(inner_scroller);
document.body.appendChild(outer_scroller);
outer_scroller.scrollTop = 50;
// The sticky should attach to the inner scroller, and so should not stick.
assert_equals(sticky.offsetTop, inner_scroller.offsetTop);
}, 'A sticky element should attach to an overflow:hidden ancestor');
// This tests a specific bug in Firefox where the sticky element incorrectly
// started sticking when inside a table. See https://bugzilla.mozilla.org/show_bug.cgi?id=1488810
test(() => {
const outer_scroller = document.createElement('div');
outer_scroller.style.width = '100px';
outer_scroller.style.height = '100px';
outer_scroller.style.overflow = 'scroll';
const table = document.createElement('div');
table.style.display = 'table';
const tr = document.createElement('div');
tr.style.display = 'table-row';
const inner_scroller = document.createElement('div');
inner_scroller.style.display = 'table-cell';
inner_scroller.style.overflow = 'hidden';
const sticky = document.createElement('div');
sticky.style.width = '20px';
sticky.style.height = '20px';
sticky.style.position = 'sticky';
sticky.style.top = '0';
sticky.style.background = 'red';
const spacer = document.createElement('div');
spacer.style.height = '500px';
inner_scroller.appendChild(sticky);
inner_scroller.appendChild(spacer);
tr.append(inner_scroller);
table.appendChild(tr);
outer_scroller.appendChild(table);
document.body.appendChild(outer_scroller);
outer_scroller.scrollTop = 50;
// The sticky should attach to the inner scroller, and so should not stick.
assert_equals(sticky.offsetTop, inner_scroller.offsetTop);
}, 'A sticky element should attach to an overflow:hidden ancestor inside a table');
</script>

View file

@ -57,11 +57,11 @@ function assert_computed_type(name, value, expected) {
}
}
function assert_attribute_get_type(syntax, value, expected) {
function assert_attribute_get_type(styleDecl, propertyMap, syntax, value, expected) {
let name = gen_name();
target.style = `${name}: ${value}`;
styleDecl.setProperty(name, value);
assert_true(target.attributeStyleMap.get(name) instanceof CSSUnparsedValue);
assert_true(propertyMap.get(name) instanceof CSSUnparsedValue);
CSS.registerProperty({
name: name,
@ -71,10 +71,10 @@ function assert_attribute_get_type(syntax, value, expected) {
});
if (expected == CSSStyleValue) {
assert_false(target.attributeStyleMap.get(name) instanceof CSSUnparsedValue);
assert_false(propertyMap.get(name) instanceof CSSUnparsedValue);
}
assert_true(target.attributeStyleMap.get(name) instanceof expected);
assert_true(propertyMap.get(name) instanceof expected);
}
// computedStyleMap
@ -193,111 +193,123 @@ test(function(){
assert_true(target.computedStyleMap().getAll(name).every(x => x instanceof CSSUnitValue));
}, 'All computed values correctly reified in comma-separated list');
// attributeStyleMap.get
// attributeStyleMap.get / styleMap.get
test(function(){
function test_style_property_map_get(test_fn, name_fn) {
let rule = style.sheet.rules[0];
test(function(){
target.attributeStyleMap.clear();
test_fn(target.style, target.attributeStyleMap);
}, name_fn('attributeStyleMap'));
test(function(){
rule.styleMap.clear();
test_fn(rule.style, rule.styleMap);
}, name_fn('styleMap'));
}
test_style_property_map_get(function(styleDecl, propertyMap){
let name1 = gen_prop('<length>', '100px');
let name2 = gen_prop('<length>', '0px');
target.style = `${name2}: var(${name1})`;
assert_true(target.attributeStyleMap.get(name2) instanceof CSSUnparsedValue);
}, 'attributeStyleMap.get returns CSSUnparsedValue for value with var references');
styleDecl.setProperty(name2, `var(${name1})`);
assert_true(propertyMap.get(name2) instanceof CSSUnparsedValue);
}, name => `${name}.get returns CSSUnparsedValue for value with var references`);
test(function(){
test_style_property_map_get(function(styleDecl, propertyMap){
let name1 = gen_prop('<length>', '100px');
let name2 = gen_prop('<length>#', '0px');
target.style = `${name2}: 1px, var(${name1}), 3px`;
assert_true(target.attributeStyleMap.get(name2) instanceof CSSUnparsedValue);
}, 'attributeStyleMap.get returns CSSUnparsedValue for value with var reference in list');
styleDecl.setProperty(name2, `1px, var(${name1}), 3px`);
assert_true(propertyMap.get(name2) instanceof CSSUnparsedValue);
}, name => `${name}.get returns CSSUnparsedValue for value with var references in list`);
test(function(){
assert_attribute_get_type('*', 'if(){}', CSSUnparsedValue);
}, 'attributeStyleMap.get returns CSSUnparsedValue for *');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '*', 'if(){}', CSSUnparsedValue);
}, name => `${name}.get returns CSSUnparsedValue for *`);
test(function(){
assert_attribute_get_type('<angle>', '42deg', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <angle>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<angle>', '42deg', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <angle>`);
test(function(){
assert_attribute_get_type('<color>', '#fefefe', CSSStyleValue);
}, 'attributeStyleMap.get returns CSSStyleValue for <color>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<color>', '#fefefe', CSSStyleValue);
}, name => `${name}.get returns CSSStyleValue for <color>`);
test(function(){
assert_attribute_get_type('<custom-ident>', 'none', CSSKeywordValue);
}, 'attributeStyleMap.get returns CSSKeywordValue for <custom-ident>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<custom-ident>', 'none', CSSKeywordValue);
}, name => `${name}.get returns CSSKeywordValue for <custom-ident>`);
test(function(){
assert_attribute_get_type('<image>', 'url(thing.png)', CSSImageValue);
}, 'attributeStyleMap.get returns CSSImageValue for <image>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<image>', 'url(thing.png)', CSSImageValue);
}, name => `${name}.get returns CSSImageValue for <image>`);
test(function(){
assert_attribute_get_type('<integer>', '100', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <integer>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<integer>', '100', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <integer>`);
test(function(){
assert_attribute_get_type('<length-percentage>', '10%', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length-percentage> [10%]');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<length-percentage>', '10%', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <length-percentage> [10%]`);
test(function(){
assert_attribute_get_type('<length-percentage>', '10px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length-percentage> [10px]');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<length-percentage>', '10px', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <length-percentage> [10px]`);
test(function(){
assert_attribute_get_type('<length-percentage>', 'calc(10px + 10%)', CSSMathSum);
}, 'attributeStyleMap.get returns CSSMathSum for <length-percentage> [calc(10px + 10%)]');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<length-percentage>', 'calc(10px + 10%)', CSSMathSum);
}, name => `${name}.get returns CSSMathSum for <length-percentage> [calc(10px + 10%)]`);
test(function(){
assert_attribute_get_type('<length>', '10px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<length>', '10px', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <length>`);
test(function(){
assert_attribute_get_type('<number>', '42', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <number>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<number>', '42', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <number>`);
test(function(){
assert_attribute_get_type('<percentage>', '10%', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <percentage>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<percentage>', '10%', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <percentage>`);
test(function(){
assert_attribute_get_type('<resolution>', '300dpi', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <resolution>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<resolution>', '300dpi', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <resolution>`);
test(function(){
assert_attribute_get_type('<time>', '42s', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <time>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<time>', '42s', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <time>`);
test(function(){
assert_attribute_get_type('<url>', 'url(a)', CSSStyleValue);
}, 'attributeStyleMap.get returns CSSStyleValue for <url>');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<url>', 'url(a)', CSSStyleValue);
}, name => `${name}.get returns CSSStyleValue for <url>`);
test(function(){
assert_attribute_get_type('thing1 | THING2', 'thing1', CSSKeywordValue);
}, 'attributeStyleMap.get returns CSSKeywordValue for thing1 | THING2');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, 'thing1 | THING2', 'thing1', CSSKeywordValue);
}, name => `${name}.get returns CSSKeywordValue for thing1 | THING2`);
test(function(){
assert_attribute_get_type('<length>+', '10px 20px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length>+');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<length>+', '10px 20px', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <length>+`);
test(function(){
assert_attribute_get_type('<length>#', '10px 20px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length>#');
test_style_property_map_get(function(styleDecl, propertyMap){
assert_attribute_get_type(styleDecl, propertyMap, '<length>#', '10px 20px', CSSUnitValue);
}, name => `${name}.get returns CSSUnitValue for <length>#`);
// attributeStyleMap.getAll
test(function(){
test_style_property_map_get(function(styleDecl, propertyMap){
let name = gen_prop('<length>+', '0px');
target.attributeStyleMap.clear();
target.style = `${name}: 10px 20px 30px`;
assert_equals(target.attributeStyleMap.getAll(name).length, 3);
assert_true(target.attributeStyleMap.getAll(name).every(x => x instanceof CSSUnitValue));
}, 'attributeStyleMap.getAll returns a list of CSSUnitValues for <length>+');
styleDecl.setProperty(name, '10px 20px 30px');
assert_equals(propertyMap.getAll(name).length, 3);
assert_true(propertyMap.getAll(name).every(x => x instanceof CSSUnitValue));
}, name => `${name}.getAll returns a list of CSSUnitValues for <length>+`);
test(function(){
test_style_property_map_get(function(styleDecl, propertyMap){
let name = gen_prop('<length>#', '0px');
target.attributeStyleMap.clear();
target.style = `${name}: 10px, 20px, 30px`;
assert_equals(target.attributeStyleMap.getAll(name).length, 3);
assert_true(target.attributeStyleMap.getAll(name).every(x => x instanceof CSSUnitValue));
}, 'attributeStyleMap.getAll returns a list of CSSUnitValues for <length>#');
styleDecl.setProperty(name, '10px, 20px, 30px');
assert_equals(propertyMap.getAll(name).length, 3);
assert_true(propertyMap.getAll(name).every(x => x instanceof CSSUnitValue));
}, name => `${name}.getAll returns a list of CSSUnitValues for <length>#`);
// StylePropertyMap.set

View file

@ -1,5 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<link rel=stylesheet href=../include/reset.css>
<title>backcolor - HTML editing conformance tests</title>

View file

@ -1,5 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">

View file

@ -1,5 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<link rel=stylesheet href=../include/reset.css>
<title>createlink - HTML editing conformance tests</title>

View file

@ -1,5 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<link rel=stylesheet href=../include/reset.css>
<title>delete list items in table cells - HTML editing conformance tests</title>

View file

@ -1,5 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-3000">

View file

@ -1,5 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<meta name="variant" content="?1-1000">
<meta name="variant" content="?1001-2000">
<meta name="variant" content="?2001-last">

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