Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update web-platform-tests to revision 7d32598cde0617753ce052aca5756394ba51284a #11708

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
The table of contents is too big for display.

Always

Just for now

Large diffs are not rendered by default.

@@ -1 +1 @@
3535f3f6c25b6e380d190559a5ca03ea70282fe0
2ae8a70e2b929ac413c4bb09f00cc45d7433c05b
@@ -0,0 +1,154 @@

function run_test() {
var subtle = crypto.subtle; // Change to test prefixed implementations

var sourceData = {
empty: new Uint8Array(0),
short: new Uint8Array([21, 110, 234, 124, 193, 76, 86, 203, 148, 219, 3, 10, 74, 157, 149, 255]),
medium: new Uint8Array([182, 200, 249, 223, 100, 140, 208, 136, 183, 15, 56, 231, 65, 151, 177, 140, 184, 30, 30, 67, 80, 213, 11, 204, 184, 251, 90, 115, 121, 200, 123, 178, 227, 214, 237, 84, 97, 237, 30, 159, 54, 243, 64, 163, 150, 42, 68, 107, 129, 91, 121, 75, 75, 212, 58, 68, 3, 80, 32, 119, 178, 37, 108, 200, 7, 131, 127, 58, 172, 209, 24, 235, 75, 156, 43, 174, 184, 151, 6, 134, 37, 171, 172, 161, 147])
};

sourceData.long = new Uint8Array(1024 * sourceData.medium.byteLength);
for (var i=0; i<1024; i++) {
sourceData.long.set(sourceData.medium, i * sourceData.medium.byteLength);
}

var digestedData = {
"sha-1": {
empty: new Uint8Array([218, 57, 163, 238, 94, 107, 75, 13, 50, 85, 191, 239, 149, 96, 24, 144, 175, 216, 7, 9]),
short: new Uint8Array([201, 19, 24, 205, 242, 57, 106, 1, 94, 63, 78, 106, 134, 160, 186, 101, 184, 99, 89, 68]),
medium: new Uint8Array([229, 65, 6, 8, 112, 235, 22, 191, 51, 182, 142, 81, 245, 19, 82, 104, 147, 152, 103, 41]),
long: new Uint8Array([48, 152, 181, 0, 55, 236, 208, 46, 189, 101, 118, 83, 178, 191, 160, 30, 238, 39, 162, 234])
},
"sha-256": {
empty: new Uint8Array([227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85]),
short: new Uint8Array([162, 131, 17, 134, 152, 71, 146, 199, 211, 45, 89, 200, 151, 64, 104, 127, 25, 173, 220, 27, 149, 158, 113, 161, 204, 83, 138, 59, 126, 216, 67, 242]),
medium: new Uint8Array([83, 83, 103, 135, 126, 240, 20, 215, 252, 113, 126, 92, 183, 132, 62, 89, 182, 26, 238, 98, 199, 2, 156, 236, 126, 198, 193, 47, 217, 36, 224, 228]),
long: new Uint8Array([20, 205, 234, 157, 199, 95, 90, 98, 116, 217, 252, 30, 100, 0, 153, 18, 241, 220, 211, 6, 180, 143, 232, 233, 207, 18, 45, 230, 113, 87, 23, 129])
},
"sha-384": {
empty: new Uint8Array([56, 176, 96, 167, 81, 172, 150, 56, 76, 217, 50, 126, 177, 177, 227, 106, 33, 253, 183, 17, 20, 190, 7, 67, 76, 12, 199, 191, 99, 246, 225, 218, 39, 78, 222, 191, 231, 111, 101, 251, 213, 26, 210, 241, 72, 152, 185, 91]),
short: new Uint8Array([107, 245, 234, 101, 36, 209, 205, 220, 67, 247, 207, 59, 86, 238, 5, 146, 39, 64, 74, 47, 83, 143, 2, 42, 61, 183, 68, 122, 120, 44, 6, 193, 237, 5, 232, 171, 79, 94, 220, 23, 243, 113, 20, 64, 223, 233, 119, 49]),
medium: new Uint8Array([203, 194, 197, 136, 254, 91, 37, 249, 22, 218, 40, 180, 228, 122, 72, 74, 230, 252, 31, 228, 144, 45, 213, 201, 147, 154, 107, 253, 3, 74, 179, 180, 139, 57, 8, 116, 54, 1, 31, 106, 153, 135, 157, 39, 149, 64, 233, 119]),
long: new Uint8Array([73, 244, 253, 179, 152, 25, 104, 249, 125, 87, 55, 15, 133, 52, 80, 103, 205, 82, 150, 169, 125, 209, 161, 142, 6, 145, 30, 117, 110, 150, 8, 73, 37, 41, 135, 14, 26, 209, 48, 153, 141, 87, 203, 251, 183, 193, 208, 158])
},
"sha-512": {
empty: new Uint8Array([207, 131, 225, 53, 126, 239, 184, 189, 241, 84, 40, 80, 214, 109, 128, 7, 214, 32, 228, 5, 11, 87, 21, 220, 131, 244, 169, 33, 211, 108, 233, 206, 71, 208, 209, 60, 93, 133, 242, 176, 255, 131, 24, 210, 135, 126, 236, 47, 99, 185, 49, 189, 71, 65, 122, 129, 165, 56, 50, 122, 249, 39, 218, 62]),
short: new Uint8Array([55, 82, 72, 190, 95, 243, 75, 231, 76, 171, 79, 241, 195, 188, 141, 198, 139, 213, 248, 223, 244, 2, 62, 152, 248, 123, 134, 92, 255, 44, 114, 66, 146, 223, 24, 148, 67, 166, 79, 244, 19, 74, 101, 205, 70, 53, 185, 212, 245, 220, 13, 63, 182, 117, 40, 0, 42, 99, 172, 242, 108, 157, 165, 117]),
medium: new Uint8Array([185, 16, 159, 131, 158, 142, 164, 60, 137, 15, 41, 60, 225, 29, 198, 226, 121, 141, 30, 36, 49, 241, 228, 185, 25, 227, 178, 12, 79, 54, 48, 59, 163, 156, 145, 109, 179, 6, 196, 90, 59, 101, 118, 31, 245, 190, 133, 50, 142, 234, 244, 44, 56, 48, 241, 217, 94, 122, 65, 22, 91, 125, 45, 54]),
long: new Uint8Array([75, 2, 202, 246, 80, 39, 96, 48, 234, 86, 23, 229, 151, 197, 213, 63, 217, 218, 166, 139, 120, 191, 230, 11, 34, 170, 184, 211, 106, 76, 42, 58, 255, 219, 113, 35, 79, 73, 39, 103, 55, 197, 117, 221, 247, 77, 20, 5, 76, 189, 111, 219, 152, 253, 13, 220, 188, 180, 111, 145, 173, 118, 182, 238])
},
}

// Try every combination of hash with source data size. Variations tested are
// hash name in upper, lower, or mixed case, and upper-case version with the
// source buffer altered after call.
Object.keys(sourceData).forEach(function(size) {
Object.keys(digestedData).forEach(function(alg) {
var upCase = alg.toUpperCase();
var downCase = alg.toLowerCase();
var mixedCase = upCase.substr(0, 1) + downCase.substr(1);

promise_test(function(test) {
var promise = subtle.digest({name: upCase}, sourceData[size])
.then(function(result) {
assert_true(equalBuffers(result, digestedData[alg][size]), "digest() yielded expected result for " + alg + ":" + size);
}, function(err) {
assert_unreached("digest() threw an error for " + alg + ":" + size + " - " + err.message);
});

return promise;
}, upCase + " with " + size + " source data");

promise_test(function(test) {
var promise = subtle.digest({name: mixedCase}, sourceData[size])
.then(function(result) {
assert_true(equalBuffers(result, digestedData[alg][size]), "digest() yielded expected result for " + alg + ":" + size);
}, function(err) {
assert_unreached("digest() threw an error for " + alg + ":" + size + " - " + err.message);mixedCase
});

return promise;
}, downCase + " with " + size + " source data");

promise_test(function(test) {
var promise = subtle.digest({name: mixedCase}, sourceData[size])
.then(function(result) {
assert_true(equalBuffers(result, digestedData[alg][size]), "digest() yielded expected result for " + alg + ":" + size);
}, function(err) {
assert_unreached("digest() threw an error for " + alg + ":" + size + " - " + err.message);
});

return promise;
}, mixedCase + " with " + size + " source data");

promise_test(function(test) {
var copiedBuffer = copyBuffer(sourceData[size]);
var promise = subtle.digest({name: upCase}, copiedBuffer)
.then(function(result) {
assert_true(equalBuffers(result, digestedData[alg][size]), "digest() yielded expected result for " + alg + ":" + size);
}, function(err) {
assert_unreached("digest() threw an error for " + alg + ":" + size + " - " + err.message);
});

copiedBuffer[0] = 255 - copiedBuffer;
return promise;
}, upCase + " with " + size + " source data and altered buffer after call");

});
});

// Call digest() with bad algorithm names to get an error
var badNames = ["AES-GCM", "RSA-OAEP", "PBKDF2", "AES-KW"];
Object.keys(sourceData).forEach(function(size) {
badNames.forEach(function(badName) {

promise_test(function(test) {
var promise = subtle.digest({name: badName}, sourceData[size])
.then(function(result) {
assert_unreached("digest() should not have worked for " + alg + ":" + size);
}, function(err) {
assert_equals(err.message, "OperationError", "Bad algorithm name should cause OperationError")
});

return promise;
}, badName + " with " + size);

});
});


done();


// Returns a copy of the sourceBuffer it is sent.
function copyBuffer(sourceBuffer) {
var source = new Uint8Array(sourceBuffer);
var copy = new Uint8Array(sourceBuffer.byteLength)

for (var i=0; i<source.byteLength; i++) {
copy[i] = source[i];
}

return copy;
}

function equalBuffers(a, b) {
if (a.byteLength !== b.byteLength) {
return false;
}

var aBytes = new Uint8Array(a);
var bBytes = new Uint8Array(b);

for (var i=0; i<a.byteLength; i++) {
if (aBytes[i] !== bBytes[i]) {
return false;
}
}

return true;
}

return;
}
@@ -0,0 +1,4 @@
importScripts("/resources/testharness.js");
importScripts("digest.js");

