Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7

This commit is contained in:
WPT Sync Bot 2018-06-22 21:05:34 -04:00
parent 728ebcc932
commit 8c46b67f8e
456 changed files with 10561 additions and 5108 deletions

View file

@ -1,39 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>FileAPI Test: filereader_readAsDataURL</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://dev.w3.org/2006/webapi/FileAPI/#readAsDataURL">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<!doctype html>
<meta charset="utf-8">
<title>FileAPI Test: FileReader.readAsDataURL</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://w3c.github.io/FileAPI/#readAsDataURL">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function() {
var blob = new Blob(["TEST"]);
var reader = new FileReader();
<script>
async_test(function(testCase) {
var blob = new Blob(["TEST"]);
var reader = new FileReader();
reader.onload = this.step_func(function(evt) {
assert_equals(typeof reader.result, "string", "The result is string");
assert_equals(reader.result.indexOf("data:"), 0, "The result attribute starts with 'data'");
assert_true(reader.result.indexOf("base64") > 0, "The result attribute contains 'base64'");
assert_equals(reader.readyState, reader.DONE);
this.done();
});
reader.onload = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.DONE);
testCase.done();
});
reader.onloadstart = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.LOADING);
});
reader.onprogress = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.LOADING);
});
reader.onloadstart = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.LOADING);
});
reader.readAsDataURL(blob);
}, 'FileReader readyState during readAsDataURL');
reader.onprogress = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.LOADING);
});
async_test(function(testCase) {
var blob = new Blob(["TEST"], { type: 'text/plain' });
var reader = new FileReader();
reader.readAsDataURL(blob);
});
</script>
</body>
</html>
reader.onload = this.step_func(function() {
assert_equals(reader.result, "data:text/plain;base64,VEVTVA==");
testCase.done();
});
reader.readAsDataURL(blob);
}, 'readAsDataURL result for Blob with specified MIME type');
async_test(function(testCase) {
var blob = new Blob(["TEST"]);
var reader = new FileReader();
reader.onload = this.step_func(function() {
assert_equals(reader.result,
"data:application/octet-stream;base64,VEVTVA==");
testCase.done();
});
reader.readAsDataURL(blob);
}, 'readAsDataURL result for Blob with unspecified MIME type');
</script>

View file

@ -97,3 +97,18 @@ async_test(t => {
document.body.appendChild(e);
URL.revokeObjectURL(url);
}, 'Fetching a blob URL immediately before revoking it works in <script> tags.');
async_test(t => {
const channel_name = 'a-click-test';
const blob = new Blob([window_contents_for_channel(channel_name)], {type: 'text/html'});
receive_message_on_channel(t, channel_name).then(t.step_func_done(t => {
assert_equals(t, 'foobar');
}));
const url = URL.createObjectURL(blob);
const anchor = document.createElement('a');
anchor.href = url;
anchor.target = '_blank';
document.body.appendChild(anchor);
anchor.click();
URL.revokeObjectURL(url);
}, 'Opening a blob URL in a new window by clicking an <a> tag works immediately before revoking the URL.');

View file

@ -8,9 +8,13 @@
<script>
indexeddb_test(
(t, db, txn) => {
(t, db, txn, rq) => {
db.createObjectStore('s');
// Acknowledge the error, to prevent window.error from firing in
// browsers that implement that.
rq.onerror = e => { e.preventDefault(); };
txn.onabort = () => {
setTimeout(t.step_func(() => {
assert_throws(

View file

@ -0,0 +1,3 @@
// META: title=WebCryptoAPI: deriveBits() Using ECDH
// META: script=ecdh_bits.js
run_test();

View file

@ -1,4 +0,0 @@
importScripts("/resources/testharness.js");
importScripts("ecdh_bits.js");
run_test();

View file

@ -0,0 +1,3 @@
// META: title=WebCryptoAPI: deriveKey() Using ECDH
// META: script=ecdh_keys.js
run_test();

View file

@ -1,4 +0,0 @@
importScripts("/resources/testharness.js");
importScripts("ecdh_keys.js");
run_test();

View file

@ -0,0 +1,9 @@
// META: title=WebCryptoAPI: deriveBits() and deriveKey() Using HKDF
// META: variant=?1-1000
// META: variant=?1001-2000
// META: variant=?2001-3000
// META: variant=?3001-last
// META: script=/common/subset-tests.js
// META: script=hkdf_vectors.js
// META: script=hkdf.js
run_test();

View file

@ -1,5 +0,0 @@
importScripts("/resources/testharness.js");
importScripts("hkdf_vectors.js");
importScripts("hkdf.js");
run_test();

View file

@ -36,7 +36,7 @@ function run_test() {
var algorithm = {name: "HKDF", salt: salts[saltSize], info: infos[infoSize], hash: hashName};
// Check for correct deriveBits result
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, baseKeys[derivedKeySize], 256)
.then(function(derivation) {
assert_true(equalBuffers(derivation, derivations[derivedKeySize][saltSize][hashName][infoSize]), "Derived correct key");
@ -46,7 +46,7 @@ function run_test() {
}, testName);
// 0 length (OperationError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, baseKeys[derivedKeySize], 0)
.then(function(derivation) {
assert_equals(derivation.byteLength, 0, "Derived correctly empty key");
@ -65,7 +65,7 @@ function run_test() {
testName += " using " + derivedKeySize + " derivedKey, " + saltSize + " salt, " + hashName + ", with " + infoSize + " info";
// Test the particular key derivation.
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey(algorithm, baseKeys[derivedKeySize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
// Need to export the key to see that the correct bits were set.
@ -85,7 +85,7 @@ function run_test() {
// - illegal name for hash algorithm (NotSupportedError)
var badHash = hashName.substring(0, 3) + hashName.substring(4);
promise_test(function(test) {
subsetTest(promise_test, function(test) {
var badAlgorithm = {name: "HKDF", salt: salts[saltSize], hash: badHash};
return subtle.deriveKey(badAlgorithm, baseKeys[derivedKeySize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
@ -96,7 +96,7 @@ function run_test() {
}, testName + " with bad hash name " + badHash);
// - baseKey usages missing "deriveKey" (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey(algorithm, noKey[derivedKeySize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
assert_unreached("missing deriveKey usage should have thrown an InvalidAccessError");
@ -106,7 +106,7 @@ function run_test() {
}, testName + " with missing deriveKey usage");
// - baseKey algorithm does not match HKDF (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey(algorithm, wrongKey, derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
assert_unreached("wrong (ECDH) key should have thrown an InvalidAccessError");
@ -120,7 +120,7 @@ function run_test() {
// Test various error conditions for deriveBits below:
// missing salt (TypeError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "HKDF", info: infos[infoSize], hash: hashName}, baseKeys[derivedKeySize], 0)
.then(function(derivation) {
assert_equals(derivation.byteLength, 0, "Derived even with missing salt");
@ -130,7 +130,7 @@ function run_test() {
}, testName + " with missing salt");
// missing info (TypeError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "HKDF", salt: salts[saltSize], hash: hashName}, baseKeys[derivedKeySize], 0)
.then(function(derivation) {
assert_equals(derivation.byteLength, 0, "Derived even with missing info");
@ -140,7 +140,7 @@ function run_test() {
}, testName + " with missing info");
// length null (OperationError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, baseKeys[derivedKeySize], null)
.then(function(derivation) {
assert_unreached("null length should have thrown an TypeError");
@ -150,7 +150,7 @@ function run_test() {
}, testName + " with null length");
// length not multiple of 8 (OperationError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, baseKeys[derivedKeySize], 44)
.then(function(derivation) {
assert_unreached("non-multiple of 8 length should have thrown an OperationError");
@ -161,7 +161,7 @@ function run_test() {
// - illegal name for hash algorithm (NotSupportedError)
var badHash = hashName.substring(0, 3) + hashName.substring(4);
promise_test(function(test) {
subsetTest(promise_test, function(test) {
var badAlgorithm = {name: "HKDF", salt: salts[saltSize], hash: badHash};
return subtle.deriveBits(badAlgorithm, baseKeys[derivedKeySize], 256)
.then(function(derivation) {
@ -172,7 +172,7 @@ function run_test() {
}, testName + " with bad hash name " + badHash);
// - baseKey usages missing "deriveBits" (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, noBits[derivedKeySize], 256)
.then(function(derivation) {
assert_unreached("missing deriveBits usage should have thrown an InvalidAccessError");
@ -182,7 +182,7 @@ function run_test() {
}, testName + " with missing deriveBits usage");
// - baseKey algorithm does not match HKDF (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, wrongKey, 256)
.then(function(derivation) {
assert_unreached("wrong (ECDH) key should have thrown an InvalidAccessError");
@ -202,7 +202,7 @@ function run_test() {
algorithm.info = infos[infoSize];
}
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits(algorithm, baseKeys[derivedKeySize], 256)
.then(function(derivation) {
assert_unreached("non-digest algorithm should have thrown an NotSupportedError");
@ -218,7 +218,7 @@ function run_test() {
});
testName += " using " + derivedKeySize + " derivedKey, " + saltSize + " salt, " + nonDigestHash + ", with " + infoSize + " info";
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey(algorithm, baseKeys[derivedKeySize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(derivation) {
assert_unreached("non-digest algorithm should have thrown an NotSupportedError");
@ -235,7 +235,7 @@ function run_test() {
done();
}, function(err) {
test(function(test) {
subsetTest(test, function(test) {
assert_unreached("setUpBaseKeys failed with error '" + err.message + "'");
}, "setUpBaseKeys");
done();

View file

@ -0,0 +1,15 @@
// META: title=WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2
// META: timeout=long
// META: variant=?1-1000
// META: variant=?1001-2000
// META: variant=?2001-3000
// META: variant=?3001-4000
// META: variant=?4001-5000
// META: variant=?5001-6000
// META: variant=?6001-7000
// META: variant=?7001-8000
// META: variant=?8001-last
// META: script=/common/subset-tests.js
// META: script=pbkdf2_vectors.js
// META: script=pbkdf2.js
run_test();

View file

@ -1,6 +0,0 @@
// META: timeout=long
importScripts("/resources/testharness.js");
importScripts("pbkdf2_vectors.js");
importScripts("pbkdf2.js");
run_test();

View file

@ -1,4 +1,4 @@
function run_test(testPasswordSize, testSaltSize) {
function run_test() {
// May want to test prefixed implementations.
var subtle = self.crypto.subtle;
@ -27,15 +27,13 @@ function run_test(testPasswordSize, testSaltSize) {
// and number of iterations. The derivations object is structured in
// that way, so navigate it to run tests and compare with correct results.
Object.keys(derivations).forEach(function(passwordSize) {
if (typeof testPasswordSize != 'undefined' && testPasswordSize != passwordSize) return;
Object.keys(derivations[passwordSize]).forEach(function(saltSize) {
if (typeof testSaltSize != 'undefined' && testSaltSize != saltSize) return;
Object.keys(derivations[passwordSize][saltSize]).forEach(function(hashName) {
Object.keys(derivations[passwordSize][saltSize][hashName]).forEach(function(iterations) {
var testName = passwordSize + " password, " + saltSize + " salt, " + hashName + ", with " + iterations + " iterations";
// Check for correct deriveBits result
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, baseKeys[passwordSize], 256)
.then(function(derivation) {
assert_true(equalBuffers(derivation, derivations[passwordSize][saltSize][hashName][iterations]), "Derived correct key");
@ -54,7 +52,7 @@ function run_test(testPasswordSize, testSaltSize) {
testName += " using " + passwordSize + " password, " + saltSize + " salt, " + hashName + ", with " + iterations + " iterations";
// Test the particular key derivation.
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, baseKeys[passwordSize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
// Need to export the key to see that the correct bits were set.
@ -74,7 +72,7 @@ function run_test(testPasswordSize, testSaltSize) {
// - illegal name for hash algorithm (NotSupportedError)
var badHash = hashName.substring(0, 3) + hashName.substring(4);
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey({name: "PBKDF2", salt: salts[saltSize], hash: badHash, iterations: parseInt(iterations)}, baseKeys[passwordSize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
assert_unreached("bad hash name should have thrown an NotSupportedError");
@ -84,7 +82,7 @@ function run_test(testPasswordSize, testSaltSize) {
}, testName + " with bad hash name " + badHash);
// - baseKey usages missing "deriveKey" (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, noKey[passwordSize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
assert_unreached("missing deriveKey usage should have thrown an InvalidAccessError");
@ -94,7 +92,7 @@ function run_test(testPasswordSize, testSaltSize) {
}, testName + " with missing deriveKey usage");
// - baseKey algorithm does not match PBKDF2 (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, wrongKey, derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(key) {
assert_unreached("wrong (ECDH) key should have thrown an InvalidAccessError");
@ -107,7 +105,7 @@ function run_test(testPasswordSize, testSaltSize) {
// Test various error conditions for deriveBits below:
// length null (OperationError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, baseKeys[passwordSize], null)
.then(function(derivation) {
assert_unreached("null length should have thrown an OperationError");
@ -117,7 +115,7 @@ function run_test(testPasswordSize, testSaltSize) {
}, testName + " with null length");
// 0 length (OperationError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, baseKeys[passwordSize], 0)
.then(function(derivation) {
assert_unreached("0 length should have thrown an OperationError");
@ -127,7 +125,7 @@ function run_test(testPasswordSize, testSaltSize) {
}, testName + " with 0 length");
// length not multiple of 8 (OperationError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, baseKeys[passwordSize], 44)
.then(function(derivation) {
assert_unreached("non-multiple of 8 length should have thrown an OperationError");
@ -138,7 +136,7 @@ function run_test(testPasswordSize, testSaltSize) {
// - illegal name for hash algorithm (NotSupportedError)
var badHash = hashName.substring(0, 3) + hashName.substring(4);
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: badHash, iterations: parseInt(iterations)}, baseKeys[passwordSize], 256)
.then(function(derivation) {
assert_unreached("bad hash name should have thrown an NotSupportedError");
@ -148,7 +146,7 @@ function run_test(testPasswordSize, testSaltSize) {
}, testName + " with bad hash name " + badHash);
// - baseKey usages missing "deriveBits" (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, noBits[passwordSize], 256)
.then(function(derivation) {
assert_unreached("missing deriveBits usage should have thrown an InvalidAccessError");
@ -158,7 +156,7 @@ function run_test(testPasswordSize, testSaltSize) {
}, testName + " with missing deriveBits usage");
// - baseKey algorithm does not match PBKDF2 (InvalidAccessError)
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: parseInt(iterations)}, wrongKey, 256)
.then(function(derivation) {
assert_unreached("wrong (ECDH) key should have thrown an InvalidAccessError");
@ -169,7 +167,7 @@ function run_test(testPasswordSize, testSaltSize) {
});
// Check that 0 iterations throws proper error
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: 0}, baseKeys[passwordSize], 256)
.then(function(derivation) {
assert_unreached("0 iterations should have thrown an error");
@ -185,7 +183,7 @@ function run_test(testPasswordSize, testSaltSize) {
});
testName += " using " + passwordSize + " password, " + saltSize + " salt, " + hashName + ", with 0 iterations";
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey({name: "PBKDF2", salt: salts[saltSize], hash: hashName, iterations: 0}, baseKeys[passwordSize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(derivation) {
assert_unreached("0 iterations should have thrown an error");
@ -201,7 +199,7 @@ function run_test(testPasswordSize, testSaltSize) {
[1, 1000, 100000].forEach(function(iterations) {
var testName = passwordSize + " password, " + saltSize + " salt, " + nonDigestHash + ", with " + iterations + " iterations";
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveBits({name: "PBKDF2", salt: salts[saltSize], hash: nonDigestHash, iterations: parseInt(iterations)}, baseKeys[passwordSize], 256)
.then(function(derivation) {
assert_unreached("non-digest algorithm should have thrown an NotSupportedError");
@ -217,7 +215,7 @@ function run_test(testPasswordSize, testSaltSize) {
});
testName += " using " + passwordSize + " password, " + saltSize + " salt, " + nonDigestHash + ", with " + iterations + " iterations";
promise_test(function(test) {
subsetTest(promise_test, function(test) {
return subtle.deriveKey({name: "PBKDF2", salt: salts[saltSize], hash: nonDigestHash, iterations: parseInt(iterations)}, baseKeys[passwordSize], derivedKeyType.algorithm, true, derivedKeyType.usages)
.then(function(derivation) {
assert_unreached("non-digest algorithm should have thrown an NotSupportedError");
@ -234,7 +232,7 @@ function run_test(testPasswordSize, testSaltSize) {
done();
}, function(err) {
test(function(test) {
subsetTest(test, function(test) {
assert_unreached("setUpBaseKeys failed with error '" + err.message + "'");
}, "setUpBaseKeys");
done();

View file

@ -1,17 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() Using ECDH</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="ecdh_bits.js"></script>
<h1>deriveBits Tests for ECDH</h1>
<div id="log"></div>
<script>
run_test();
</script>

View file

@ -1,17 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI:deriveKey() Using ECDH</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="ecdh_keys.js"></script>
<h1>deriveKey Tests for ECDH</h1>
<div id="log"></div>
<script>
run_test();
</script>

View file

@ -1,19 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using HKDF</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="hkdf_vectors.js"></script>
<script src="hkdf.js"></script>
<h1>deriveBits and deriveKey Tests for HKDF</h1>
<div id="log"></div>
<script>
run_test();
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"empty", //password size
"empty" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"empty", //password size
"long" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"empty", //password size
"short" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"long", //password size
"empty" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"long", //password size
"long" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"long", //password size
"short" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"short", //password size
"empty" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"short", //password size
"long" //salt size
);
</script>

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: deriveBits() and deriveKey() Using PBKDF2</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveBits">
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-deriveKey">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="pbkdf2_vectors.js"></script>
<script src="pbkdf2.js"></script>
<h1>deriveBits and deriveKey Tests for PBKDF2</h1>
<div id="log"></div>
<script>
run_test(
"short", //password size
"short" //salt size
);
</script>

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() for Failures
// META: timeout=long
// META: script=../util/helpers.js
// META: script=failures.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: script=../util/helpers.js
// META: script=/common/subset-tests.js

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: variant=?1-10
// META: variant=?11-20

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: variant=?1-10
// META: variant=?11-20

View file

@ -1,3 +1,4 @@
// META: title=WebCryptoAPI: generateKey() Successful Calls
// META: timeout=long
// META: variant=?1-10
// META: variant=?11-20

View file

@ -4,4 +4,4 @@ suggested_reviewers:
- riju
- Honry
- alexshalamov
- pozdnyakov
- rakuco

View file

@ -4,5 +4,5 @@ suggested_reviewers:
- dontcallmedom
- riju
- alexshalamov
- pozdnyakov
- rakuco
- Honry

View file

@ -1,15 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<title>Background Fetch API IDL tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
<h1>idlharness test</h1>
<p>This test validates the WebIDL included in the Background Fetch API (Service Workers).</p>
<script>
'use strict';
service_worker_test('interfaces.worker.js', 'Service Worker-scoped tests.');
</script>

View file

@ -1,28 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<title>Background Fetch API IDL tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<h1>idlharness test</h1>
<p>This test validates the WebIDL included in the Background Fetch API (Documents).</p>
<script>
'use strict';
promise_test(async function () {
const idls = await fetch('/interfaces/background-fetch.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_untested_idls('interface ExtendableEvent{};');
idlArray.add_untested_idls('dictionary ExtendableEventInit{};');
idlArray.add_untested_idls(dom, { only: ['EventTarget'] });
idlArray.add_idls(idls);
idlArray.test();
}, 'Exposed interfaces in a Document.');
</script>

View file

@ -0,0 +1,19 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://wicg.github.io/background-fetch/
promise_test(async () => {
const srcs = ['background-fetch', 'dedicated-workers', 'ServiceWorker', 'dom'];
const [idls, worker, serviceWorker, dom] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
var idlArray = new IdlArray();
idlArray.add_idls(idls);
idlArray.add_dependency_idls(serviceWorker);
idlArray.add_dependency_idls(worker);
idlArray.add_dependency_idls(dom);
idlArray.test();
}, 'background-fetch interfaces');

View file

@ -1,20 +0,0 @@
'use strict';
importScripts('/resources/testharness.js');
importScripts('/resources/WebIDLParser.js', '/resources/idlharness.js');
promise_test(async function() {
const idls = await fetch('/interfaces/background-fetch.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[SecureContext, Exposed = (Window, Worker)] interface ServiceWorkerGlobalScope {};');
idlArray.add_untested_idls('interface ExtendableEvent{};');
idlArray.add_untested_idls('dictionary ExtendableEventInit{};');
idlArray.add_untested_idls(dom, { only: ['EventTarget'] });
idlArray.add_idls(idls);
idlArray.test();
}, 'Exposed interfaces in a Service Worker.');
done();

View file

@ -0,0 +1,17 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/beacon/
promise_test(async () => {
const idl = await fetch('/interfaces/beacon.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
idl_array.add_objects({
Navigator: ['navigator'],
});
idl_array.test();
}, 'beacon interfaces');

View file

@ -0,0 +1,19 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://webbluetoothcg.github.io/web-bluetooth/
promise_test(async () => {
const srcs = ['web-bluetooth', 'dom', 'html', 'permissions'];
const [idl, dom, html, permissions] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(dom);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(permissions);
idl_array.test();
}, 'web-bluetooth interfaces.');

View file

@ -7,7 +7,7 @@
<link rel="help" href="https://console.spec.whatwg.org/#count">
</head>
<body>
<p>Open the console inside the developer tools. It should contain four lines whose contents are:</p>
<p>Open the console inside the developer tools. It should contain four entries whose contents are:</p>
<p><code>default: 1</code></p>
<p><code>default: 2</code></p>
<p><code>default: 3</code></p>

View file

@ -7,7 +7,7 @@
<link rel="help" href="https://console.spec.whatwg.org/#countReset">
</head>
<body>
<p>Open the console inside the developer tools. It should contain lines whose contents are:</p>
<p>Open the console inside the developer tools. It should contain entries whose contents are:</p>
<p><code>default: 1</code></p>
<p><code>default: 1</code></p>
<p><code>default: 1</code></p>

View file

@ -7,7 +7,7 @@
<link rel="help" href="https://console.spec.whatwg.org/#formatter">
</head>
<body>
<p>Open the console inside the developer tools. It should contain 15 lines, each of which are:</p>
<p>Open the console inside the developer tools. It should contain 15 entries, each of which are:</p>
<p><code>NaN</code></p>
<script>

View file

@ -7,7 +7,7 @@
<link rel="help" href="https://console.spec.whatwg.org/#formatter">
</head>
<body>
<p>Open the console inside the developer tools. It should contain five lines, each of which are:</p>
<p>Open the console inside the developer tools. It should contain five entries, each of which are:</p>
<p><code>Symbol(description)</code></p>
<script>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Embedded Enforcement: Subsumption Algorithm - 'unsafe-hashed-attributes' keyword.</title>
<title>Embedded Enforcement: Subsumption Algorithm - 'unsafe-hashes' keyword.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/testharness-helper.sub.js"></script>
@ -9,36 +9,36 @@
<body>
<script>
var tests = [
{ "name": "'unsafe-hashed-attributes' is properly subsumed.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-eval' 'strict-dynamic' 'unsafe-hashed-attributes'",
"returned_csp_1": "style-src http://example1.com/foo/bar.html 'unsafe-hashed-attributes'",
{ "name": "'unsafe-hashes' is properly subsumed.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-eval' 'strict-dynamic' 'unsafe-hashes'",
"returned_csp_1": "style-src http://example1.com/foo/bar.html 'unsafe-hashes'",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "No other keyword has the same effect as 'unsafe-hashed-attributes'.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-hashed-attributes'",
{ "name": "No other keyword has the same effect as 'unsafe-hashes'.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-hashes'",
"returned_csp_1": "style-src http://example1.com/foo/ 'unsafe-inline'",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Other expressions have to be subsumed.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-hashed-attributes'",
"returned_csp_1": "style-src http://example1.com/foo/ 'unsafe-inline' 'unsafe-hashed-attributes'",
{ "name": "Other expressions have to be subsumed.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-hashes'",
"returned_csp_1": "style-src http://example1.com/foo/ 'unsafe-inline' 'unsafe-hashes'",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Effective policy is properly found.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-hashed-attributes'",
"returned_csp_1": "style-src http://example1.com/foo/ 'unsafe-eval' 'unsafe-hashed-attributes'",
"returned_csp_2": "style-src http://example1.com/foo/ 'self' 'unsafe-hashed-attributes'",
{ "name": "Effective policy is properly found.",
"required_csp": "style-src http://example1.com/foo/ 'self' 'unsafe-hashes'",
"returned_csp_1": "style-src http://example1.com/foo/ 'unsafe-eval' 'unsafe-hashes'",
"returned_csp_2": "style-src http://example1.com/foo/ 'self' 'unsafe-hashes'",
"expected": IframeLoad.EXPECT_LOAD },
{ "name": "Required csp must allow 'unsafe-hashed-attributes'.",
"required_csp": "style-src http://example1.com/foo/ 'self'",
"returned_csp_1": "style-src http://example1.com/foo/ 'self' 'unsafe-hashed-attributes'",
{ "name": "Required csp must allow 'unsafe-hashes'.",
"required_csp": "style-src http://example1.com/foo/ 'self'",
"returned_csp_1": "style-src http://example1.com/foo/ 'self' 'unsafe-hashes'",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Effective policy is properly found where 'unsafe-hashed-attributes' is not subsumed.",
"required_csp": "style-src http://example1.com/foo/ 'self'",
"returned_csp_1": "style-src 'unsafe-eval' 'unsafe-hashed-attributes'",
"returned_csp_2": "style-src 'unsafe-hashed-attributes' 'unsafe-inline'",
{ "name": "Effective policy is properly found where 'unsafe-hashes' is not subsumed.",
"required_csp": "style-src http://example1.com/foo/ 'self'",
"returned_csp_1": "style-src 'unsafe-eval' 'unsafe-hashes'",
"returned_csp_2": "style-src 'unsafe-hashes' 'unsafe-inline'",
"expected": IframeLoad.EXPECT_BLOCK },
{ "name": "Effective policy is properly found where 'unsafe-hashed-attributes' is not part of it.",
"required_csp": "style-src http://example1.com/foo/ 'self'",
{ "name": "Effective policy is properly found where 'unsafe-hashes' is not part of it.",
"required_csp": "style-src http://example1.com/foo/ 'self'",
"returned_csp_1": "style-src 'unsafe-eval' 'self'",
"returned_csp_2": "style-src 'unsafe-hashed-attributes' 'self'",
"returned_csp_2": "style-src 'unsafe-hashes' 'self'",
"expected": IframeLoad.EXPECT_LOAD },
];
tests.forEach(test => {

View file

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc'
'sha256-r5W8SQIDMTbMxAjJ7KzCzFT38dwBy7Y5KF5B+20009g=';">
<!--
'sha256-r5W8SQIDMTbMxAjJ7KzCzFT38dwBy7Y5KF5B+20009g=' ==> 'javascript:t1.done();'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<a href='javascript:t1.done();' id='test'>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is allowed to run");
window.addEventListener('securitypolicyviolation', t1.unreached_func("Should have not raised any event"));
document.getElementById('test').click();
</script>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc'
'sha256-r5W8SQIDMTbMxAjJ7KzCzFT38dwBy7Y5KF5B+20009g=';">
<!--
'sha256-r5W8SQIDMTbMxAjJ7KzCzFT38dwBy7Y5KF5B+20009g=' ==> 'javascript:t1.done();'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<a target="_blank" href='javascript:t1.done();' id='test'>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is allowed to run");
window.addEventListener('securitypolicyviolation', t1.unreached_func("Should have not raised any event"));
document.getElementById('test').click();
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html>
<head>
<!--
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is allowed to run");
window.onmessage = t1.step_func_done(function(e) {
assert_equals(e.data, "pass");
});
window.open('support/child_window_location_navigate.sub.html' +
'?csp=' + encodeURI("script-src 'unsafe-hashes' 'nonce-abc' 'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y='") +
'&url=' + encodeURI("javascript:opener.postMessage('pass', '*')"));
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc'
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=';">
<!--
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is allowed to run");
window.onmessage = t1.step_func_done(function(e) {
assert_equals(e.data, "pass");
});
window.addEventListener('securitypolicyviolation', t1.unreached_func("Should have not raised any event"));
window.open("javascript:opener.postMessage('pass', '*')");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc'
'sha256-3MhWOWQJwDMJCRltopqBmDhP4qq569eTDcH+BpbHp0o=';">
<!--
'sha256-3MhWOWQJwDMJCRltopqBmDhP4qq569eTDcH+BpbHp0o=' ==> javascript:t1.unreached_func("Should not have run javascript: URL");
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<a href='javascript:t1.unreached_func("Should not have run javascript: URL");' id='test'>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.blockedURI, 'inline');
}));
document.getElementById('test').click();
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc'
'sha256-r5W8SQIDMTbMxAjJ7KzCzFT38dwBy7Y5KF5B+20009g=';">
<!--
'sha256-3MhWOWQJwDMJCRltopqBmDhP4qq569eTDcH+BpbHp0o=' ==> javascript:t1.unreached_func("Should not have run javascript: URL");
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<a href='javascript:t1.unreached_func("Should not have run javascript: URL");' id='test'>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.blockedURI, 'inline');
}));
document.getElementById('test').click();
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html>
<head>
<!--
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.onmessage = t1.step_func_done(function(e) {
assert_equals(e.data, "fail");
});
window.open('support/child_window_location_navigate.sub.html' +
'?csp=' + encodeURI("script-src 'nonce-abc' 'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y='") +
'&url=' + encodeURI("javascript:opener.postMessage('pass', '*')"));
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc'
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=';">
<!--
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.onmessage = t1.unreached_func("Should have not received any message");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.blockedURI, 'inline');
}));
window.open("javascript:opener.postMessage('pass', '*')");
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc'
'sha256-r5W8SQIDMTbMxAjJ7KzCzFT38dwBy7Y5KF5B+20009g=';">
<!--
'sha256-3MhWOWQJwDMJCRltopqBmDhP4qq569eTDcH+BpbHp0o=' ==> javascript:t1.unreached_func("Should not have run javascript: URL");
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<a href='javascript:t1.unreached_func("Should not have run javascript: URL");' id='test'>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.blockedURI, 'inline');
}));
document.getElementById('test').click();
</script>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc'
'sha256-3MhWOWQJwDMJCRltopqBmDhP4qq569eTDcH+BpbHp0o=';">
<!--
'sha256-3MhWOWQJwDMJCRltopqBmDhP4qq569eTDcH+BpbHp0o=' ==> javascript:t1.unreached_func("Should not have run javascript: URL");
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<a target="_blank" href='javascript:t1.unreached_func("Should not have run javascript: URL");' id='test'>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.blockedURI, 'inline');
}));
document.getElementById('test').click();
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html>
<head>
<!--
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.onmessage = t1.step_func_done(function(e) {
assert_equals(e.data, "fail");
});
window.open('support/child_window_location_navigate.sub.html' +
'?csp=' + encodeURI("script-src 'unsafe-hashes' 'nonce-abc' 'sha256-VjH6k67F4kobUnNDOBE85QiJ9cuZMiYT6desKXvezVg='") +
'&url=' + encodeURI("javascript:opener.postMessage('pass', '*')"));
</script>
</body>
</html>

View file

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc'
'sha256-VjH6k67F4kobUnNDOBE85QiJ9cuZMiYT6desKXvezVg=';">
<!--
'sha256-IIiAJ8UuliU8o1qAv6CV4P3R8DeTf/v3MrsCwXW171Y=' ==> 'javascript:opener.postMessage('pass', '*')'
-->
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>
<body>
<div id='log'></div>
<script nonce='abc'>
var t1 = async_test("Test that the javascript: src is not allowed to run");
window.onmessage = t1.unreached_func("Should have not received any message");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'script-src');
assert_equals(e.blockedURI, 'inline');
}));
window.open("javascript:opener.postMessage('pass', '*')");
</script>
</body>
</html>

View file

@ -2,8 +2,8 @@
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashed-attributes' 'nonce-abc' 'sha256-wmuLCpoj8EMqfQlPnt5NIMgKkCK62CxAkAiewI0zZps='; img-src *;">
<title>Event handlers should be allowed if a matching hash and 'unsafe-hashed-attributes' are present</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc' 'sha256-wmuLCpoj8EMqfQlPnt5NIMgKkCK62CxAkAiewI0zZps='; img-src *;">
<title>Event handlers should be allowed if a matching hash and 'unsafe-hashes' are present</title>
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>
</head>

View file

@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc' 'sha256-Cb9N8BP42Neca22vQ9VaXlPU8oPF8HPxZHxRVcnLZJ4='; img-src *;">
<title>Event handlers should not be allowed if a matching hash is present without 'unsafe-hashed-attributes'</title>
<title>Event handlers should not be allowed if a matching hash is present without 'unsafe-hashes'</title>
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>

View file

@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashed-attributes' 'nonce-abc' 'sha256-thisdoesnotmatch'; img-src *;">
<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-hashes' 'nonce-abc' 'sha256-thisdoesnotmatch'; img-src *;">
<title>Event handlers should be not allowed if a matching hash is not present</title>
<script src='/resources/testharness.js' nonce='abc'></script>
<script src='/resources/testharnessreport.js' nonce='abc'></script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src *;
style-src 'unsafe-hashes' 'sha256-S0VSqEOmzmyOifPfat2sJ7ELOgkldAEbaXlvi5iMqjc=';">
<!--
'sha256-S0VSqEOmzmyOifPfat2sJ7ELOgkldAEbaXlvi5iMqjc=' ==> 'background: green'
-->
<title>Event handlers should be allowed if a matching hash and 'unsafe-hashes' are present</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id='log'></div>
<script>
var t1 = async_test("Test that the inline style attribute is loaded");
function check_for_style() {
assert_equals("green", document.getElementById('test').style.background);
t1.done();
}
window.addEventListener('securitypolicyviolation', t1.unreached_func("Should have not raised any event"));
</script>
<img src='../support/pass.png' id='test' style='background: green'
onload='check_for_style()'>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src *;
style-src 'sha256-S0VSqEOmzmyOifPfat2sJ7ELOgkldAEbaXlvi5iMqjc=';">
<!--
'sha256-S0VSqEOmzmyOifPfat2sJ7ELOgkldAEbaXlvi5iMqjc=' ==> 'background: green'
-->
<title>Event handlers should be allowed if a matching hash and 'unsafe-hashes' are present</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id='log'></div>
<script>
var t1 = async_test("Test that the inline style attribute is blocked");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src');
assert_equals(e.blockedURI, 'inline');
}));
</script>
<img src='../support/pass.png' id='test' style='background: green'>
</body>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src *;
style-src 'unsafe-hashes' 'sha256-UI8QfroYhb0WX073XBuM+RTPntpjZfkyFLsMw5vQfd0=';">
<!--
'sha256-S0VSqEOmzmyOifPfat2sJ7ELOgkldAEbaXlvi5iMqjc=' ==> 'background: green'
-->
<title>Event handlers should be allowed if a matching hash and 'unsafe-hashes' are present</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<div id='log'></div>
<script>
var t1 = async_test("Test that the inline style attribute is blocked");
window.addEventListener('securitypolicyviolation', t1.step_func_done(function(e) {
assert_equals(e.violatedDirective, 'style-src');
assert_equals(e.blockedURI, 'inline');
}));
</script>
<img src='../support/pass.png' id='test' style='background: green'>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="{{GET[csp]}}">
</head>
<body>
<script nonce='abc'>
window.addEventListener('securitypolicyviolation', function(e) {
opener.postMessage('fail', '*');
});
window.location.href = "{{GET[url]}}";
</script>
</body>
</html>

View file

@ -1,3 +1,3 @@
suggested_reviewers:
- bsittler
- inexorabletash
- pwnall

View file

@ -0,0 +1,121 @@
'use strict';
// Workaround because add_cleanup doesn't support async functions yet.
// See https://github.com/web-platform-tests/wpt/issues/6075
async function async_cleanup(cleanup_function) {
try {
await cleanup_function();
} catch (e) {
// Errors in cleanup functions shouldn't result in test failures.
}
}
const kCurrentHostname = (new URL(self.location.href)).hostname;
const kIsSecureTransport = (new URL(self.location.href)).protocol === 'https:';
const kOneDay = 24 * 60 * 60 * 1000;
const kTenYears = 10 * 365 * kOneDay;
const kTenYearsFromNow = Date.now() + kTenYears;
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value');
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set defaults with positional name and value');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value' });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set defaults with name and value in options');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-value',
{ expires: kTenYearsFromNow });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with expires set to 10 years in the future');
promise_test(async testCase => {
await cookieStore.delete('cookie-name');
await cookieStore.set({ name: 'cookie-name', value: 'cookie-value',
expires: kTenYearsFromNow });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, '/');
assert_approx_equals(cookie.expires, kTenYearsFromNow, kOneDay);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(() => cookieStore.delete('cookie-name'));
}, 'cookieStore.set with name and value in options and expires in the future');
promise_test(async testCase => {
await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
await cookieStore.set('cookie-name', 'cookie-value',
{ domain: kCurrentHostname });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, kCurrentHostname);
assert_equals(cookie.path, '/');
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { domain: kCurrentHostname });
});
}, 'cookieStore.set with domain set to the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentPath = currentUrl.pathname;
const currentDirectory =
currentPath.substr(0, currentPath.lastIndexOf('/') + 1);
await cookieStore.delete('cookie-name', { path: currentDirectory });
await cookieStore.set('cookie-name', 'cookie-value',
{ path: currentDirectory });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
assert_equals(cookie.domain, null);
assert_equals(cookie.path, currentDirectory);
assert_equals(cookie.expires, null);
assert_equals(cookie.secure, kIsSecureTransport);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { path: currentDirectory });
});
}, 'cookieStore.set with path set to the current directory');

View file

@ -86,19 +86,23 @@ promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
const subDomain = `sub.${currentDomain}`;
await cookieStore.set(
'cookie-name', 'cookie-value', { domain: currentDomain });
await cookieStore.delete('cookie-name', { domain: subDomain });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { domain: currentDomain })
});
await promise_rejects(testCase, new TypeError(), cookieStore.delete(
'cookie-name', 'cookie-value', { domain: subDomain }));
}, 'cookieStore.delete with domain set to a subdomain of the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
assert_not_equals(currentDomain[0] === '.',
'this test assumes that the current hostname does not start with .');
const domainSuffix = currentDomain.substr(1);
await promise_rejects(testCase, new TypeError(), cookieStore.delete(
'cookie-name', { domain: domainSuffix }));
}, 'cookieStore.delete with domain set to a non-domain-matching suffix of ' +
'the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
@ -119,20 +123,23 @@ promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
const subDomain = `sub.${currentDomain}`;
await cookieStore.set(
'cookie-name', 'cookie-value', { domain: currentDomain });
await cookieStore.delete({ name: 'cookie-name', domain: subDomain });
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.name, 'cookie-name');
assert_equals(cookie.value, 'cookie-value');
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { domain: currentDomain })
});
await promise_rejects(testCase, new TypeError(), cookieStore.delete(
{ name: 'cookie-name', domain: subDomain }));
}, 'cookieStore.delete with name in options and domain set to a subdomain of ' +
'the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
assert_not_equals(currentDomain[0] === '.',
'this test assumes that the current hostname does not start with .');
const domainSuffix = currentDomain.substr(1);
await promise_rejects(testCase, new TypeError(), cookieStore.delete(
{ name: 'cookie-name', domain: domainSuffix }));
}, 'cookieStore.delete with name in options and domain set to a ' +
'non-domain-matching suffix of the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);

View file

@ -129,38 +129,51 @@ promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
const subDomain = `sub.${currentDomain}`;
await cookieStore.delete('cookie-name', { domain: currentDomain });
await cookieStore.delete('cookie-name', { domain: subDomain });
await cookieStore.set(
'cookie-name', 'cookie-value', { domain: subDomain });
await promise_rejects(testCase, new TypeError(), cookieStore.set(
'cookie-name', 'cookie-value', { domain: subDomain }));
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie, null);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name', { domain: subDomain });
});
}, 'cookieStore.set with domain set to a subdomain of the current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
assert_not_equals(currentDomain[0] === '.',
'this test assumes that the current hostname does not start with .');
const domainSuffix = currentDomain.substr(1);
await promise_rejects(testCase, new TypeError(), cookieStore.set(
'cookie-name', 'cookie-value', { domain: domainSuffix }));
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie, null);
}, 'cookieStore.set with domain set to a non-domain-matching suffix of the ' +
'current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);
const currentDomain = currentUrl.hostname;
await cookieStore.delete('cookie-name');
await cookieStore.set('cookie-name', 'cookie-old-value');
await cookieStore.set(
'cookie-name', 'cookie-new-value', { domain: currentDomain });
await cookieStore.set('cookie-name', 'cookie-value1');
await cookieStore.set('cookie-name', 'cookie-value2',
{ domain: currentDomain });
const cookies = await cookieStore.getAll('cookie-name');
assert_equals(cookies.length, 1);
assert_equals(cookies.length, 2);
assert_equals(cookies[0].name, 'cookie-name');
assert_equals(cookies[0].value, 'cookie-new-value');
assert_equals(cookies[1].name, 'cookie-name');
const values = cookies.map((cookie) => cookie.value);
values.sort();
assert_array_equals(values, ['cookie-value1', 'cookie-value2']);
await async_cleanup(async () => {
await cookieStore.delete('cookie-name');
await cookieStore.delete('cookie-name', { domain: currentDomain });
});
}, 'cookieStore.set default domain is current hostname');
}, 'cookieStore.set default domain is null and differs from current hostname');
promise_test(async testCase => {
const currentUrl = new URL(self.location.href);

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compositing and Blending Level 1: parsing background-blend-mode with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-background-blend-mode">
<meta name="assert" content="background-blend-mode supports only the grammar '<blend-mode>#'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("background-blend-mode", "auto");
test_invalid_value("background-blend-mode", "normal luminosity");
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compositing and Blending Level 1: parsing background-blend-mode with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-background-blend-mode">
<meta name="assert" content="background-blend-mode supports the full grammar '<blend-mode>#'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("background-blend-mode", "normal");
test_valid_value("background-blend-mode", "multiply");
test_valid_value("background-blend-mode", "screen");
test_valid_value("background-blend-mode", "overlay");
test_valid_value("background-blend-mode", "darken");
test_valid_value("background-blend-mode", "lighten");
test_valid_value("background-blend-mode", "color-dodge");
test_valid_value("background-blend-mode", "color-burn");
test_valid_value("background-blend-mode", "hard-light");
test_valid_value("background-blend-mode", "soft-light");
test_valid_value("background-blend-mode", "difference");
test_valid_value("background-blend-mode", "exclusion");
test_valid_value("background-blend-mode", "hue");
test_valid_value("background-blend-mode", "saturation");
test_valid_value("background-blend-mode", "color");
test_valid_value("background-blend-mode", "luminosity");
test_valid_value("background-blend-mode", "normal, luminosity");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compositing and Blending Level 1: parsing isolation with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-isolation">
<meta name="assert" content="isolation supports only the grammar '<isolation-mode>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("isolation", "none");
test_invalid_value("isolation", "auto isolate");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compositing and Blending Level 1: parsing isolation with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-isolation">
<meta name="assert" content="isolation supports the full grammar '<isolation-mode>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("isolation", "auto");
test_valid_value("isolation", "isolate");
</script>
</body>
</html>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compositing and Blending Level 1: parsing mix-blend-mode with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-mix-blend-mode">
<meta name="assert" content="mix-blend-mode supports only the grammar '<blend-mode>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("mix-blend-mode", "auto");
test_invalid_value("mix-blend-mode", "normal luminosity");
test_invalid_value("mix-blend-mode", "normal, luminosity");
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compositing and Blending Level 1: parsing mix-blend-mode with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-mix-blend-mode">
<meta name="assert" content="mix-blend-mode supports the full grammar '<blend-mode>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("mix-blend-mode", "normal");
test_valid_value("mix-blend-mode", "multiply");
test_valid_value("mix-blend-mode", "screen");
test_valid_value("mix-blend-mode", "overlay");
test_valid_value("mix-blend-mode", "darken");
test_valid_value("mix-blend-mode", "lighten");
test_valid_value("mix-blend-mode", "color-dodge");
test_valid_value("mix-blend-mode", "color-burn");
test_valid_value("mix-blend-mode", "hard-light");
test_valid_value("mix-blend-mode", "soft-light");
test_valid_value("mix-blend-mode", "difference");
test_valid_value("mix-blend-mode", "exclusion");
test_valid_value("mix-blend-mode", "hue");
test_valid_value("mix-blend-mode", "saturation");
test_valid_value("mix-blend-mode", "color");
test_valid_value("mix-blend-mode", "luminosity");
</script>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>css-animations IDL tests</title>
<link rel="help" href="https://drafts.csswg.org/css-animations/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<div id="log"></div>
<script>
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/css-animations.idl').then(r => r.text());
const cssom = await fetch('/interfaces/cssom.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(cssom);
idl_array.add_dependency_idls(dom);
idl_array.test();
}, 'Test css-animations IDL implementation');
</script>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>css-conditional IDL tests</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<div id="log"></div>
<script>
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/css-conditional.idl').then(r => r.text());
const cssom = await fetch('/interfaces/cssom.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(cssom);
idl_array.add_dependency_idls(dom);
idl_array.test();
}, 'Test css-conditional IDL implementation');
</script>
</body>
</html>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Containment Test: Size containment replaced elements intrinsic size</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<meta name=assert content="This test checks that intrinsic size of replaced elements with 'contain: size' is zero.">
<style>
img {
background: green;
padding: 50px;
contain: size;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<img src="/css/support/60x60-red.png" />

View file

@ -0,0 +1,10 @@
<!doctype html>
<meta charset="utf-8">
<title style="display: none">CSS Test Reference</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<style>
* { display: contents }
</style>
<whatever>
PASS
</whatever>

View file

@ -0,0 +1,14 @@
<!doctype html>
<meta charset="utf-8">
<title style="display: none">CSS Test: display:contents style sharing.</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="match" href="display-contents-sharing-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-display/#unbox-html">
<link rel="help" href="https://bugzil.la/1469076">
<style>
* { display: contents }
</style>
<br>
<whatever>
PASS
</whatever>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
<title>Test that CSS env vars work with @support</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@supports (background-color: env(test)) {
body { background-color: rgb(0, 128, 0); }
}
</style>
</head>
<body>
<script>
test(() => {
const style = window.getComputedStyle(document.body);
assert_equals(style.getPropertyValue("background-color"), "rgb(0, 128, 0)");
});
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
<title>Test env() will work in custom properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
--my-width: env(test, 100px);
width: var(--my-width);
}
</style>
</head>
<body>
<script>
test(() => {
const style = window.getComputedStyle(document.body);
assert_equals(style.getPropertyValue("width"), "100px");
});
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
<title>Test that nested var() fallback values work with CSS env vars</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
--main-bg-color: rgb(0, 128, 0);
background-color: env(test, var(--main-bg-color));
}
</style>
</head>
<body>
<script>
test(() => {
const style = window.getComputedStyle(document.body);
assert_equals(style.getPropertyValue("background-color"), "rgb(0, 128, 0)");
});
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
<title>Test style seralization round tripping with CSS env vars</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
test(() => {
document.body.style.top = "env(test)";
assert_equals(document.body.style.getPropertyValue("top"), "env(test)");
document.body.style.setProperty("top", "env()");
assert_equals(document.body.style.getPropertyValue("top"), "env(test)");
});
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
<title>Test that CSS env vars work with CSS.supports</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
test(() => {
assert_true(CSS.supports("background: env(test)"));
assert_true(CSS.supports("background", "env(test)"));
assert_false(CSS.supports("background", "env()"));
assert_false(CSS.supports("background", "env(test,)"));
});
</script>
</body>
</html>

View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
<title>Test env() syntax</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div { background-color: rgb(0, 128, 0); }
</style>
</head>
<body>
<script>
// This value is expected if the syntax is valid.
const envWorkingValue = "rgba(0, 0, 0, 0)";
// This value is expected if the syntax is invalid.
const pageDefaultValue = "rgb(0, 128, 0)";
// This value is used to test fallback values.
const blueValue = "rgb(0, 0, 255)";
const testCases = [
{ style: "", expectedPropertyValue: pageDefaultValue },
{ style: "background-color: env(test)", expectedPropertyValue: envWorkingValue },
{ style: "background-color: ENV(test)", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test) !important", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test, 10px)", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test, blue)", expectedPropertyValue: blueValue },
{ style: "background-color: env(test, env(another))", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test, env(another, blue))", expectedPropertyValue: blueValue },
{ style: "background-color: env(-test)", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(--test)", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(10px)", expectedPropertyValue: pageDefaultValue },
{ style: "background-color: env(env(test))", expectedPropertyValue: pageDefaultValue },
{ style: "background-color: env( test)", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test )", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env( test )", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test /**/, blue)", expectedPropertyValue: blueValue },
{ style: "background-color: env(test, {})", expectedPropertyValue: envWorkingValue },
{ style: "background-color: env(test, {)", expectedPropertyValue: pageDefaultValue },
];
testCases.forEach((testcase) => {
test(() => {
const elem = document.createElement("div");
const style = window.getComputedStyle(elem);
document.body.appendChild(elem);
elem.style.cssText = testcase.style;
assert_equals(style.getPropertyValue("background-color"), testcase.expectedPropertyValue);
}, testcase.style + " " + testcase.expectedPropertyValue);
});
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more