Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326

This commit is contained in:
Josh Matthews 2017-10-12 09:25:50 -04:00
parent 462c272380
commit 1f531f66ea
5377 changed files with 174916 additions and 84369 deletions

View file

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Window.open should not open javascript url if not allowed.</title>
<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("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");
}));
window.open('javascript:test(function() { assert_unreached("FAIL")});', 'new');
</script>
<script nonce='abc' async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27nonce-abc%27'></script>
</body>
</html>

View file

@ -0,0 +1,6 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: javascript-window-open-blocked={{$id:uuid()}}; Path=/content-security-policy/script-src/
Content-Security-Policy: script-src 'nonce-abc'; report-uri ../support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,28 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Multiple policies with different hashing algorithms still work.</title>
<!-- nonces are here just to let all of our scripts run -->
<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("Test that script executes if allowed by proper hash values");
document.addEventListener("securitypolicyviolation", t.unreached_func("Should not have triggered a security event"));
var executed = false;
</script>
<!-- test will fail if this script is not allowed to run -->
<script>executed = true;</script>
<script nonce="abc">
t.step(function() {
assert_true(executed);
t.done();
});
</script>
<script nonce="abc" async defer src='../support/checkReport.sub.js?reportExists=false'></script>
</body>
</html>

View file

@ -0,0 +1,7 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: script-src-multiple-policies-multiple-hashing-algorithms={{$id:uuid()}}; Path=/content-security-policy/script-src/
Content-Security-Policy: script-src 'sha256-EpVP4fTImWaRzBRBw/wrdfLhGTe/1U+CaBP1LNeKUIE=' 'nonce-abc'; report-uri ../support/report.py?op=put&reportID={{$id}}
Content-Security-Policy: script-src 'sha384-skw7BVxHbmE2umPGMd1kX+ye6qBeHAb875erPoD8ilKv1LkjKR+WFi7N85ORMdhS' 'nonce-abc'; report-uri ../support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,28 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Multiple policies some using hashes some not using hashes still work.</title>
<!-- nonces are here just to let all of our scripts run -->
<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("Test that script executes if allowed by proper hash values");
document.addEventListener("securitypolicyviolation", t.unreached_func("Should not have triggered a security event"));
var executed = false;
</script>
<!-- test will fail if this script is not allowed to run -->
<script>executed = true;</script>
<script nonce="abc">
t.step(function() {
assert_true(executed);
t.done();
});
</script>
<script nonce="abc" async defer src='../support/checkReport.sub.js?reportExists=false'></script>
</body>
</html>

View file

@ -0,0 +1,7 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: script-src-multiple-policies-multiple-hashing-algorithms-work={{$id:uuid()}}; Path=/content-security-policy/script-src/
Content-Security-Policy: script-src 'sha256-EpVP4fTImWaRzBRBw/wrdfLhGTe/1U+CaBP1LNeKUIE=' 'nonce-abc'; report-uri ../support/report.py?op=put&reportID={{$id}}
Content-Security-Policy: script-src 'self' 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML>
<html>
<head>
<title>A report-only policy that does not allow a script should not affect an enforcing policy using hashes.</title>
<!-- nonces are here just to let all of our scripts run -->
<script nonce="abc" src='/resources/testharness.js'></script>
<script nonce="abc" src='/resources/testharnessreport.js'></script>
</head>
<body>
<script nonce="abc">
var externalRan = false;
</script>
<script src='./externalScript.js'
integrity="sha256-wIc3KtqOuTFEu6t17sIBuOswgkV406VJvhSk79Gw6U0="></script>
<script nonce="abc">
test(function() {
assert_true(externalRan, 'External script ran.');
}, 'External script in a script tag with matching SRI hash should run.');
</script>
<script nonce="abc" async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27nonce-abc%27'></script>
</body>
</html>

View file

@ -0,0 +1,7 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: script-src-report-only-policy-works-with-external-hash-policy={{$id:uuid()}}; Path=/content-security-policy/script-src/
Content-Security-Policy: script-src 'sha256-wIc3KtqOuTFEu6t17sIBuOswgkV406VJvhSk79Gw6U0=' 'nonce-abc'
Content-Security-Policy-Report-Only: script-src 'nonce-abc'; report-uri ../support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<head>
<title>A report-only policy that does not allow a script should not affect an enforcing policy using hashes.</title>
<!-- nonces are here just to let all of our scripts run -->
<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("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.disposition, "report");
assert_equals(e.blockedURI, "inline");
}));
var executed = false;
</script>
<!-- test will fail if this script is not allowed to run -->
<script>executed = true;</script>
<script nonce="abc">
t.step(function() {
assert_true(executed);
t.done();
});
</script>
<script nonce="abc" async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27nonce-abc%27'></script>
</body>
</html>

View file

@ -0,0 +1,7 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: script-src-report-only-policy-works-with-hash-policy={{$id:uuid()}}; Path=/content-security-policy/script-src/
Content-Security-Policy: script-src 'sha256-EpVP4fTImWaRzBRBw/wrdfLhGTe/1U+CaBP1LNeKUIE=' 'nonce-abc'
Content-Security-Policy-Report-Only: script-src 'nonce-abc'; report-uri ../support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='../support/testharness-helper.js'></script>
<meta http-equiv="content-security-policy" content="script-src 'nonce-abc' 'strict-dynamic'">
<script nonce="abc">
async_test(t => {
assert_no_csp_event_for_url(t, "../support/import-scripts.js");
var w = new Worker("../support/import-scripts.js");
assert_no_event(t, w, "error");
waitUntilEvent(w, "message")
.then(t.step_func_done(e => {
assert_true(e.data.executed);
}));
}, "`importScripts(...)` is allowed by 'strict-dynamic'");
</script>