mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d
This commit is contained in:
parent
c45192614c
commit
775b784f79
2144 changed files with 58115 additions and 29658 deletions
|
@ -1,2 +1,3 @@
|
|||
spec: https://w3c.github.io/webappsec-csp/
|
||||
suggested_reviewers:
|
||||
- hillbrad
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/webappsec-csp/embedded/
|
||||
|
||||
'use strict';
|
||||
|
||||
promise_test(async () => {
|
||||
const idl = await fetch('/interfaces/csp-embedded-enforcement.idl').then(r => r.text());
|
||||
const html = await fetch('/interfaces/html.idl').then(r => r.text());
|
||||
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(html);
|
||||
idl_array.add_dependency_idls(dom);
|
||||
idl_array.add_objects({
|
||||
HTMLIFrameElement: ['document.createElement("iframe")'],
|
||||
});
|
||||
idl_array.test();
|
||||
}, 'csp-embedded-enforcement IDL');
|
|
@ -7,7 +7,8 @@
|
|||
var watcher = new EventWatcher(t, document, 'securitypolicyviolation');
|
||||
watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => {
|
||||
assert_equals(e.blockedURI, "eval");
|
||||
assert_equals(e.lineNumber, 14);
|
||||
assert_equals(e.lineNumber, 15);
|
||||
assert_equals(e.columnNumber, 12);
|
||||
}));
|
||||
|
||||
try {
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
var watcher = new EventWatcher(t, document, 'securitypolicyviolation');
|
||||
watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => {
|
||||
assert_equals(e.blockedURI, "inline");
|
||||
assert_equals(e.lineNumber, 14);
|
||||
assert_equals(e.lineNumber, 15);
|
||||
assert_equals(e.columnNumber, 1);
|
||||
}));
|
||||
}, "Inline violations have a blockedURI of 'inline'");
|
||||
</script>
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script type="text/plain" id="untested">
|
||||
enum SecurityPolicyViolationEventDisposition {
|
||||
"enforce", "report"
|
||||
};
|
||||
|
||||
dictionary SecurityPolicyViolationEventInit : EventInit {
|
||||
DOMString documentURI;
|
||||
DOMString referrer;
|
||||
DOMString blockedURI;
|
||||
DOMString violatedDirective;
|
||||
DOMString effectiveDirective;
|
||||
DOMString originalPolicy;
|
||||
DOMString sourceFile;
|
||||
SecurityPolicyViolationEventDisposition disposition;
|
||||
unsigned short statusCode;
|
||||
long lineNumber;
|
||||
long columnNumber;
|
||||
};
|
||||
</script>
|
||||
<script type="text/plain" id="tested">
|
||||
[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict)]
|
||||
interface SecurityPolicyViolationEvent : Event {
|
||||
readonly attribute DOMString documentURI;
|
||||
readonly attribute DOMString referrer;
|
||||
readonly attribute DOMString blockedURI;
|
||||
readonly attribute DOMString violatedDirective;
|
||||
readonly attribute DOMString effectiveDirective;
|
||||
readonly attribute DOMString originalPolicy;
|
||||
readonly attribute DOMString sourceFile;
|
||||
readonly attribute SecurityPolicyViolationEventDisposition disposition;
|
||||
readonly attribute unsigned short statusCode;
|
||||
readonly attribute long lineNumber;
|
||||
readonly attribute long columnNumber;
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
promise_test(async function() {
|
||||
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_untested_idls(document.querySelector('#untested').textContent);
|
||||
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
|
||||
idl_array.add_idls(document.querySelector('#tested').textContent);
|
||||
idl_array.add_objects({
|
||||
SecurityPolicyViolationEvent: ['new SecurityPolicyViolationEvent({})']
|
||||
});
|
||||
idl_array.test();
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/webappsec-csp/
|
||||
|
||||
'use strict';
|
||||
|
||||
idl_test(
|
||||
['CSP'],
|
||||
['dom'],
|
||||
idl_array => {
|
||||
idl_array.add_objects({
|
||||
SecurityPolicyViolationEvent: [
|
||||
'new SecurityPolicyViolationEvent("securitypolicyviolation")'
|
||||
]
|
||||
})
|
||||
},
|
||||
'Test Content Security Policy IDL implementation'
|
||||
);
|
|
@ -35,20 +35,30 @@
|
|||
}))
|
||||
.then(t.step_func(e => {
|
||||
assert_equals(e.blockedURI, "inline");
|
||||
assert_equals(e.lineNumber, 132);
|
||||
assert_equals(e.target, document, "Disconnected elements target the document");
|
||||
assert_equals(e.lineNumber, 118);
|
||||
assert_equals(e.columnNumber, 4);
|
||||
assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document.");
|
||||
return watcher.wait_for('securitypolicyviolation');
|
||||
}))
|
||||
.then(t.step_func(e => {
|
||||
assert_equals(e.blockedURI, "inline");
|
||||
assert_equals(e.lineNumber, 143);
|
||||
assert_equals(e.target, document, "Elements disconnected after triggering target the document.");
|
||||
assert_equals(e.lineNumber, 131);
|
||||
assert_equals(e.columnNumber, 4);
|
||||
assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document.");
|
||||
return watcher.wait_for('securitypolicyviolation');
|
||||
}))
|
||||
.then(t.step_func(e => {
|
||||
assert_equals(e.blockedURI, "inline");
|
||||
assert_equals(e.lineNumber, 157);
|
||||
assert_equals(e.target, document, "Elements in DocumentFragments target the document");
|
||||
assert_equals(e.lineNumber, 139);
|
||||
assert_equals(e.columnNumber, 4);
|
||||
assert_equals(e.target, document, "Inline event handlers for disconnected elements target the document.");
|
||||
return watcher.wait_for('securitypolicyviolation');
|
||||
}))
|
||||
.then(t.step_func(e => {
|
||||
assert_equals(e.blockedURI, "inline");
|
||||
assert_equals(e.lineNumber, 0);
|
||||
assert_equals(e.columnNumber, 0);
|
||||
assert_equals(e.target, document, "Inline event handlers for elements disconnected after triggering target the document.");
|
||||
}))
|
||||
.then(t.step_func_done(_ => {
|
||||
unexecuted_test.done();
|
||||
|
@ -119,7 +129,6 @@
|
|||
assert_equals(events, 2);
|
||||
}));
|
||||
document.querySelector('#block6').contentDocument.body.appendChild(d);
|
||||
d.click();
|
||||
}, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document.");
|
||||
</script>
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@
|
|||
|
||||
if(data["csp-report"] != undefined && data["csp-report"][reportField] != undefined) {
|
||||
assert_field_value(data["csp-report"][reportField], reportValue, reportField);
|
||||
} else if (data[0] != undefined && data[0]["report"] != undefined && data[0]["report"][reportField] != undefined) {
|
||||
assert_field_value(data[0]["report"][reportField], reportValue, reportField);
|
||||
} else if (data[0] != undefined && data[0]["body"] != undefined && data[0]["body"][reportField] != undefined) {
|
||||
assert_field_value(data[0]["body"][reportField], reportValue, reportField);
|
||||
} else {
|
||||
assert_equals("", reportField, "Expected report field could not be found in report");
|
||||
}
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
var url = new URL("../support/ping.js", document.baseURI).toString();
|
||||
assert_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
||||
if (document.getElementById("foo").hasAttribute("blocked-worker"))
|
||||
assert_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
||||
else
|
||||
assert_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
|
@ -1,2 +1,5 @@
|
|||
var url = new URL("../support/ping.js", document.baseURI).toString();
|
||||
assert_service_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
||||
if (document.getElementById("foo").hasAttribute("blocked-worker"))
|
||||
assert_service_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
||||
else
|
||||
assert_service_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
|
@ -1,2 +1,5 @@
|
|||
var url = new URL("../support/ping.js", document.baseURI).toString();
|
||||
assert_shared_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
||||
if (document.getElementById("foo").hasAttribute("blocked-worker"))
|
||||
assert_shared_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
||||
else
|
||||
assert_shared_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Web platform test for dedicated worker allowed by worker-src self</title>
|
||||
<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="child-src 'none'; script-src 'self'; default-src 'none'; ">
|
||||
<script src="../support/dedicated-worker-helper.js" blocked-worker id="foo" data-desc-fallback="Same-origin dedicated worker allowed by worker-src 'self'."></script>
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Web platform test for service worker allowed by child-src self</title>
|
||||
<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="child-src 'none'; script-src 'self'; default-src 'none'; ">
|
||||
<script src="../support/service-worker-helper.js" blocked-worker id="foo" data-desc-fallback="Same-origin service worker allowed by child-src 'self'."></script>
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Web platform test for shared worker allowed by child-src self</title>
|
||||
<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="child-src 'none'; script-src 'self'; default-src 'none'; ">
|
||||
<script src="../support/shared-worker-helper.js" blocked-worker id="foo" data-desc-fallback="Same-origin shared worker allowed by child-src 'self'."></script>
|
Loading…
Add table
Add a link
Reference in a new issue