mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision abd18b3e018d25ed668d179c905b7869dca5e239
This commit is contained in:
parent
908a642063
commit
158f7eec0e
117 changed files with 2997 additions and 434 deletions
|
@ -4,10 +4,10 @@
|
|||
<script src="./support/testharness-helper.sub.js"></script>
|
||||
<body></body>
|
||||
<script>
|
||||
function waitForViolation(el, t, policy, blocked_origin) {
|
||||
function waitForViolation(el, t, policy, blockedURI) {
|
||||
return new Promise(resolve => {
|
||||
el.addEventListener('securitypolicyviolation', e => {
|
||||
if (e.originalPolicy == policy && (new URL(e.blockedURI)).origin == blocked_origin)
|
||||
if (e.originalPolicy == policy && e.blockedURI == blockedURI)
|
||||
resolve(e);
|
||||
else
|
||||
t.unreached_func("Unexpected violation event for " + e.blockedURI)();
|
||||
|
@ -21,7 +21,7 @@
|
|||
i.src = redirect.url;
|
||||
|
||||
// Report-only policy should trigger a violation on the redirected request.
|
||||
waitForViolation(window, t, "img-src https:", (new URL(redirect.target)).origin).then(t.step_func(e => {
|
||||
waitForViolation(window, t, "img-src https:", new URL(redirect.url, window.location).href).then(t.step_func(e => {
|
||||
t.done();
|
||||
}));
|
||||
|
||||
|
|
|
@ -40,5 +40,18 @@ async_test(t => {
|
|||
.catch(t.step_func(e => assert_true(e instanceof TypeError)));
|
||||
}, "SecurityPolicyViolation event fired on global.");
|
||||
|
||||
async_test(t => {
|
||||
var url = "{{location[scheme]}}://{{host}}:{{location[port]}}/common/redirect.py?location={{location[scheme]}}://{{domains[www]}}:{{location[port]}}/content-security-policy/support/ping.js";
|
||||
waitUntilCSPEventForURL(t, url)
|
||||
.then(t.step_func_done(e => {
|
||||
assert_equals(e.blockedURI, url);
|
||||
assert_false(cspEventFiredInDocument);
|
||||
}));
|
||||
|
||||
fetch(url)
|
||||
.then(t.unreached_func("Fetch should not succeed."))
|
||||
.catch(t.step_func(e => assert_true(e instanceof TypeError)));
|
||||
}, "SecurityPolicyViolation event fired on global with the correct blockedURI.");
|
||||
|
||||
// Worker tests need an explicit `done()`.
|
||||
done();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue