Update web-platform-tests to revision 614fd870e47c9f4e76291e5af4e32b676c0acac0

This commit is contained in:
WPT Sync Bot 2018-12-04 20:30:20 -05:00
parent 063bd7ac19
commit b49ffaa0f7
137 changed files with 4756 additions and 721 deletions

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<script nonce="abc" src="/resources/testharness.js"></script>
<script nonce="abc" src="/resources/testharnessreport.js"></script>
</head>
<!-- This tests that navigating a main window to a local scheme preserves the current CSP.
We need to test this in a main window with no parent/opener so we use
a link with target=_blank and rel=noopener. -->
<body>
<iframe src="support/navigate-self-to-blob.html?csp=script-src%20%27nonce-abc%27&report_id={{$id:uuid()}}"></iframe>
<script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27nonce-abc%27&reportID={{$id}}'></script>
</body>
</html>

View file

@ -0,0 +1,102 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta http-equiv="Content-Security-Policy" content="img-src 'self'">
<body>
<script>
function wait_for_error_from_frame(frame, test) {
window.addEventListener('message', test.step_func(e => {
if (e.source != frame.contentWindow)
return;
assert_equals(e.data, "load");
frame.remove();
test.done();
}));
}
async_test(t => {
var i = document.createElement('iframe');
document.body.appendChild(i);
var img = document.createElement('img');
img.onload = t.step_func_done(_ => i.remove());
img.onerror = t.unreached_func();
i.contentDocument.body.appendChild(img);
img.src = "{{location[server]}}/images/red-16x16.png";
}, "<iframe>'s about:blank inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
i.srcdoc = `
<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>
`;
wait_for_error_from_frame(i, t);
document.body.appendChild(i);
}, "<iframe srcdoc>'s inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
var b = new Blob(
[`
<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>
`], {type:"text/html"});
i.src = URL.createObjectURL(b);
wait_for_error_from_frame(i, t);
document.body.appendChild(i);
}, "<iframe src='blob:...'>'s inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
i.src = `data:text/html,<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>`;
wait_for_error_from_frame(i, t);
document.body.appendChild(i);
}, "<iframe src='data:...'>'s inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
i.src = `javascript:"<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage(\\"load\\", \\"*\\");'
onerror='window.top.postMessage(\\"error\\", \\"*\\");'
>"`;
wait_for_error_from_frame(i, t);
document.body.appendChild(i);
}, "<iframe src='javascript:...'>'s inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
var b = new Blob(
[`
<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>
`], {type:"text/html"});
i.src = URL.createObjectURL(b);
i.sandbox = 'allow-scripts';
wait_for_error_from_frame(i, t);
document.body.appendChild(i);
}, "<iframe sandbox src='blob:...'>'s inherits policy. (opaque origin sandbox)");
</script>

View file

@ -25,13 +25,13 @@
img.onerror = t.step_func_done(_ => i.remove());
img.onload = t.unreached_func();
i.contentDocument.body.appendChild(img);
img.src = "/images/red-16x16.png";
img.src = "{{location[server]}}/images/red-16x16.png";
}, "<iframe>'s about:blank inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
i.srcdoc = `
<img src='/images/red-16x16.png'
<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>
@ -46,7 +46,7 @@
var i = document.createElement('iframe');
var b = new Blob(
[`
<img src='${window.origin}/images/red-16x16.png'
<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>
@ -60,7 +60,7 @@
async_test(t => {
var i = document.createElement('iframe');
i.src = `data:text/html,<img src='${window.origin}/images/red-16x16.png'
i.src = `data:text/html,<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>`;
@ -72,7 +72,7 @@
async_test(t => {
var i = document.createElement('iframe');
i.src = `javascript:"<img src='${window.origin}/images/red-16x16.png'
i.src = `javascript:"<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage(\\"load\\", \\"*\\");'
onerror='window.top.postMessage(\\"error\\", \\"*\\");'
>"`;
@ -81,4 +81,22 @@
document.body.appendChild(i);
}, "<iframe src='javascript:...'>'s inherits policy.");
async_test(t => {
var i = document.createElement('iframe');
var b = new Blob(
[`
<img src='{{location[server]}}/images/red-16x16.png'
onload='window.top.postMessage("load", "*");'
onerror='window.top.postMessage("error", "*");'
>
`], {type:"text/html"});
i.src = URL.createObjectURL(b);
i.sandbox = 'allow-scripts';
wait_for_error_from_frame(i, t);
document.body.appendChild(i);
}, "<iframe sandbox src='blob:...'>'s inherits policy. (opaque origin sandbox)");
</script>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script nonce="abc" src="/resources/testharness.js"></script>
<script nonce="abc" src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var blob_string = "<script>alert(document.domain)<\/scr"+"ipt>";
var blob = new Blob([blob_string], {type : 'text/html'});
var url = URL.createObjectURL(blob);
var i = document.createElement('iframe');
i.src = url;
i.sandbox = "allow-scripts";
document.body.appendChild(i);
</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,5 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: sandboxed-blob-scheme={{$id:uuid()}}; Path=/content-security-policy/inheritance/
Content-Security-Policy: script-src 'nonce-abc'; report-uri http://{{host}}:{{ports[http][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script nonce="abc" src="/resources/testharness.js"></script>
<script nonce="abc" src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var url = "data:text/html,<script>alert(document.domain)<\/scr"+"ipt>";
var i = document.createElement('iframe');
i.src = url;
i.sandbox = "allow-scripts";
document.body.appendChild(i);
</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,5 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: sandboxed-data-scheme={{$id:uuid()}}; Path=/content-security-policy/inheritance/
Content-Security-Policy: script-src 'nonce-abc'; report-uri http://{{host}}:{{ports[http][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script nonce="abc" src="/resources/testharness.js"></script>
<script nonce="abc" src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var blob_string = "<script>alert(document.domain)<\/scr"+"ipt>";
var blob = new Blob([blob_string], {type : 'text/html'});
var url = URL.createObjectURL(blob);
var i = document.createElement('iframe');
i.src = url;
document.body.appendChild(i);
</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,5 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: unsandboxed-blob-scheme={{$id:uuid()}}; Path=/content-security-policy/inheritance/
Content-Security-Policy: script-src 'nonce-abc'; report-uri http://{{host}}:{{ports[http][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<script nonce="abc" src="/resources/testharness.js"></script>
<script nonce="abc" src="/resources/testharnessreport.js"></script>
</head>
<body>
<script nonce='abc'>
var url = "data:text/html,<script>alert(document.domain)<\/scri"+"pt>";
var i = document.createElement('iframe');
i.src = url;
document.body.appendChild(i);
</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,5 @@
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: unsandboxed-data-scheme={{$id:uuid()}}; Path=/content-security-policy/inheritance/
Content-Security-Policy: script-src 'nonce-abc'; report-uri http://{{host}}:{{ports[http][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}