run_test();
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>WebCryptoAPI: digest()</title>
<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
<link rel="help" href="https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-SubtleCrypto-method-digest">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script src="digest.js"></script>

<h1>encrypt Tests for digest method</h1>

<div id="log"></div>
<script>
run_test();
</script>
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
var x = 0;
</script>
<!-- This script's URI is:
var xhr = new XMLHttpRequest();
xhr.open('GET', 'data:text/plain,aaa', false);
xhr.send();
x=1;
-->
<script defer src="data:application/javascript,var%20x%20=%200;%20var%20xhr%20=%20new%20XMLHttpRequest();%20xhr.open('GET',%20'data:text/plain,aaa',%20false);%20xhr.send();%20x=1"></script>

<!-- This script's URI is:
parent.postMessage(x, '*');
-->
<script defer src="data:application/javascript,parent.postMessage(x, '*');"></script>

@@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that a sync XHR in a defer script blocks later defer scripts from running</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!--
We run the test in a subframe, because something in the testharness stuff
interferes with defer scripts -->
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.data, 1);
});
</script>
<iframe src="xmlhttprequest-sync-block-defer-scripts-subframe.html"></iframe>
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<title>Check that while a sync XHR is in flight async script loads don't complete and run script</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<body>
<script>
var scriptRan = false;
var onloadFired = false;
test(function() {
var s = document.createElement("script");
s.src = "data:application/javascript,scriptRan = true;";
s.onload = function() { onloadFired = true; }
document.body.appendChild(s);
var xhr = new XMLHttpRequest();
xhr.open("GET", "data:,", false);
xhr.send();
assert_false(scriptRan, "Script should not have run");
assert_false(onloadFired, "load event for <script> should not have fired");
});
</script>
</body>
@@ -66,16 +66,16 @@
var originalPromise = iframe.contentWindow.navigator.getBattery();

iframe.onload = t.step_func(function() {
assert_not_equals(iframe.contentWindow.navigator,
assert_equals(iframe.contentWindow.navigator,
originalNavigator,
'navigator objects shall be changed');
assert_not_equals(iframe.contentWindow.navigator.getBattery(),
'navigator objects shall be same');
assert_equals(iframe.contentWindow.navigator.getBattery(),
originalPromise,
'battery status promises shall be different');
'battery status promises shall be same');
t.done();
});
iframe.src = 'support-iframe.html';
}, 'setting iframe\'s src makes its Navigator object vary thus getting another battery promise');
}, 'setting iframe\'s src makes same Navigator object and battery promise');

async_test(function (t) {
var win = window.open('support-window-open.html');
@@ -1944,9 +1944,12 @@
"html/elements/source/src/userinfo-username-contains-pile-of-poo-novalid.html": "Bad value \u201chttp://\ud83d\udca9:foo@example.com\u201d for attribute \u201csrc\u201d on element \u201csource\u201d: Bad URL: Illegal character in user or password: \u201c\ud83d\udca9\u201d is not allowed.",
"html/elements/span/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.",
"html/elements/strong/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.",
"html/elements/style/scoped-as-div-child-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.",
"html/elements/style/scoped-as-p-child-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cp\u201d.) Suppressing further errors from this subtree.",
"html/elements/style/scoped-in-head-novalid.html": "Attribute \u201cscoped\u201d not allowed on element \u201cstyle\u201d in this context.",
"html/elements/style/scoped-model-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.",
"html/elements/style/scoped-multiple-adjacent-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.",
"html/elements/style/scoped-novalid.html": "Element \u201cstyle\u201d not allowed in this context. (The parent was element \u201cdiv\u201d.) Suppressing further errors from this subtree.",
"html/elements/sub/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.",
"html/elements/sup/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.",
"html/elements/table/model-input-child-hidden-novalid.html": "Start tag \u201cinput\u201d seen in \u201ctable\u201d.",
@@ -67,7 +67,7 @@ <h1>Response headers</h1>
}
if (client.readyState > 1)
{
assert_equals(client.getResponseHeader("x-custom-header"), "test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-custom-header"), "test, test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-custom-header-empty"), "", 'x-custom-header-empty')
assert_equals(client.getResponseHeader("set-cookie"), null)
assert_equals(client.getResponseHeader("set-cookie2"), null)
@@ -86,7 +86,7 @@ <h1>Response headers</h1>
var client = new XMLHttpRequest()
client.open('GET', CROSSDOMAIN + 'resources/cors-headers.asis', false)
client.send(null)
assert_equals(client.getResponseHeader("x-custom-header"), "test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-custom-header"), "test, test", 'x-custom-header')
assert_equals(client.getResponseHeader("x-nonexposed"), null, 'x-nonexposed')
}, "getResponse: don't expose x-nonexposed")

