mirror of
https://github.com/servo/servo.git
synced 2025-08-19 12:25:33 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>img element src attribute must match src list.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>img element src attribute must match src list.</h1>
|
||||
<p>
|
||||
<div id='log'></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var t1 = async_test("img-src for relative path should load.");
|
||||
var t2 = async_test("img-src from unapproved domains should not load");
|
||||
var t3 = async_test("img-src from approved domains should load");
|
||||
</script>
|
||||
|
||||
<img src='/content-security-policy/support/pass.png'
|
||||
onerror='t1.step(function() { assert_unreached("The img should have loaded."); t1.done() });'
|
||||
onload='t1.done();'>
|
||||
|
||||
<img src='http://www1.web-platform.test/content-security-policy/support/fail.png'
|
||||
onerror='t2.done();'
|
||||
onload='t2.step(function() { assert_unreached("Image from unapproved domain was loaded."); t2.done()} );'>
|
||||
|
||||
<div id='t3'></div>
|
||||
|
||||
<script>
|
||||
var t3img = document.createElement('img');
|
||||
t3img.onerror = function() {t3.step(function() { assert_unreached(); t3.done();})}
|
||||
t3img.onload = function() {t3.done();}
|
||||
t3img.src = location.protocol + '//www.' + location.hostname + ':' + location.port +
|
||||
'/content-security-policy/support/pass.png';
|
||||
var t3div = document.getElementById('t3');
|
||||
t3div.appendChild(t3img);
|
||||
|
||||
var report = document.createElement('script');
|
||||
report.src = '../support/checkReport.sub.js?reportField=violated-directive&reportValue=img-src%20%27self%27%20www.' + location.hostname + (location.port ? ':' + location.port : '');
|
||||
t3div.appendChild(report);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
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: img-src-4_1={{$id:uuid()}}; Path=/content-security-policy/img-src/
|
||||
Content-Security-Policy: img-src 'self' www.{{host}}:{{ports[http][0]}}; report-uri ../support/report.py?op=put&reportID={{$id}}
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src 'self' {{domains[www]}}:{{ports[http][0]}}">
|
||||
<html>
|
||||
<head>
|
||||
<title>img element src attribute must match src list.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='log'/>
|
||||
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
i = new Image();
|
||||
i.onload = t.step_func_done();
|
||||
i.onerror = t.unreached_func("The img should have loaded");
|
||||
i.src = '/content-security-policy/support/pass.png';
|
||||
}, "img-src for relative path should load");
|
||||
|
||||
async_test(function(t) {
|
||||
i = new Image();
|
||||
i.onload = t.unreached_func("Image from unapproved domain was loaded.");
|
||||
i.onerror = t.step_func_done();
|
||||
i.src = 'http://{{domains[www1]}}/content-security-policy/support/fail.png';
|
||||
}, "img-src from unapproved domains should not load");
|
||||
|
||||
async_test(function(t) {
|
||||
i = new Image();
|
||||
i.onload = t.step_func_done();
|
||||
i.onerror = t.unreached_func("The img should have loaded");
|
||||
i.src = location.protocol + '//{{domains[www]}}:{{ports[http][0]}}/content-security-policy/support/pass.png';
|
||||
}, "img-src from approved domains should load");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src *.{{host}}:{{ports[http][0]}}">
|
||||
<html>
|
||||
<head>
|
||||
<title>img-src with full host and wildcard blocks correctly.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='log'/>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("img src does not match full host and wildcard csp directive");
|
||||
</script>
|
||||
<img src='http://{{host}}:{{ports[http][0]}}/content-security-policy/support/fail.png'
|
||||
onload='t1.step(function() { assert_unreached("Image should have loaded"); t1.done(); });'
|
||||
onerror='t1.done();'>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src *.{{host}}:{{ports[http][0]}}">
|
||||
<html>
|
||||
<head>
|
||||
<title>img-src works correctly with partial host wildcard.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='log'/>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("img src matches correctly partial wildcard host csp directive");
|
||||
</script>
|
||||
<img src='http://{{domains[www]}}:{{ports[http][0]}}/content-security-policy/support/pass.png'
|
||||
onload='t1.done();'
|
||||
onerror='t1.step(function() { assert_unreached("Image should have loaded"); t1.done(); });'>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src 'none';">
|
||||
<html>
|
||||
<head>
|
||||
<title>img element src attribute must match src list.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='log'/>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("img-src with 'none' source should not match");
|
||||
</script>
|
||||
<img src='/content-security-policy/support/fail.png'
|
||||
onload='t1.step(function() { assert_unreached("Image should not have loaded"); t1.done(); });'
|
||||
onerror='t1.done();'>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src http://www.{{host}}:*">
|
||||
<html>
|
||||
<head>
|
||||
<title>img-src works correctly with port wildcard source</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='log'/>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("img-src with wildcard port should match any port");
|
||||
</script>
|
||||
<img src='http://{{domains[www]}}:{{ports[http][0]}}/content-security-policy/support/pass.png'
|
||||
onload='t1.done();'
|
||||
onerror='t1.step(function() { assert_unreached("Image should have loaded."); t1.done()} );'>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src *;">
|
||||
<html>
|
||||
<head>
|
||||
<title>img element src attribute must match src list.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='log'/>
|
||||
|
||||
<script>
|
||||
var t1 = async_test("img-src with wildcard should match all");
|
||||
</script>
|
||||
<img src='/content-security-policy/support/pass.png'
|
||||
onload='t1.done();'
|
||||
onerror='t1.step(function() { assert_unreached("Image should have loaded"); t1.done(); });'>
|
||||
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
|
||||
var pngBase64 = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAnklEQVR42u3QMQEAAAgDoGlyo1vBzwciUJlw1ApkyZIlS5YsBbJkyZIlS5YCWbJkyZIlS4EsWbJkyZKlQJYsWbJkyVIgS5YsWbJkKZAlS5YsWbIUyJIlS5YsWQpkyZIlS5YsBbJkyZIlS5YCWbJkyZIlS4EsWbJkyZKlQJYsWbJkyVIgS5YsWbJkKZAlS5YsWbIUyJIlS5YsWQpkyfq2MosBSIeKONMAAAAASUVORK5CYII=";
|
||||
|
||||
blobContents = [atob(pngBase64)];
|
||||
blob = new Blob(blobContents, {type: "image/png"});
|
||||
img = document.createElement("img");
|
||||
img.onerror = function (e) {
|
||||
t.done();
|
||||
};
|
||||
img.onload = function () {
|
||||
assert_unreached("Should not load blob img");
|
||||
t.done();
|
||||
};
|
||||
blobURL = window.URL.createObjectURL(blob);
|
||||
img.src = blobURL;
|
||||
|
||||
},"img-src with wildcard should not match blob");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue