Bug 1610732 part 2. Throw the right exception when a user.id value is too long. r=jcj

The test changes are for the following reasons:

1) Removing the "empty ArrayBuffer" test: I don't see anything obvious in the
spec that would cause that to reject before prompting the user, and in fact it
does not do that in browsers.  All browsers time out on that line.

2) Removing the "name is object" test: This test is wrong.  Passing {} where a
string is expected in IDL will come out as the string "[object Object]" on the
other side, and that seems like a perfectly valid name.

3) Removing the "name is null" test: This test is wrong.  Passing null where a
string is expected in IDL will come out as the string "null" on the other side,
and that seems like a perfectly valid name.

4) Removing the "name is empty" test: I don't see anything obvious in the
spec that would cause that to reject before prompting the user.

5) Removing the various "icon is whatever" tests: I don't see anything obvious in the
spec that would cause that to reject before prompting the user.

6) Removing the various "displayName is whatever" tests: the same reasoning as
for the coresponding "name is whatever" tests applies.

Differential Revision: https://phabricator.services.mozilla.com/D60685

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2020-01-22 16:53:09 +00:00
Родитель e3e6463b5c
Коммит b40350c499
3 изменённых файлов: 1 добавлений и 196 удалений

Просмотреть файл

@ -258,7 +258,7 @@ already_AddRefed<Promise> WebAuthnManager::MakeCredential(
CryptoBuffer userId;
userId.Assign(aOptions.mUser.mId);
if (userId.Length() > 64) {
promise->MaybeReject(NS_ERROR_DOM_TYPE_ERR);
promise->MaybeRejectWithTypeError(u"user.id is too long");
return promise.forget();
}

Просмотреть файл

@ -1,180 +0,0 @@
[createcredential-badargs-user.https.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1546662
expected:
if os == "android" and not e10s: OK
TIMEOUT
[Bad user: id is empty ArrayBuffer]
expected:
if os == "android" and not e10s: FAIL
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
TIMEOUT
[Bad user: ArrayBuffer id is too long (65 bytes)]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[Bad user: Int16Array id is too long (66 bytes)]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[Bad user: Int32Array id is too long (68 bytes)]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[Bad user: Float32Array id is too long (68 bytes)]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[Bad user: Float64Array id is too long (72 bytes)]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[Bad user: id is too long (65 bytes)]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[user missing name]
expected:
if os == "android" and not e10s: PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): PASS
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): PASS
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
NOTRUN
[Bad user: name is object]
expected:
if os == "android" and not e10s: FAIL
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): FAIL
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
NOTRUN
[Bad user: name is null]
expected:
if os == "android" and not e10s: FAIL
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and not webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and not webrender and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): TIMEOUT
if debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): TIMEOUT
if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
NOTRUN
[Bad user: name is empty String]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: icon is object]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: icon is null]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: icon is empty String]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: displayName is undefined]
expected:
if os == "android" and not e10s: PASS
NOTRUN
[Bad user: displayName is object]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: displayName is null]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: displayName is empty String]
expected:
if os == "android" and not e10s: FAIL
NOTRUN
[Bad user: icon is insecure]
expected:
if os == "android" and not e10s: FAIL
NOTRUN

Просмотреть файл

@ -23,7 +23,6 @@ standardSetup(function() {
new CreateCredentialsTest("options.publicKey.user.id", null).runTest("Bad user: id is null", TypeError);
new CreateCredentialsTest("options.publicKey.user.id", "").runTest("Bad user: id is empty String", TypeError);
new CreateCredentialsTest("options.publicKey.user.id", new Array()).runTest("Bad user: id is empty Array", TypeError);
new CreateCredentialsTest("options.publicKey.user.id", new ArrayBuffer(0)).runTest("Bad user: id is empty ArrayBuffer", TypeError);
new CreateCredentialsTest("options.publicKey.user.id", new ArrayBuffer(65)).runTest("Bad user: ArrayBuffer id is too long (65 bytes)", TypeError);
new CreateCredentialsTest("options.publicKey.user.id", new Int16Array(33)).runTest("Bad user: Int16Array id is too long (66 bytes)", TypeError);
new CreateCredentialsTest("options.publicKey.user.id", new Int32Array(17)).runTest("Bad user: Int32Array id is too long (68 bytes)", TypeError);
@ -34,23 +33,9 @@ standardSetup(function() {
// // user.name
new CreateCredentialsTest({path: "options.publicKey.user.name", value: undefined}).runTest("user missing name", TypeError);
new CreateCredentialsTest("options.publicKey.user.name", {}).runTest("Bad user: name is object", TypeError);
new CreateCredentialsTest("options.publicKey.user.name", null).runTest("Bad user: name is null", TypeError);
new CreateCredentialsTest("options.publicKey.user.name", "").runTest("Bad user: name is empty String", TypeError);
// // user.icon
new CreateCredentialsTest("options.publicKey.user.icon", {}).runTest("Bad user: icon is object", TypeError);
new CreateCredentialsTest("options.publicKey.user.icon", null).runTest("Bad user: icon is null", TypeError);
new CreateCredentialsTest("options.publicKey.user.icon", "").runTest("Bad user: icon is empty String", TypeError);
new CreateCredentialsTest("options.publicKey.user.icon", "http://fidoalliance.co.nz/testimages/catimage.png")
.runTest("Bad user: icon is insecure", "SecurityError");
// // TODO: unicode tests for icon URL (see also: USVString)
// // user.displayName
new CreateCredentialsTest({path: "options.publicKey.user.displayName", value: undefined}).runTest("Bad user: displayName is undefined", TypeError);
new CreateCredentialsTest("options.publicKey.user.displayName", {}).runTest("Bad user: displayName is object", TypeError);
new CreateCredentialsTest("options.publicKey.user.displayName", null).runTest("Bad user: displayName is null", TypeError);
new CreateCredentialsTest("options.publicKey.user.displayName", "").runTest("Bad user: displayName is empty String", TypeError);
});
/* JSHINT */