@@ -161,7 +161,14 @@

// 8. Let observedAttributesIterable be Get(constructor, "observedAttributes").
// Rethrow any exceptions.
// See step 12 for rethrow tests.
test(() => {
class C {
static get observedAttributes() { throw_rethrown_error(); }
}
assert_rethrown(() => {
customElements.define('test-define-observedattributes-rethrow', C);
});
}, 'If constructor.observedAttributes throws, should rethrow');

// 10. Let prototype be Get(constructor, "prototype"). Rethrow any exceptions.
function assert_rethrown(func, description) {
@@ -208,42 +215,38 @@
// 17. If attributeChangedCallback is not undefined, and IsCallable(attributeChangedCallback) is false,
// then throw a TypeError exception.
[
'observedAttributes', // See step 8 above.
'connectedCallback',
'disconnectedCallback',
'attributeChangedCallback',
].forEach(name => {
test(() => {
].forEach(name => {
test(() => {
class C {
get [name]() { throw_rethrown_error(); }
}
assert_rethrown(() => {
customElements.define('test-define-constructor-rethrow-prototype-' + name, C);
assert_rethrown(() => {
customElements.define(`test-define-${name.toLowerCase()}-rethrow`, C);
});
}, `If constructor.prototype.${name} throws, should rethrow`);
});
[
'connectedCallback',
'disconnectedCallback',
'attributeChangedCallback',
].forEach(name => {
test(() => {
class c {};
c.prototype[name] = undefined;
customElements.define('test-define-constructor-prototype-' + name, c);
}, `If constructor.prototype.${name} is undefined, should success`);

[
[ 'null', null ],
[ 'object', {} ],
].forEach(value => {
test(() => {
class c {};
c.prototype[name] = value[1];
assert_throws(expectTypeError, () => {
customElements.define('test-define-constructor-prototype-' + name, c);
});
}, `If constructor.prototype.${name} is ${value[0]}, should throw a TypeError`);
})
{ name: 'undefined', value: undefined, success: true },
{ name: 'function', value: function () { }, success: true },
{ name: 'null', value: null, success: false },
{ name: 'object', value: {}, success: false },
{ name: 'integer', value: 1, success: false },
].forEach(data => {
test(() => {
class C { };
C.prototype[name] = data.value;
if (data.success) {
customElements.define(`test-define-${name.toLowerCase()}-${data.name}`, C);
} else {
assert_throws(expectTypeError, () => {
customElements.define(`test-define-${name.toLowerCase()}-${data.name}`, C);
});
}
}, `If constructor.prototype.${name} is ${data.name}, should ${data.success ? 'succeed' : 'throw a TypeError'}`);
});
});
})();
</script>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.