Commit 2bd1b996 authored by Chromium WPT Sync's avatar Chromium WPT Sync Committed by Commit Bot

Import wpt@7feb47d66b5197715742d0aaff8c9cf0230b8cd1

Using wpt-import in Chromium 3d601f27.
With Chromium commits locally applied on WPT:
ec83d167 "Update performance.measureMemory to the latest proposal"
d5cd6b98 "SharedWorker: Assign unique names to SharedWorkers to avoid unintentional matching"
48b21f05 "Remove `tentative` flag from Fetch Metadata tests."


Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
mkwst@chromium.org, andypaicu@chromium.org:
  external/wpt/content-security-policy

NOAUTOREVERT=true
TBR=lpz

No-Export: true
Change-Id: I14b91a1dc5a26e6cdffd3d78f12cbcbf305cf61b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063073Reviewed-by: default avatarWPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#742671}
parent ad256863
This is a testharness.js-based test.
PASS Basic nonce tests for meh in HTML namespace
PASS Ensure that removal of content attribute does not affect IDL attribute for meh in HTML namespace
PASS Basic nonce tests for div in HTML namespace
PASS Ensure that removal of content attribute does not affect IDL attribute for div in HTML namespace
PASS Basic nonce tests for script in HTML namespace
PASS Ensure that removal of content attribute does not affect IDL attribute for script in HTML namespace
FAIL Basic nonce tests for meh in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected "x" but got ""
FAIL Ensure that removal of content attribute does not affect IDL attribute for meh in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected "x" but got ""
FAIL Basic nonce tests for svg in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected "x" but got ""
FAIL Ensure that removal of content attribute does not affect IDL attribute for svg in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected "x" but got ""
FAIL Basic nonce tests for script in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected "x" but got ""
FAIL Ensure that removal of content attribute does not affect IDL attribute for script in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected "x" but got ""
Harness: the test ran to completion.
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
[["meh", ""],
["div", ""],
["script", ""],
["meh", "http://www.w3.org/2000/svg"],
["svg", "http://www.w3.org/2000/svg"], ,
["script", "http://www.w3.org/2000/svg"]].forEach(([localName, namespace]) => {
test(t => {
const element = namespace === "" ? document.createElement(localName) : document.createElementNS(namespace, localName);
t.add_cleanup(() => element.remove());
assert_equals(element.nonce, "", "Initial IDL attribute value");
element.setAttribute("nonce", "x");
assert_equals(element.nonce, "x", "IDL attribute is modified after content attribute set");
assert_equals(element.getAttribute("nonce"), "x", "Content attribute is modified after content attribute set");
document.body.appendChild(element);
assert_equals(element.nonce, "x", "IDL attribute is unchanged after element insertion");
assert_equals(element.getAttribute("nonce"), "", "Content attribute is changed after element insertion");
}, `Basic nonce tests for ${localName} in ${namespace === "" ? "HTML" : "SVG"} namespace`);
test(t => {
const element = namespace === "" ? document.createElement(localName) : document.createElementNS(namespace, localName);
element.setAttribute("nonce", "x");
assert_equals(element.nonce, "x", "IDL attribute is modified after content attribute set");
element.removeAttribute("nonce");
assert_equals(element.nonce, "", "IDL attribute is empty after content attribute removal");
}, `Ensure that removal of content attribute does not affect IDL attribute for ${localName} in ${namespace === "" ? "HTML" : "SVG"} namespace`);
});
</script>
......@@ -72,6 +72,8 @@
var s = document.createElement('script');
s.innerText = script.innerText;
s.nonce = 'abc';
assert_equals(s.nonce, 'abc');
assert_equals(s.getAttribute('nonce'), null);
document.head.appendChild(s);
assert_equals(s.nonce, 'abc');
assert_equals(s.getAttribute('nonce'), null);
......@@ -119,12 +121,11 @@
#cssTest[nonce=abc] { background: url(/security/resources/abe.png); }
</style>
<script nonce="abc" id="cssTest">
async_test(t => {
requestAnimationFrame(t.step_func_done(_ => {
var script = document.querySelector('#cssTest');
var style = getComputedStyle(script);
assert_equals(style['display'], 'block');
assert_equals(style['background-image'], "url(\"http://{{domains[]}}:{{ports[http][0]}}/security/resources/abe.png\")");
}));
test(t => {
const script = document.querySelector('#cssTest');
t.add_cleanup(() => script.remove());
var style = getComputedStyle(script);
assert_equals(style['display'], 'block');
assert_equals(style['background-image'], "url(\"http://{{domains[]}}:{{ports[http][0]}}/security/resources/abe.png\")");
}, "Nonces leak via CSS side-channels.");
</script>
......@@ -73,6 +73,8 @@
var s = document.createElement('script');
s.innerText = script.innerText;
s.nonce = 'abc';
assert_equals(s.nonce, 'abc');
assert_equals(s.getAttribute('nonce'), null);
document.head.appendChild(s);
assert_equals(s.nonce, 'abc');
assert_equals(s.getAttribute('nonce'), null);
......@@ -160,12 +162,11 @@
#cssTest[nonce=abc] { background: url(/security/resources/abe.png); }
</style>
<script nonce="abc" id="cssTest">
async_test(t => {
requestAnimationFrame(t.step_func_done(_ => {
var script = document.querySelector('#cssTest');
var style = getComputedStyle(script);
assert_equals(style['display'], 'block');
assert_equals(style['background-image'], 'none');
}));
test(t => {
const script = document.querySelector('#cssTest');
t.add_cleanup(() => script.remove());
var style = getComputedStyle(script);
assert_equals(style['display'], 'block');
assert_equals(style['background-image'], 'none');
}, "Nonces don't leak via CSS side-channels.");
</script>
......@@ -96,21 +96,3 @@
assert_equals(innerScript.getAttribute('nonce'), 'abc', "Post-insertion content");
}, "createElement.setAttribute.");
</script>
<!-- CSS Leakage -->
<style>
#cssTest { display: block; }
#cssTest[nonce=abc] { background: url(/security/resources/abe.png); }
</style>
<svg xmlns="http://www.w3.org/2000/svg">
<script nonce="abc" id="cssTest">
async_test(t => {
requestAnimationFrame(t.step_func_done(_ => {
var script = document.querySelector('#cssTest');
var style = getComputedStyle(script);
assert_equals(style['display'], 'block');
assert_equals(style['background-image'], "url(\"http://{{domains[]}}:{{ports[http][0]}}/security/resources/abe.png\")");
}));
}, "Nonces don't leak via CSS side-channels.");
</script>
</svg>
......@@ -96,21 +96,3 @@
assert_equals(innerScript.getAttribute('nonce'), '', "Post-insertion content");
}, "createElement.setAttribute.");
</script>
<!-- CSS Leakage -->
<style>
#cssTest { display: block; }
#cssTest[nonce=abc] { background: url(/security/resources/abe.png); }
</style>
<svg xmlns="http://www.w3.org/2000/svg">
<script nonce="abc" id="cssTest">
async_test(t => {
requestAnimationFrame(t.step_func_done(_ => {
var script = document.querySelector('#cssTest');
var style = getComputedStyle(script);
assert_equals(style['display'], 'block');
assert_equals(style['background-image'], 'none');
}));
}, "Nonces don't leak via CSS side-channels.");
</script>
</svg>
This is a testharness.js-based test.
PASS setting up
PASS Fetch cross-origin cors from service-worker and CacheStorage.
PASS Fetch cross-origin no-cors from service-worker and CacheStorage.
PASS Fetch same-origin cors from service-worker and CacheStorage.
PASS Fetch same-origin no-cors from service-worker and CacheStorage.
PASS Fetch same-origin cors cors-disabled corp-cross-origin from network and CacheStorage.
PASS Fetch same-origin cors cors-disabled corp-same-origin from network and CacheStorage.
PASS Fetch same-origin cors cors-disabled corp-undefined from network and CacheStorage.
PASS Fetch same-origin cors cors-enabled corp-cross-origin from network and CacheStorage.
PASS Fetch same-origin cors cors-enabled corp-same-origin from network and CacheStorage.
PASS Fetch same-origin cors cors-enabled corp-undefined from network and CacheStorage.
PASS Fetch same-origin no-cors cors-disabled corp-cross-origin from network and CacheStorage.
PASS Fetch same-origin no-cors cors-disabled corp-same-origin from network and CacheStorage.
PASS Fetch same-origin no-cors cors-disabled corp-undefined from network and CacheStorage.
PASS Fetch same-origin no-cors cors-enabled corp-cross-origin from network and CacheStorage.
PASS Fetch same-origin no-cors cors-enabled corp-same-origin from network and CacheStorage.
PASS Fetch same-origin no-cors cors-enabled corp-undefined from network and CacheStorage.
PASS Fetch cross-origin cors cors-disabled corp-cross-origin from network and CacheStorage.
PASS Fetch cross-origin cors cors-disabled corp-same-origin from network and CacheStorage.
PASS Fetch cross-origin cors cors-disabled corp-undefined from network and CacheStorage.
PASS Fetch cross-origin cors cors-enabled corp-cross-origin from network and CacheStorage.
PASS Fetch cross-origin cors cors-enabled corp-same-origin from network and CacheStorage.
PASS Fetch cross-origin cors cors-enabled corp-undefined from network and CacheStorage.
PASS Fetch cross-origin no-cors cors-disabled corp-cross-origin from network and CacheStorage.
PASS Fetch cross-origin no-cors cors-disabled corp-same-origin from network and CacheStorage.
FAIL Fetch cross-origin no-cors cors-disabled corp-undefined from network and CacheStorage. promise_reject_js: function "function() { throw e }" threw object "InvalidAccessError: Failed Cross-Origin-Resource-Policy check." ("InvalidAccessError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Fetch cross-origin no-cors cors-enabled corp-cross-origin from network and CacheStorage.
PASS Fetch cross-origin no-cors cors-enabled corp-same-origin from network and CacheStorage.
FAIL Fetch cross-origin no-cors cors-enabled corp-undefined from network and CacheStorage. promise_reject_js: function "function() { throw e }" threw object "InvalidAccessError: Failed Cross-Origin-Resource-Policy check." ("InvalidAccessError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
Harness: the test ran to completion.
......@@ -110,7 +110,7 @@ function test(
const cache = await caches.open('v1');
if (response_type === 'error') {
await promise_rejects_dom(t, 'InvalidAccessError', cache.match(url));
await promise_rejects_js(t, TypeError, cache.match(url));
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment