Changeset 250940 in webkit
- Timestamp:
- Oct 9, 2019 4:03:06 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 deleted
- 72 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250938 r250940 1 2019-10-09 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Move the mock testing entrance to Internals 4 https://bugs.webkit.org/show_bug.cgi?id=202560 5 <rdar://problem/55973793> 6 7 Reviewed by Chris Dumez. 8 9 * http/wpt/webauthn/ctap-hid-failure.https.html: 10 * http/wpt/webauthn/ctap-hid-success.https.html: 11 * http/wpt/webauthn/ctap-nfc-failure.https.html: 12 * http/wpt/webauthn/idl.https.html: 13 * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html: 14 * http/wpt/webauthn/public-key-credential-create-failure-hid.https.html: 15 * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html: 16 * http/wpt/webauthn/public-key-credential-create-failure-local.https.html: 17 * http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html: 18 * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html: 19 * http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html: 20 * http/wpt/webauthn/public-key-credential-create-failure.https.html: 21 * http/wpt/webauthn/public-key-credential-create-success-hid.https.html: 22 * http/wpt/webauthn/public-key-credential-create-success-local.https.html: 23 * http/wpt/webauthn/public-key-credential-create-success-nfc.https.html: 24 * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html: 25 * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html: 26 * http/wpt/webauthn/public-key-credential-get-failure-hid.https.html: 27 * http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html: 28 * http/wpt/webauthn/public-key-credential-get-failure-local.https.html: 29 * http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html: 30 * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html: 31 * http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html: 32 * http/wpt/webauthn/public-key-credential-get-failure.https.html: 33 * http/wpt/webauthn/public-key-credential-get-success-hid.https.html: 34 * http/wpt/webauthn/public-key-credential-get-success-local.https.html: 35 * http/wpt/webauthn/public-key-credential-get-success-nfc.https.html: 36 * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html: 37 * http/wpt/webauthn/resources/public-key-credential-ip-address.https.html: 38 1 39 2019-10-09 Dean Jackson <dino@apple.com> 2 40 -
trunk/LayoutTests/http/wpt/credential-management/credentialscontainer-store-basics.https.html
r250249 r250940 43 43 }; 44 44 // A mock attestation object 45 if (window. testRunner)46 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });45 if (window.internals) 46 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } }); 47 47 const credential = await navigator.credentials.create(options); 48 48 -
trunk/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html
r245262 r250940 22 22 23 23 promise_test(function(t) { 24 if (window. testRunner)25 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "data-not-sent" } });24 if (window.internals) 25 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "data-not-sent" } }); 26 26 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 27 27 }, "CTAP HID with init sub stage data not sent error in a mock hid authenticator."); 28 28 29 29 promise_test(function(t) { 30 if (window. testRunner)31 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report" } });30 if (window.internals) 31 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report" } }); 32 32 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 33 33 }, "CTAP HID with init sub stage empty report error in a mock hid authenticator."); 34 34 35 35 promise_test(function(t) { 36 if (window. testRunner)37 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id" } });36 if (window.internals) 37 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id" } }); 38 38 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 39 39 }, "CTAP HID with init sub stage wrong channel id error in a mock hid authenticator."); 40 40 41 41 promise_test(function(t) { 42 if (window. testRunner)43 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce" } });42 if (window.internals) 43 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce" } }); 44 44 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 45 45 }, "CTAP HID with init sub stage wrong nonce error in a mock hid authenticator."); 46 46 47 47 promise_test(function(t) { 48 if (window. testRunner)49 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "msg", error: "data-not-sent" } });48 if (window.internals) 49 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "msg", error: "data-not-sent" } }); 50 50 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 51 51 }, "CTAP HID with msg sub stage data not sent error in a mock hid authenticator."); 52 52 53 53 promise_test(function(t) { 54 if (window. testRunner)55 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "msg", error: "empty-report" } });54 if (window.internals) 55 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "msg", error: "empty-report" } }); 56 56 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 57 57 }, "CTAP HID with msg sub stage empty report error in a mock hid authenticator."); 58 58 59 59 promise_test(function(t) { 60 if (window. testRunner)61 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "msg", error: "wrong-channel-id" } });60 if (window.internals) 61 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "msg", error: "wrong-channel-id" } }); 62 62 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 63 63 }, "CTAP HID with msg sub stage wrong channel id error in a mock hid authenticator."); 64 64 65 65 promise_test(function(t) { 66 if (window. testRunner)67 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "wrong-channel-id", payloadBase64:[testDummyMessagePayloadBase64] } });66 if (window.internals) 67 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "wrong-channel-id", payloadBase64:[testDummyMessagePayloadBase64] } }); 68 68 return promiseRejects(t, "UnknownError", navigator.credentials.create(defaultOptions), "Unknown internal error. Error code: 18"); 69 69 }, "CTAP HID with request::msg stage wrong channel id error in a mock hid authenticator."); -
trunk/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html
r239752 r250940 21 21 22 22 promise_test(function(t) { 23 if (window. testRunner)24 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], keepAlive: true } });23 if (window.internals) 24 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], keepAlive: true } }); 25 25 return navigator.credentials.create(defaultOptions).then(credential => { 26 26 assert_not_equals(credential, undefined); … … 30 30 31 31 promise_test(function(t) { 32 if (window. testRunner)33 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], fastDataArrival: true } });32 if (window.internals) 33 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], fastDataArrival: true } }); 34 34 return navigator.credentials.create(defaultOptions).then(credential => { 35 35 assert_not_equals(credential, undefined); … … 39 39 40 40 promise_test(function(t) { 41 if (window. testRunner)42 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });41 if (window.internals) 42 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } }); 43 43 return navigator.credentials.create(defaultOptions).then(credential => { 44 44 assert_not_equals(credential, undefined); … … 48 48 49 49 promise_test(function(t) { 50 if (window. testRunner)51 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });50 if (window.internals) 51 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } }); 52 52 return navigator.credentials.create(defaultOptions).then(credential => { 53 53 assert_not_equals(credential, undefined); … … 57 57 58 58 promise_test(function(t) { 59 if (window. testRunner)60 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });59 if (window.internals) 60 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } }); 61 61 return navigator.credentials.create(defaultOptions).then(credential => { 62 62 assert_not_equals(credential, undefined); -
trunk/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html
r249059 r250940 22 22 23 23 promise_test(function(t) { 24 if (window. testRunner)25 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, ""] } });24 if (window.internals) 25 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, ""] } }); 26 26 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 27 27 }, "CTAP NFC with empty apdu response in a mock nfc authenticator."); 28 28 29 29 promise_test(function(t) { 30 if (window. testRunner)31 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, testU2fApduWrongDataOnlyResponseBase64] } });30 if (window.internals) 31 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, testU2fApduWrongDataOnlyResponseBase64] } }); 32 32 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out."); 33 33 }, "CTAP NFC with wrong data error in a mock nfc authenticator."); -
trunk/LayoutTests/http/wpt/webauthn/idl.https.html
r250249 r250940 53 53 }; 54 54 // A mock attestation object 55 if (window. testRunner)56 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });55 if (window.internals) 56 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } }); 57 57 createdCredential = await navigator.credentials.create(creationOptions); 58 58 … … 62 62 } 63 63 }; 64 if (window. testRunner)65 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });64 if (window.internals) 65 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } }); 66 66 requestedCredential = await navigator.credentials.get(requestOptions); 67 67 -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html
r245262 r250940 22 22 }; 23 23 24 if (window. testRunner)25 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });24 if (window.internals) 25 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } }); 26 26 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 27 27 }, "PublicKeyCredential's [[create]] with malicious payload in a mock hid authenticator."); … … 45 45 }; 46 46 47 if (window. testRunner)48 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });47 if (window.internals) 48 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 49 49 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 50 50 }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator."); … … 68 68 }; 69 69 70 if (window. testRunner)71 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });70 if (window.internals) 71 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 72 72 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 73 73 }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator. 2"); … … 91 91 }; 92 92 93 if (window. testRunner)94 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });93 if (window.internals) 94 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 95 95 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 96 96 }, "PublicKeyCredential's [[create]] with mixed options in a mock hid authenticator."); … … 112 112 }; 113 113 114 if (window. testRunner)115 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } });114 if (window.internals) 115 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } }); 116 116 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 117 117 }, "PublicKeyCredential's [[create]] with InvalidStateError in a mock hid authenticator."); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html
r245262 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override it if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } }); 10 10 11 11 promise_test(function(t) { … … 46 46 }; 47 47 48 if (window. testRunner)49 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });48 if (window.internals) 49 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } }); 50 50 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 255"); 51 51 }, "PublicKeyCredential's [[create]] with malicious payload in a mock hid authenticator."); … … 68 68 }; 69 69 70 if (window. testRunner)71 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });70 if (window.internals) 71 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 72 72 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 43"); 73 73 }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator."); … … 90 90 }; 91 91 92 if (window. testRunner)93 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });92 if (window.internals) 93 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 94 94 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 43"); 95 95 }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator. 2"); … … 113 113 }; 114 114 115 if (window. testRunner)116 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });115 if (window.internals) 116 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 117 117 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 118 118 }, "PublicKeyCredential's [[create]] with mixed options in a mock hid authenticator."); … … 135 135 }; 136 136 137 if (window. testRunner)138 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });137 if (window.internals) 138 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 139 139 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 43"); 140 140 }, "PublicKeyCredential's [[create]] with mixed options in a mock hid authenticator. 2"); … … 156 156 }; 157 157 158 if (window. testRunner)159 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } });158 if (window.internals) 159 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } }); 160 160 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 161 161 }, "PublicKeyCredential's [[create]] with InvalidStateError in a mock hid authenticator."); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
r250249 r250940 10 10 const credentialID = await calculateCredentialID(privateKeyBase64); 11 11 // Default mock configuration. Tests need to override if they need different configuration. 12 if (window. testRunner)13 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false } });12 if (window.internals) 13 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false } }); 14 14 15 15 promise_test(t => { … … 122 122 } 123 123 }; 124 if (window. testRunner)125 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } });124 if (window.internals) 125 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } }); 126 126 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 127 127 }, "PublicKeyCredential's [[create]] with silent failure in a mock local authenticator. 5"); … … 143 143 } 144 144 }; 145 if (window. testRunner) {146 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } });145 if (window.internals) { 146 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } }); 147 147 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, userhandleBase64); 148 148 } -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
r250249 r250940 10 10 const credentialID = await calculateCredentialID(privateKeyBase64); 11 11 // Default mock configuration. Tests need to override if they need different configuration. 12 if (window. testRunner)13 testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } });12 if (window.internals) 13 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } }); 14 14 15 15 promise_test(t => { … … 117 117 } 118 118 }; 119 if (window. testRunner)120 testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });119 if (window.internals) 120 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } }); 121 121 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error."); 122 122 }, "PublicKeyCredential's [[create]] without attestation in a mock local authenticator."); … … 137 137 } 138 138 }; 139 if (window. testRunner) {140 testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });139 if (window.internals) { 140 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } }); 141 141 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, userhandleBase64); 142 142 } … … 165 165 }; 166 166 167 if (window. testRunner)168 testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } });167 if (window.internals) 168 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } }); 169 169 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 170 170 }, "PublicKeyCredential's [[create]] with timeout in a mock local authenticator."); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html
r249059 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override it if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "no-tags" } });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "no-tags" } }); 10 10 11 11 promise_test(function(t) { … … 67 67 }; 68 68 69 if (window. testRunner)70 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "wrong-tag-type" } });69 if (window.internals) 70 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "wrong-tag-type" } }); 71 71 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 72 72 }, "PublicKeyCredential's [[create]] with wrong tag type in a mock nfc authenticator."); … … 89 89 }; 90 90 91 if (window. testRunner)92 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "no-connections" } });91 if (window.internals) 92 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "no-connections" } }); 93 93 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 94 94 }, "PublicKeyCredential's [[create]] with no connections in a mock nfc authenticator."); … … 111 111 }; 112 112 113 if (window. testRunner)114 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64: [ ] } });113 if (window.internals) 114 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64: [ ] } }); 115 115 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 116 116 }, "PublicKeyCredential's [[create]] with null version in a mock nfc authenticator."); … … 133 133 }; 134 134 135 if (window. testRunner)136 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testDummyMessagePayloadBase64] } });135 if (window.internals) 136 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testDummyMessagePayloadBase64] } }); 137 137 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 138 138 }, "PublicKeyCredential's [[create]] with wrong version in a mock nfc authenticator."); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
r249656 r250940 22 22 }; 23 23 24 if (window. testRunner)25 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } });24 if (window.internals) 25 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } }); 26 26 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 27 27 }, "PublicKeyCredential's [[create]] with malformed APDU payload in a mock hid authenticator."); … … 44 44 }; 45 45 46 if (window. testRunner)47 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });46 if (window.internals) 47 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } }); 48 48 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 49 49 }, "PublicKeyCredential's [[create]] with malformed U2F register response in a mock hid authenticator."); … … 66 66 }; 67 67 68 if (window. testRunner)69 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } });68 if (window.internals) 69 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } }); 70 70 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 71 71 }, "PublicKeyCredential's [[create]] with register command error in a mock hid authenticator."); … … 89 89 }; 90 90 91 if (window. testRunner)92 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } });91 if (window.internals) 92 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } }); 93 93 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 94 94 }, "PublicKeyCredential's [[create]] with bogus command error in a mock hid authenticator."); … … 111 111 }; 112 112 113 if (window. testRunner)114 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });113 if (window.internals) 114 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } }); 115 115 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 116 116 }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator."); … … 134 134 }; 135 135 136 if (window. testRunner)137 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });136 if (window.internals) 137 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } }); 138 138 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 139 139 }, "PublicKeyCredential's [[create]] with second exclude credential matched in a mock hid authenticator."); … … 157 157 }; 158 158 159 if (window. testRunner)160 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });159 if (window.internals) 160 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } }); 161 161 return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out."); 162 162 }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator. Test of user presence."); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
r239752 r250940 21 21 }; 22 22 23 if (window. testRunner)24 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } });23 if (window.internals) 24 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } }); 25 25 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Couldn't parse the APDU response."); 26 26 }, "PublicKeyCredential's [[create]] with malformed APDU payload in a mock hid authenticator."); … … 42 42 }; 43 43 44 if (window. testRunner)45 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });44 if (window.internals) 45 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } }); 46 46 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Couldn't parse the U2F register response."); 47 47 }, "PublicKeyCredential's [[create]] with malformed U2F register response in a mock hid authenticator."); … … 63 63 }; 64 64 65 if (window. testRunner)66 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } });65 if (window.internals) 66 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } }); 67 67 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 27904"); 68 68 }, "PublicKeyCredential's [[create]] with register command error in a mock hid authenticator."); … … 85 85 }; 86 86 87 if (window. testRunner)88 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } });87 if (window.internals) 88 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } }); 89 89 return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 27904"); 90 90 }, "PublicKeyCredential's [[create]] with bogus command error in a mock hid authenticator."); … … 107 107 }; 108 108 109 if (window. testRunner)110 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });109 if (window.internals) 110 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } }); 111 111 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 112 112 }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator."); … … 130 130 }; 131 131 132 if (window. testRunner)133 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });132 if (window.internals) 133 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } }); 134 134 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 135 135 }, "PublicKeyCredential's [[create]] with second exclude credential matched in a mock hid authenticator."); … … 152 152 }; 153 153 154 if (window. testRunner)155 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });154 if (window.internals) 155 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } }); 156 156 return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator."); 157 157 }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator. Test of user presence."); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html
r245043 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ }); 10 10 11 11 promise_test(function(t) { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html
r250659 r250940 7 7 <script> 8 8 // Default mock configuration. Tests need to override if they need different configuration. 9 if (window. testRunner)10 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });9 if (window.internals) 10 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } }); 11 11 12 12 promise_test(t => { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html
r250249 r250940 11 11 const credentialID = await calculateCredentialID(privateKeyBase64); 12 12 // Default mock configuration. Tests need to override if they need different configuration. 13 if (window. testRunner)14 testRunner.setWebAuthenticationMockConfiguration({13 if (window.internals) 14 internals.setMockWebAuthenticationConfiguration({ 15 15 local: { 16 16 acceptAuthentication: true, -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html
r249059 r250940 7 7 <script> 8 8 // Default mock configuration. Tests need to override if they need different configuration. 9 if (window. testRunner)10 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } });9 if (window.internals) 10 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } }); 11 11 12 12 promise_test(t => { … … 72 72 }; 73 73 74 if (window. testRunner)75 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64], multipleTags: true } });74 if (window.internals) 75 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64], multipleTags: true } }); 76 76 return navigator.credentials.create(options).then(credential => { 77 77 checkCtapMakeCredentialResult(credential); … … 96 96 }; 97 97 98 if (window. testRunner)99 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fRegisterResponse] } });98 if (window.internals) 99 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fRegisterResponse] } }); 100 100 return navigator.credentials.create(options).then(credential => { 101 101 checkU2fMakeCredentialResult(credential); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
r249737 r250940 22 22 }; 23 23 24 if (window. testRunner)25 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });24 if (window.internals) 25 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } }); 26 26 return navigator.credentials.create(options).then(credential => { 27 27 checkU2fMakeCredentialResult(credential); … … 46 46 }; 47 47 48 if (window. testRunner)49 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });48 if (window.internals) 49 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } }); 50 50 return navigator.credentials.create(options).then(credential => { 51 51 checkU2fMakeCredentialResult(credential); … … 70 70 }; 71 71 72 if (window. testRunner)73 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });72 if (window.internals) 73 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } }); 74 74 return navigator.credentials.create(options).then(credential => { 75 75 checkU2fMakeCredentialResult(credential); … … 93 93 }; 94 94 95 if (window. testRunner)96 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fRegisterResponse] } });95 if (window.internals) 96 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fRegisterResponse] } }); 97 97 return navigator.credentials.create(options).then(credential => { 98 98 checkU2fMakeCredentialResult(credential); … … 117 117 }; 118 118 119 if (window. testRunner)120 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });119 if (window.internals) 120 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } }); 121 121 return navigator.credentials.create(options).then(credential => { 122 122 checkU2fMakeCredentialResult(credential); … … 141 141 }; 142 142 143 if (window. testRunner)144 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });143 if (window.internals) 144 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } }); 145 145 return navigator.credentials.create(options).then(credential => { 146 146 checkU2fMakeCredentialResult(credential, false); … … 165 165 }; 166 166 167 if (window. testRunner)168 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });167 if (window.internals) 168 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } }); 169 169 return navigator.credentials.create(options).then(credential => { 170 170 checkU2fMakeCredentialResult(credential, false); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html
r245500 r250940 13 13 }; 14 14 15 if (window. testRunner)16 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });15 if (window.internals) 16 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } }); 17 17 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 18 18 }, "PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator."); … … 27 27 }; 28 28 29 if (window. testRunner)30 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });29 if (window.internals) 30 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 31 31 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 32 32 }, "PublicKeyCredential's [[get]] with unsupported options in a mock hid authenticator."); … … 40 40 }; 41 41 42 if (window. testRunner)43 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });42 if (window.internals) 43 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); 44 44 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 45 45 }, "PublicKeyCredential's [[get]] with invalid credential in a mock hid authenticator."); … … 53 53 }; 54 54 55 if (window. testRunner)56 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });55 if (window.internals) 56 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); 57 57 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 58 58 }, "PublicKeyCredential's [[get]] with authenticator downgrade in a mock hid authenticator."); … … 67 67 }; 68 68 69 if (window. testRunner)70 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });69 if (window.internals) 70 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); 71 71 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 72 72 }, "PublicKeyCredential's [[get]] with authenticator downgrade in a mock hid authenticator. 2"); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html
r245500 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } }); 10 10 11 11 promise_test(t => { … … 32 32 }; 33 33 34 if (window. testRunner)35 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });34 if (window.internals) 35 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } }); 36 36 return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Unknown internal error. Error code: 255"); 37 37 }, "PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator."); … … 45 45 }; 46 46 47 if (window. testRunner)48 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });47 if (window.internals) 48 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } }); 49 49 return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Unknown internal error. Error code: 43"); 50 50 }, "PublicKeyCredential's [[get]] with unsupported options in a mock hid authenticator."); … … 57 57 }; 58 58 59 if (window. testRunner)60 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });59 if (window.internals) 60 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); 61 61 return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Unknown internal error. Error code: 34"); 62 62 }, "PublicKeyCredential's [[get]] with authenticator downgrade failed in a mock hid authenticator."); … … 70 70 }; 71 71 72 if (window. testRunner)73 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });72 if (window.internals) 73 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } }); 74 74 return promiseRejects(t, "NotSupportedError", navigator.credentials.get(options), "Cannot convert the request to U2F command."); 75 75 }, "PublicKeyCredential's [[get]] with authenticator downgrade succeeded and then U2F failed in a mock hid authenticator. 2"); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html
r250249 r250940 10 10 const credentialID = await calculateCredentialID(privateKeyBase64); 11 11 // Default mock configuration. Tests need to override if they need different configuration. 12 if (window. testRunner)13 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });12 if (window.internals) 13 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } }); 14 14 15 15 promise_test(t => { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html
r250249 r250940 10 10 const credentialID = await calculateCredentialID(privateKeyBase64); 11 11 // Default mock configuration. Tests need to override if they need different configuration. 12 if (window. testRunner)13 testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });12 if (window.internals) 13 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } }); 14 14 15 15 promise_test(t => { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html
r249059 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload" } });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload" } }); 10 10 11 11 promise_test(t => { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
r239752 r250940 14 14 }; 15 15 16 if (window. testRunner)17 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });16 if (window.internals) 17 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } }); 18 18 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 19 19 }, "PublicKeyCredential's [[get]] with malformed sign response in a mock hid authenticator."); … … 28 28 }; 29 29 30 if (window. testRunner)31 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } });30 if (window.internals) 31 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } }); 32 32 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 33 33 }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator."); … … 42 42 }; 43 43 44 if (window. testRunner)45 testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });44 if (window.internals) 45 internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } }); 46 46 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); 47 47 }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. 2"); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
r243193 r250940 13 13 }; 14 14 15 if (window. testRunner)16 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });15 if (window.internals) 16 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } }); 17 17 return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Couldn't parse the U2F sign response."); 18 18 }, "PublicKeyCredential's [[get]] with malformed sign response in a mock hid authenticator."); … … 26 26 }; 27 27 28 if (window. testRunner)29 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } });28 if (window.internals) 29 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } }); 30 30 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator."); 31 31 }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator."); … … 39 39 }; 40 40 41 if (window. testRunner)42 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });41 if (window.internals) 42 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } }); 43 43 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator."); 44 44 }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. 2"); … … 54 54 }; 55 55 56 if (window. testRunner)57 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });56 if (window.internals) 57 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } }); 58 58 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator."); 59 59 }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. (AppID)"); … … 68 68 }; 69 69 70 if (window. testRunner)71 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });70 if (window.internals) 71 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } }); 72 72 return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator."); 73 73 }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. 2 (AppID)"); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html
r245043 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ }); 10 10 11 11 promise_test(t => { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html
r249059 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } }); 10 10 11 11 promise_test(t => { -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html
r250249 r250940 10 10 const credentialID = await calculateCredentialID(privateKeyBase64); 11 11 // Default mock configuration. Tests need to override if they need different configuration. 12 if (window. testRunner)13 testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });12 if (window.internals) 13 internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } }); 14 14 15 15 function checkResult(credential) -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html
r249436 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testAssertionMessageApduBase64] } });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testAssertionMessageApduBase64] } }); 10 10 11 11 promise_test(t => { … … 31 31 }; 32 32 33 if (window. testRunner)34 testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fSignResponse] } });33 if (window.internals) 34 internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fSignResponse] } }); 35 35 return navigator.credentials.get(options).then(credential => { 36 36 return checkU2fGetAssertionResult(credential); -
trunk/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
r249059 r250940 14 14 }; 15 15 16 if (window. testRunner)17 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });16 if (window.internals) 17 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } }); 18 18 return navigator.credentials.get(options).then(credential => { 19 19 return checkU2fGetAssertionResult(credential); … … 30 30 }; 31 31 32 if (window. testRunner)33 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });32 if (window.internals) 33 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } }); 34 34 return navigator.credentials.get(options).then(credential => { 35 35 return checkU2fGetAssertionResult(credential); … … 46 46 }; 47 47 48 if (window. testRunner)49 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fSignResponse] } });48 if (window.internals) 49 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fSignResponse] } }); 50 50 return navigator.credentials.get(options).then(credential => { 51 51 return checkU2fGetAssertionResult(credential); … … 64 64 }; 65 65 66 if (window. testRunner)67 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });66 if (window.internals) 67 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } }); 68 68 return navigator.credentials.get(options).then(credential => { 69 69 return checkU2fGetAssertionResult(credential); … … 81 81 }; 82 82 83 if (window. testRunner)84 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });83 if (window.internals) 84 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } }); 85 85 return navigator.credentials.get(options).then(credential => { 86 86 return checkU2fGetAssertionResult(credential); … … 98 98 }; 99 99 100 if (window. testRunner)101 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });100 if (window.internals) 101 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } }); 102 102 return navigator.credentials.get(options).then(credential => { 103 103 return checkU2fGetAssertionResult(credential, true); … … 116 116 }; 117 117 118 if (window. testRunner)119 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });118 if (window.internals) 119 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } }); 120 120 return navigator.credentials.get(options).then(credential => { 121 121 return checkU2fGetAssertionResult(credential, true, "7eabc5cc3251bdc59115ef87b5f7ee74cb03747e39ba8341748565cc129c0719"); … … 133 133 }; 134 134 135 if (window. testRunner)136 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });135 if (window.internals) 136 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } }); 137 137 return navigator.credentials.get(options).then(credential => { 138 138 return checkU2fGetAssertionResult(credential); … … 150 150 }; 151 151 152 if (window. testRunner)153 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });152 if (window.internals) 153 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } }); 154 154 return navigator.credentials.get(options).then(credential => { 155 155 return checkU2fGetAssertionResult(credential, true); … … 167 167 }; 168 168 169 if (window. testRunner)170 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fSignResponse] } });169 if (window.internals) 170 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fSignResponse] } }); 171 171 return navigator.credentials.get(options).then(credential => { 172 172 return checkU2fGetAssertionResult(credential); … … 184 184 }; 185 185 186 if (window. testRunner)187 testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });186 if (window.internals) 187 internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } }); 188 188 return navigator.credentials.get(options).then(credential => { 189 189 return checkU2fGetAssertionResult(credential, true, "7eabc5cc3251bdc59115ef87b5f7ee74cb03747e39ba8341748565cc129c0719"); -
trunk/LayoutTests/http/wpt/webauthn/resources/public-key-credential-ip-address.https.html
r244863 r250940 6 6 <script> 7 7 // Default mock configuration. Tests need to override if they need different configuration. 8 if (window. testRunner)9 testRunner.setWebAuthenticationMockConfiguration({ });8 if (window.internals) 9 internals.setMockWebAuthenticationConfiguration({ }); 10 10 11 11 promise_test(function(t) { -
trunk/Source/WebCore/ChangeLog
r250939 r250940 1 2019-10-09 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Move the mock testing entrance to Internals 4 https://bugs.webkit.org/show_bug.cgi?id=202560 5 <rdar://problem/55973793> 6 7 Reviewed by Chris Dumez. 8 9 This patch moves TestRunner.setWebAuthenticationMockConfiguration to 10 Internals.setMockWebAuthenticationConfiguration and removes the old 11 entrance. The purpose of this patch is to allow API tests to use 12 the same mock infrastructure that is used by layout tests. 13 14 No new tests, covered by updates on existing tests. 15 16 * DerivedSources-input.xcfilelist: 17 * DerivedSources-output.xcfilelist: 18 * DerivedSources.make: 19 * Modules/webauthn/PublicKeyCredentialCreationOptions.h: 20 * WebCore.xcodeproj/project.pbxproj: 21 * page/ChromeClient.h: 22 (WebCore::ChromeClient::setMockWebAuthenticationConfiguration): 23 * testing/Internals.cpp: 24 (WebCore::Internals::setMockWebAuthenticationConfiguration): 25 * testing/Internals.h: 26 * testing/Internals.idl: 27 * testing/MockWebAuthenticationConfiguration.h: Added. 28 (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const): 29 (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode): 30 (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const): 31 (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode): 32 (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const): 33 (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode): 34 (WebCore::MockWebAuthenticationConfiguration::encode const): 35 (WebCore::MockWebAuthenticationConfiguration::decode): 36 * testing/MockWebAuthenticationConfiguration.idl: Added. 37 1 38 2019-10-09 Sihui Liu <sihui_liu@apple.com> 2 39 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r250825 r250940 1090 1090 $(PROJECT_DIR)/testing/MockPaymentCoordinator.idl 1091 1091 $(PROJECT_DIR)/testing/MockPaymentError.idl 1092 $(PROJECT_DIR)/testing/MockWebAuthenticationConfiguration.idl 1092 1093 $(PROJECT_DIR)/testing/ServiceWorkerInternals.idl 1093 1094 $(PROJECT_DIR)/testing/TypeConversions.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r250825 r250940 1060 1060 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockPaymentError.cpp 1061 1061 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockPaymentError.h 1062 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockWebAuthenticationConfiguration.cpp 1063 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockWebAuthenticationConfiguration.h 1062 1064 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMouseEvent.cpp 1063 1065 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMouseEvent.h -
trunk/Source/WebCore/DerivedSources.make
r250824 r250940 1077 1077 $(WebCore)/testing/MockPaymentCoordinator.idl \ 1078 1078 $(WebCore)/testing/MockPaymentError.idl \ 1079 $(WebCore)/testing/MockWebAuthenticationConfiguration.idl \ 1079 1080 $(WebCore)/testing/ServiceWorkerInternals.idl \ 1080 1081 $(WebCore)/testing/TypeConversions.idl \ -
trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h
r250659 r250940 34 34 #include "PublicKeyCredentialType.h" 35 35 #include "UserVerificationRequirement.h" 36 #include <wtf/CrossThreadCopier.h>37 36 #include <wtf/Forward.h> 38 37 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r250824 r250940 1739 1739 57152B7C21DD8BA1000C37CA /* U2fResponseConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 57152B7A21DD8BA1000C37CA /* U2fResponseConverter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1740 1740 57152B8021DDA581000C37CA /* WebAuthenticationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 57152B7E21DDA581000C37CA /* WebAuthenticationUtils.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1741 5715610B234C1B49008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */; }; 1742 5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1743 57156114234C7FD6008FC7AB /* JSMockWebAuthenticationConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57156111234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.cpp */; }; 1744 57156115234C7FDC008FC7AB /* JSMockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57156110234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.h */; }; 1741 1745 571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */; }; 1742 1746 572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */; }; … … 8606 8610 57152B7E21DDA581000C37CA /* WebAuthenticationUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationUtils.h; sourceTree = "<group>"; }; 8607 8611 57152B7F21DDA581000C37CA /* WebAuthenticationUtils.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticationUtils.cpp; sourceTree = "<group>"; }; 8612 57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockWebAuthenticationConfiguration.h; sourceTree = "<group>"; }; 8613 5715610D234C7481008FC7AB /* MockWebAuthenticationConfiguration.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockWebAuthenticationConfiguration.idl; sourceTree = "<group>"; }; 8614 57156110234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockWebAuthenticationConfiguration.h; sourceTree = "<group>"; }; 8615 57156111234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockWebAuthenticationConfiguration.cpp; sourceTree = "<group>"; }; 8608 8616 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSubtleCrypto.h; sourceTree = "<group>"; }; 8609 8617 571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSubtleCrypto.cpp; sourceTree = "<group>"; }; … … 17893 17901 A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */, 17894 17902 A140618A1E2ECA0A0032B34E /* MockPreviewLoaderClient.h */, 17903 57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */, 17904 5715610D234C7481008FC7AB /* MockWebAuthenticationConfiguration.idl */, 17895 17905 417F0D801FFEE14F008EF303 /* ServiceWorkerInternals.cpp */, 17896 17906 417F0D7E1FFEE14E008EF303 /* ServiceWorkerInternals.h */, … … 17933 17943 A1BB85B42159B3890067E07D /* JSMockPaymentError.cpp */, 17934 17944 A1BB85B52159B38A0067E07D /* JSMockPaymentError.h */, 17945 57156111234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.cpp */, 17946 57156110234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.h */, 17935 17947 427DA71B13735DFA007C57FB /* JSServiceWorkerInternals.cpp */, 17936 17948 427DA71C13735DFA007C57FB /* JSServiceWorkerInternals.h */, … … 28426 28438 A146D31B1F99BCFB00D29196 /* JSMockPaymentCoordinator.h in Headers */, 28427 28439 A1BB85B92159B3AE0067E07D /* JSMockPaymentError.h in Headers */, 28440 57156115234C7FDC008FC7AB /* JSMockWebAuthenticationConfiguration.h in Headers */, 28428 28441 427DA71E13735DFA007C57FB /* JSServiceWorkerInternals.h in Headers */, 28429 28442 EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */, … … 28443 28456 A1CBEF641F9F11290028DE7C /* MockPaymentMethod.h in Headers */, 28444 28457 A140618C1E2ECA0A0032B34E /* MockPreviewLoaderClient.h in Headers */, 28458 5715610B234C1B49008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */, 28445 28459 AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */, 28446 28460 A1763F3F1E205234001D58DE /* WebArchiveDumpSupport.h in Headers */, … … 31022 31036 CDF2B0171820540700F2B424 /* MockSourceBufferPrivate.h in Headers */, 31023 31037 CDF2B0191820540700F2B424 /* MockTracks.h in Headers */, 31038 5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */, 31024 31039 C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */, 31025 31040 709A01FE1E3D0BDD006B0D4C /* ModuleFetchFailureKind.h in Headers */, … … 32985 33000 A146D31A1F99BCF800D29196 /* JSMockPaymentCoordinator.cpp in Sources */, 32986 33001 A1BB85B82159B3A40067E07D /* JSMockPaymentError.cpp in Sources */, 33002 57156114234C7FD6008FC7AB /* JSMockWebAuthenticationConfiguration.cpp in Sources */, 32987 33003 427DA71D13735DFA007C57FB /* JSServiceWorkerInternals.cpp in Sources */, 32988 33004 EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */, -
trunk/Source/WebCore/page/ChromeClient.h
r249359 r250940 111 111 struct DateTimeChooserParameters; 112 112 struct GraphicsDeviceAdapter; 113 struct MockWebAuthenticationConfiguration; 113 114 struct ShareDataWithParsedURL; 114 115 struct ViewportArguments; … … 511 512 virtual void setUserIsInteracting(bool) { } 512 513 514 #if ENABLE(WEB_AUTHN) 515 virtual void setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration&) { } 516 #endif 517 513 518 protected: 514 519 virtual ~ChromeClient() = default; -
trunk/Source/WebCore/testing/Internals.cpp
r250738 r250940 5235 5235 } 5236 5236 5237 #if ENABLE(WEB_AUTHN) 5238 void Internals::setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration& configuration) 5239 { 5240 auto* document = contextDocument(); 5241 if (!document) 5242 return; 5243 auto* page = document->page(); 5244 if (!page) 5245 return; 5246 page->chrome().client().setMockWebAuthenticationConfiguration(configuration); 5247 } 5248 #endif 5249 5237 5250 } // namespace WebCore -
trunk/Source/WebCore/testing/Internals.h
r250735 r250940 113 113 template<typename IDLType> class DOMPromiseDeferred; 114 114 115 struct MockWebAuthenticationConfiguration; 116 115 117 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver 116 118 #if ENABLE(MEDIA_STREAM) … … 885 887 void addPrefetchLoadEventListener(HTMLLinkElement&, RefPtr<EventListener>&&); 886 888 889 #if ENABLE(WEB_AUTHN) 890 void setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration&); 891 #endif 892 887 893 private: 888 894 explicit Internals(Document&); -
trunk/Source/WebCore/testing/Internals.idl
r250663 r250940 795 795 796 796 void addPrefetchLoadEventListener(HTMLLinkElement link, EventListener? callback); 797 }; 797 798 [Conditional=WEB_AUTHN] void setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration configuration); 799 }; -
trunk/Source/WebKit/ChangeLog
r250934 r250940 1 2019-10-09 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Move the mock testing entrance to Internals 4 https://bugs.webkit.org/show_bug.cgi?id=202560 5 <rdar://problem/55973793> 6 7 Reviewed by Chris Dumez. 8 9 * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: 10 (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted. 11 * UIProcess/API/C/WKWebsiteDataStoreRef.h: 12 * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: 13 (WebKit::AuthenticatorTransportService::createMock): 14 * UIProcess/WebAuthentication/AuthenticatorTransportService.h: 15 * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: 16 (WebKit::MockAuthenticatorManager::MockAuthenticatorManager): 17 * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: 18 * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: 19 (WebKit::MockHidConnection::send): 20 (WebKit::MockHidConnection::registerDataReceivedCallbackInternal): 21 (WebKit::MockHidConnection::parseRequest): 22 (WebKit::MockHidConnection::feedReports): 23 (WebKit::MockHidConnection::shouldContinueFeedReports): 24 * UIProcess/WebAuthentication/Mock/MockHidConnection.h: 25 * UIProcess/WebAuthentication/Mock/MockHidService.cpp: 26 (WebKit::MockHidService::MockHidService): 27 * UIProcess/WebAuthentication/Mock/MockHidService.h: 28 * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: 29 * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: 30 (WebKit::MockLocalConnection::MockLocalConnection): 31 * UIProcess/WebAuthentication/Mock/MockLocalService.h: 32 * UIProcess/WebAuthentication/Mock/MockLocalService.mm: 33 (WebKit::MockLocalService::MockLocalService): 34 * UIProcess/WebAuthentication/Mock/MockNfcService.h: 35 * UIProcess/WebAuthentication/Mock/MockNfcService.mm: 36 (WebKit::MockNfcService::MockNfcService): 37 (WebKit::MockNfcService::platformStartDiscovery): 38 (WebKit::MockNfcService::detectTags const): 39 * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed. 40 * UIProcess/WebPageProxy.cpp: 41 (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration): 42 * UIProcess/WebPageProxy.h: 43 * UIProcess/WebPageProxy.messages.in: 44 * UIProcess/WebsiteData/WebsiteDataStore.h: 45 * WebKit.xcodeproj/project.pbxproj: 46 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 47 (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration): 48 * WebProcess/WebCoreSupport/WebChromeClient.h: 49 1 50 2019-10-09 Andy Estes <aestes@apple.com> 2 51 -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
r250804 r250940 29 29 #include "APIArray.h" 30 30 #include "APIHTTPCookieStore.h" 31 #include "MockWebAuthenticationConfiguration.h"32 31 #include "ShouldGrandfatherStatistics.h" 33 32 #include "WKAPICast.h" … … 659 658 } 660 659 661 void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configurationRef)662 {663 #if ENABLE(WEB_AUTHN)664 WebKit::MockWebAuthenticationConfiguration configuration;665 666 if (auto silentFailureRef = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("SilentFailure")).get())))667 configuration.silentFailure = WKBooleanGetValue(silentFailureRef);668 669 if (auto localRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Local")).get()))) {670 WebKit::MockWebAuthenticationConfiguration::Local local;671 local.acceptAuthentication = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAuthentication")).get())));672 local.acceptAttestation = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAttestation")).get())));673 if (local.acceptAttestation) {674 local.privateKeyBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64")).get())))->string();675 local.userCertificateBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("UserCertificateBase64")).get())))->string();676 local.intermediateCACertificateBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("IntermediateCACertificateBase64")).get())))->string();677 }678 if (auto preferredUserhandleBase64Ref = static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PreferredUserhandleBase64")).get())))679 local.preferredUserhandleBase64 = WebKit::toImpl(preferredUserhandleBase64Ref)->string();680 configuration.local = WTFMove(local);681 }682 683 if (auto hidRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Hid")).get()))) {684 WebKit::MockWebAuthenticationConfiguration::Hid hid;685 686 auto stage = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("Stage")).get())))->string();687 if (stage == "info")688 hid.stage = WebKit::MockWebAuthenticationConfiguration::Hid::Stage::Info;689 else if (stage == "request")690 hid.stage = WebKit::MockWebAuthenticationConfiguration::Hid::Stage::Request;691 692 auto subStage = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("SubStage")).get())))->string();693 if (subStage == "init")694 hid.subStage = WebKit::MockWebAuthenticationConfiguration::Hid::SubStage::Init;695 else if (subStage == "msg")696 hid.subStage = WebKit::MockWebAuthenticationConfiguration::Hid::SubStage::Msg;697 698 auto error = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("Error")).get())))->string();699 if (error == "success")700 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::Success;701 else if (error == "data-not-sent")702 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::DataNotSent;703 else if (error == "empty-report")704 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::EmptyReport;705 else if (error == "wrong-channel-id")706 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::WrongChannelId;707 else if (error == "malicious-payload")708 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::MaliciousPayload;709 else if (error == "unsupported-options")710 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::UnsupportedOptions;711 else if (error == "wrong-nonce")712 hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::WrongNonce;713 714 if (auto payloadBase64 = static_cast<WKArrayRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("PayloadBase64")).get())))715 hid.payloadBase64 = WebKit::toImpl(payloadBase64)->toStringVector();716 717 if (auto isU2f = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("IsU2f")).get())))718 hid.isU2f = WKBooleanGetValue(isU2f);719 720 if (auto keepAlive = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("KeepAlive")).get())))721 hid.keepAlive = WKBooleanGetValue(keepAlive);722 723 if (auto fastDataArrival = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("FastDataArrival")).get())))724 hid.fastDataArrival = WKBooleanGetValue(fastDataArrival);725 726 if (auto continueAfterErrorData = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("ContinueAfterErrorData")).get())))727 hid.continueAfterErrorData = WKBooleanGetValue(continueAfterErrorData);728 729 if (auto canDowngrade = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("CanDowngrade")).get())))730 hid.canDowngrade = WKBooleanGetValue(canDowngrade);731 732 configuration.hid = WTFMove(hid);733 }734 735 if (auto nfcRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Nfc")).get()))) {736 WebKit::MockWebAuthenticationConfiguration::Nfc nfc;737 738 auto error = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(nfcRef, adoptWK(WKStringCreateWithUTF8CString("Error")).get())))->string();739 if (error == "success")740 nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::Success;741 else if (error == "no-tags")742 nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::NoTags;743 else if (error == "wrong-tag-type")744 nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::WrongTagType;745 else if (error == "no-connections")746 nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::NoConnections;747 else if (error == "malicious-payload")748 nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::MaliciousPayload;749 750 if (auto payloadBase64 = static_cast<WKArrayRef>(WKDictionaryGetItemForKey(nfcRef, adoptWK(WKStringCreateWithUTF8CString("PayloadBase64")).get())))751 nfc.payloadBase64 = WebKit::toImpl(payloadBase64)->toStringVector();752 753 if (auto multipleTags = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(nfcRef, adoptWK(WKStringCreateWithUTF8CString("MultipleTags")).get())))754 nfc.multipleTags = WKBooleanGetValue(multipleTags);755 756 configuration.nfc = WTFMove(nfc);757 }758 759 WebKit::toImpl(dataStoreRef)->setMockWebAuthenticationConfiguration(WTFMove(configuration));760 #endif761 }762 763 660 void WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction callback) 764 661 { -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
r250804 r250940 144 144 WK_EXPORT void WKWebsiteDataStoreSetPerOriginStorageQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota); 145 145 146 WK_EXPORT void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configuration);147 148 146 WK_EXPORT void WKWebsiteDataStoreClearAllDeviceOrientationPermissions(WKWebsiteDataStoreRef dataStoreRef); 149 147 -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp
r249108 r250940 54 54 } 55 55 56 UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::createMock(WebCore::AuthenticatorTransport transport, Observer& observer, const MockWebAuthenticationConfiguration& configuration)56 UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::createMock(WebCore::AuthenticatorTransport transport, Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration) 57 57 { 58 58 switch (transport) { -
trunk/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h
r238166 r250940 32 32 #include <wtf/WeakPtr.h> 33 33 34 namespace WebCore { 35 struct MockWebAuthenticationConfiguration; 36 } 37 34 38 namespace WebKit { 35 39 36 40 class Authenticator; 37 38 struct MockWebAuthenticationConfiguration;39 41 40 42 class AuthenticatorTransportService : public CanMakeWeakPtr<AuthenticatorTransportService> { … … 50 52 51 53 static UniqueRef<AuthenticatorTransportService> create(WebCore::AuthenticatorTransport, Observer&); 52 static UniqueRef<AuthenticatorTransportService> createMock(WebCore::AuthenticatorTransport, Observer&, const MockWebAuthenticationConfiguration&);54 static UniqueRef<AuthenticatorTransportService> createMock(WebCore::AuthenticatorTransport, Observer&, const WebCore::MockWebAuthenticationConfiguration&); 53 55 54 56 virtual ~AuthenticatorTransportService() = default; -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
r250729 r250940 31 31 namespace WebKit { 32 32 33 MockAuthenticatorManager::MockAuthenticatorManager( MockWebAuthenticationConfiguration&& configuration)33 MockAuthenticatorManager::MockAuthenticatorManager(WebCore::MockWebAuthenticationConfiguration&& configuration) 34 34 : m_testConfiguration(WTFMove(configuration)) 35 35 { -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h
r236481 r250940 29 29 30 30 #include "AuthenticatorManager.h" 31 #include "MockWebAuthenticationConfiguration.h"31 #include <WebCore/MockWebAuthenticationConfiguration.h> 32 32 33 33 namespace WebKit { … … 35 35 class MockAuthenticatorManager final : public AuthenticatorManager { 36 36 public: 37 explicit MockAuthenticatorManager( MockWebAuthenticationConfiguration&&);37 explicit MockAuthenticatorManager(WebCore::MockWebAuthenticationConfiguration&&); 38 38 39 39 bool isMock() const final { return true; } 40 void setTestConfiguration( MockWebAuthenticationConfiguration&& configuration) { m_testConfiguration = WTFMove(configuration); }40 void setTestConfiguration(WebCore::MockWebAuthenticationConfiguration&& configuration) { m_testConfiguration = WTFMove(configuration); } 41 41 42 42 private: … … 44 44 void respondReceivedInternal(Respond&&) final; 45 45 46 MockWebAuthenticationConfiguration m_testConfiguration;46 WebCore::MockWebAuthenticationConfiguration m_testConfiguration; 47 47 }; 48 48 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp
r249108 r250940 39 39 40 40 namespace WebKit { 41 using Mock Hid = MockWebAuthenticationConfiguration::Hid;41 using Mock = WebCore::MockWebAuthenticationConfiguration; 42 42 using namespace WebCore; 43 43 using namespace cbor; … … 83 83 84 84 auto sent = DataSent::Yes; 85 if (weakThis->stagesMatch() && weakThis->m_configuration.hid->error == Mock Hid::Error::DataNotSent)85 if (weakThis->stagesMatch() && weakThis->m_configuration.hid->error == Mock::HidError::DataNotSent) 86 86 sent = DataSent::No; 87 87 callback(sent); … … 93 93 void MockHidConnection::registerDataReceivedCallbackInternal() 94 94 { 95 if (stagesMatch() && m_configuration.hid->error == Mock Hid::Error::EmptyReport) {95 if (stagesMatch() && m_configuration.hid->error == Mock::HidError::EmptyReport) { 96 96 receiveReport({ }); 97 97 shouldContinueFeedReports(); … … 124 124 if (m_requestMessage->cmd() == FidoHidDeviceCommand::kInit) { 125 125 auto previousSubStage = m_subStage; 126 m_subStage = Mock Hid::SubStage::Init;127 if (previousSubStage == Mock Hid::SubStage::Msg)128 m_stage = Mock Hid::Stage::Request;126 m_subStage = Mock::HidSubStage::Init; 127 if (previousSubStage == Mock::HidSubStage::Msg) 128 m_stage = Mock::HidStage::Request; 129 129 } 130 130 if (m_requestMessage->cmd() == FidoHidDeviceCommand::kCbor || m_requestMessage->cmd() == FidoHidDeviceCommand::kMsg) 131 m_subStage = Mock Hid::SubStage::Msg;132 133 if (m_stage == Mock Hid::Stage::Request && m_subStage == MockHid::SubStage::Msg) {131 m_subStage = Mock::HidSubStage::Msg; 132 133 if (m_stage == Mock::HidStage::Request && m_subStage == Mock::HidSubStage::Msg) { 134 134 // Make sure we issue different msg cmd for CTAP and U2F. 135 135 if (m_configuration.hid->canDowngrade && !m_configuration.hid->isU2f) … … 177 177 178 178 // Store nonce. 179 if (m_subStage == Mock Hid::SubStage::Init) {179 if (m_subStage == Mock::HidSubStage::Init) { 180 180 m_nonce = m_requestMessage->getMessagePayload(); 181 181 ASSERT(m_nonce.size() == kHidInitNonceLength); … … 192 192 using namespace MockHidConnectionInternal; 193 193 194 if (m_subStage == Mock Hid::SubStage::Init) {194 if (m_subStage == Mock::HidSubStage::Init) { 195 195 Vector<uint8_t> payload; 196 196 payload.reserveInitialCapacity(kHidInitResponseSize); 197 197 payload.appendVector(m_nonce); 198 198 size_t writePosition = payload.size(); 199 if (stagesMatch() && m_configuration.hid->error == Mock Hid::Error::WrongNonce)199 if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongNonce) 200 200 payload[0]--; 201 201 payload.grow(kHidInitResponseSize); 202 202 cryptographicallyRandomValues(payload.data() + writePosition, CtapChannelIdSize); 203 203 auto channel = kHidBroadcastChannel; 204 if (stagesMatch() && m_configuration.hid->error == Mock Hid::Error::WrongChannelId)204 if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId) 205 205 channel--; 206 206 FidoHidInitPacket initPacket(channel, FidoHidDeviceCommand::kInit, WTFMove(payload), payload.size()); … … 211 211 212 212 Optional<FidoHidMessage> message; 213 if (m_stage == Mock Hid::Stage::Info && m_subStage == MockHid::SubStage::Msg) {213 if (m_stage == Mock::HidStage::Info && m_subStage == Mock::HidSubStage::Msg) { 214 214 Vector<uint8_t> infoData; 215 215 if (m_configuration.hid->canDowngrade) … … 218 218 infoData = encodeAsCBOR(AuthenticatorGetInfoResponse({ ProtocolVersion::kCtap }, Vector<uint8_t>(aaguidLength, 0u))); 219 219 infoData.insert(0, static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)); // Prepend status code. 220 if (stagesMatch() && m_configuration.hid->error == Mock Hid::Error::WrongChannelId)220 if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId) 221 221 message = FidoHidMessage::create(m_currentChannel - 1, FidoHidDeviceCommand::kCbor, infoData); 222 222 else { … … 228 228 } 229 229 230 if (m_stage == Mock Hid::Stage::Request && m_subStage == MockHid::SubStage::Msg) {230 if (m_stage == Mock::HidStage::Request && m_subStage == Mock::HidSubStage::Msg) { 231 231 if (m_configuration.hid->keepAlive) { 232 232 m_configuration.hid->keepAlive = false; … … 236 236 return; 237 237 } 238 if (stagesMatch() && m_configuration.hid->error == Mock Hid::Error::UnsupportedOptions && (m_requireResidentKey || m_requireUserVerification))238 if (stagesMatch() && m_configuration.hid->error == Mock::HidError::UnsupportedOptions && (m_requireResidentKey || m_requireUserVerification)) 239 239 message = FidoHidMessage::create(m_currentChannel, FidoHidDeviceCommand::kCbor, { static_cast<uint8_t>(CtapDeviceResponseCode::kCtap2ErrUnsupportedOption) }); 240 240 else { … … 255 255 while (message->numPackets()) { 256 256 auto report = message->popNextPacket(); 257 if (!isFirst && stagesMatch() && m_configuration.hid->error == Mock Hid::Error::WrongChannelId)257 if (!isFirst && stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId) 258 258 report = FidoHidContinuationPacket(m_currentChannel - 1, 0, { }).getSerializedData(); 259 259 // Packets are feed asynchronously to mimic actual data transmission. … … 277 277 return; 278 278 m_configuration.hid->continueAfterErrorData = false; 279 m_configuration.hid->error = Mock Hid::Error::Success;279 m_configuration.hid->error = Mock::HidError::Success; 280 280 continueFeedReports(); 281 281 } -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h
r249108 r250940 29 29 30 30 #include "HidConnection.h" 31 #include "MockWebAuthenticationConfiguration.h"32 31 #include <WebCore/FidoHidMessage.h> 32 #include <WebCore/MockWebAuthenticationConfiguration.h> 33 33 #include <wtf/WeakPtr.h> 34 34 … … 46 46 class MockHidConnection final : public CanMakeWeakPtr<MockHidConnection>, public HidConnection { 47 47 public: 48 MockHidConnection(IOHIDDeviceRef, const MockWebAuthenticationConfiguration&);48 MockHidConnection(IOHIDDeviceRef, const WebCore::MockWebAuthenticationConfiguration&); 49 49 50 50 private: … … 61 61 void continueFeedReports(); 62 62 63 MockWebAuthenticationConfiguration m_configuration;63 WebCore::MockWebAuthenticationConfiguration m_configuration; 64 64 Optional<fido::FidoHidMessage> m_requestMessage; 65 MockWebAuthenticationConfiguration::Hid::Stage m_stage { MockWebAuthenticationConfiguration::Hid::Stage::Info };66 MockWebAuthenticationConfiguration::Hid::SubStage m_subStage { MockWebAuthenticationConfiguration::Hid::SubStage::Init };65 WebCore::MockWebAuthenticationConfiguration::HidStage m_stage { MockWebAuthenticationConfiguration::HidStage::Info }; 66 WebCore::MockWebAuthenticationConfiguration::HidSubStage m_subStage { MockWebAuthenticationConfiguration::HidSubStage::Init }; 67 67 uint32_t m_currentChannel { fido::kHidBroadcastChannel }; 68 68 bool m_requireResidentKey { false }; -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.cpp
r249108 r250940 34 34 namespace WebKit { 35 35 36 MockHidService::MockHidService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)36 MockHidService::MockHidService(Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration) 37 37 : HidService(observer) 38 38 , m_configuration(configuration) -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h
r249108 r250940 29 29 30 30 #include "HidService.h" 31 #include "MockWebAuthenticationConfiguration.h"31 #include <WebCore/MockWebAuthenticationConfiguration.h> 32 32 33 33 namespace WebKit { 34 35 struct MockWebAuthenticationConfiguration;36 34 37 35 class MockHidService final : public HidService { … … 43 41 UniqueRef<HidConnection> createHidConnection(IOHIDDeviceRef) const final; 44 42 45 MockWebAuthenticationConfiguration m_configuration;43 WebCore::MockWebAuthenticationConfiguration m_configuration; 46 44 }; 47 45 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h
r250249 r250940 29 29 30 30 #include "LocalConnection.h" 31 #include "MockWebAuthenticationConfiguration.h"31 #include <WebCore/MockWebAuthenticationConfiguration.h> 32 32 33 33 namespace WebKit { … … 35 35 class MockLocalConnection final : public LocalConnection { 36 36 public: 37 explicit MockLocalConnection(const MockWebAuthenticationConfiguration&);37 explicit MockLocalConnection(const WebCore::MockWebAuthenticationConfiguration&); 38 38 39 39 private: … … 43 43 NSDictionary *selectCredential(const NSArray *) const final; 44 44 45 MockWebAuthenticationConfiguration m_configuration;45 WebCore::MockWebAuthenticationConfiguration m_configuration; 46 46 }; 47 47 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
r250249 r250940 37 37 namespace WebKit { 38 38 39 MockLocalConnection::MockLocalConnection(const MockWebAuthenticationConfiguration& configuration)39 MockLocalConnection::MockLocalConnection(const WebCore::MockWebAuthenticationConfiguration& configuration) 40 40 : m_configuration(configuration) 41 41 { -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h
r236481 r250940 29 29 30 30 #include "LocalService.h" 31 #include "MockWebAuthenticationConfiguration.h"31 #include <WebCore/MockWebAuthenticationConfiguration.h> 32 32 33 33 namespace WebKit { 34 34 35 struct MockWebAuthenticationConfiguration;36 37 35 class MockLocalService final : public LocalService { 38 36 public: 39 MockLocalService(Observer&, const MockWebAuthenticationConfiguration&);37 MockLocalService(Observer&, const WebCore::MockWebAuthenticationConfiguration&); 40 38 41 39 private: … … 43 41 UniqueRef<LocalConnection> createLocalConnection() const final; 44 42 45 MockWebAuthenticationConfiguration m_configuration;43 WebCore::MockWebAuthenticationConfiguration m_configuration; 46 44 }; 47 45 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.mm
r238166 r250940 34 34 namespace WebKit { 35 35 36 MockLocalService::MockLocalService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)36 MockLocalService::MockLocalService(Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration) 37 37 : LocalService(observer) 38 38 , m_configuration(configuration) -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.h
r249059 r250940 28 28 #if ENABLE(WEB_AUTHN) 29 29 30 #include "MockWebAuthenticationConfiguration.h"31 30 #include "NfcService.h" 31 #include <WebCore/MockWebAuthenticationConfiguration.h> 32 32 33 33 OBJC_CLASS NSData; … … 35 35 namespace WebKit { 36 36 37 struct MockWebAuthenticationConfiguration;38 39 37 class MockNfcService final : public NfcService { 40 38 public: 41 MockNfcService(Observer&, const MockWebAuthenticationConfiguration&);39 MockNfcService(Observer&, const WebCore::MockWebAuthenticationConfiguration&); 42 40 43 41 NSData* transceive(); … … 48 46 void detectTags() const; 49 47 50 MockWebAuthenticationConfiguration m_configuration;48 WebCore::MockWebAuthenticationConfiguration m_configuration; 51 49 }; 52 50 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm
r249934 r250940 109 109 namespace WebKit { 110 110 using namespace fido; 111 using Mock Nfc = MockWebAuthenticationConfiguration::Nfc;111 using Mock = WebCore::MockWebAuthenticationConfiguration; 112 112 113 113 #if HAVE(NEAR_FIELD) … … 144 144 #endif // HAVE(NEAR_FIELD) 145 145 146 MockNfcService::MockNfcService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)146 MockNfcService::MockNfcService(Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration) 147 147 : NfcService(observer) 148 148 , m_configuration(configuration) … … 170 170 171 171 Method methodToSwizzle2 = class_getInstanceMethod(getNFReaderSessionClass(), @selector(connectTag:)); 172 if (m_configuration.nfc->error == Mock Nfc::Error::NoConnections)172 if (m_configuration.nfc->error == Mock::NfcError::NoConnections) 173 173 method_setImplementation(methodToSwizzle2, (IMP)NFReaderSessionConnectTagFail); 174 174 else … … 195 195 { 196 196 #if HAVE(NEAR_FIELD) 197 if (m_configuration.nfc->error == Mock Nfc::Error::NoTags)197 if (m_configuration.nfc->error == Mock::NfcError::NoTags) 198 198 return; 199 199 200 200 auto callback = makeBlockPtr([configuration = m_configuration] { 201 201 auto tags = adoptNS([[NSMutableArray alloc] init]); 202 if (configuration.nfc->error == Mock Nfc::Error::WrongTagType || configuration.nfc->multipleTags)202 if (configuration.nfc->error == Mock::NfcError::WrongTagType || configuration.nfc->multipleTags) 203 203 [tags addObject:adoptNS([[WKMockNFTag alloc] initWithType:NFTagTypeUnknown]).get()]; 204 204 else -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r250876 r250940 9393 9393 #endif 9394 9394 9395 #if ENABLE(WEB_AUTHN) 9396 void WebPageProxy::setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration&& configuration) 9397 { 9398 m_websiteDataStore->setMockWebAuthenticationConfiguration(WTFMove(configuration)); 9399 } 9400 #endif 9401 9395 9402 } // namespace WebKit 9396 9403 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r250876 r250940 214 214 struct GlobalWindowIdentifier; 215 215 struct MediaStreamRequest; 216 struct MockWebAuthenticationConfiguration; 216 217 struct PrewarmInformation; 217 218 struct SecurityOriginData; … … 1588 1589 void maybeInitializeSandboxExtensionHandle(WebProcessProxy&, const URL&, const URL& resourceDirectoryURL, SandboxExtension::Handle&); 1589 1590 1591 #if ENABLE(WEB_AUTHN) 1592 void setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&&); 1593 #endif 1594 1590 1595 private: 1591 1596 WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r250780 r250940 575 575 DidCreateContextForVisibilityPropagation(WebKit::LayerHostingContextID contextID); 576 576 #endif 577 578 #if ENABLE(WEB_AUTHN) 579 SetMockWebAuthenticationConfiguration(struct WebCore::MockWebAuthenticationConfiguration configuration); 580 #endif 577 581 } -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r250804 r250940 65 65 class RegistrableDomain; 66 66 class SecurityOrigin; 67 68 struct MockWebAuthenticationConfiguration; 67 69 } 68 70 … … 79 81 enum class WebsiteDataFetchOption; 80 82 enum class WebsiteDataType; 81 struct MockWebAuthenticationConfiguration;82 83 struct WebsiteDataRecord; 83 84 struct WebsiteDataStoreParameters; … … 253 254 #if ENABLE(WEB_AUTHN) 254 255 AuthenticatorManager& authenticatorManager() { return m_authenticatorManager.get(); } 255 void setMockWebAuthenticationConfiguration( MockWebAuthenticationConfiguration&&);256 void setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&&); 256 257 #endif 257 258 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r250876 r250940 1074 1074 57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */; }; 1075 1075 57DCEDB3214C60530016B847 /* WebAuthenticatorCoordinatorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 57608295202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.h */; }; 1076 57DCEDBF214F0DCF0016B847 /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */; };1077 1076 57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC1214F114C0016B847 /* MockLocalService.h */; }; 1078 1077 57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC5214F18300016B847 /* MockLocalConnection.h */; }; … … 3565 3564 57DCEDA8214A568B0016B847 /* LocalConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalConnection.mm; sourceTree = "<group>"; }; 3566 3565 57DCEDAA214B9B430016B847 /* DeviceIdentitySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceIdentitySPI.h; sourceTree = "<group>"; }; 3567 57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockWebAuthenticationConfiguration.h; sourceTree = "<group>"; };3568 3566 57DCEDC1214F114C0016B847 /* MockLocalService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockLocalService.h; sourceTree = "<group>"; }; 3569 3567 57DCEDC2214F114C0016B847 /* MockLocalService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockLocalService.mm; sourceTree = "<group>"; }; … … 7144 7142 57B8264A230603C100B72EB0 /* MockNfcService.h */, 7145 7143 57B8264B230603C100B72EB0 /* MockNfcService.mm */, 7146 57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */,7147 7144 ); 7148 7145 path = Mock; … … 9584 9581 57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */, 9585 9582 57B8264C230603C100B72EB0 /* MockNfcService.h in Headers */, 9586 57DCEDBF214F0DCF0016B847 /* MockWebAuthenticationConfiguration.h in Headers */,9587 9583 C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */, 9588 9584 2D50366B1BCDE17900E20BB3 /* NativeWebGestureEvent.h in Headers */, -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r250717 r250940 99 99 #endif 100 100 101 #if ENABLE(WEB_AUTHN) 102 #include <WebCore/MockWebAuthenticationConfiguration.h> 103 #endif 104 101 105 namespace WebKit { 102 106 using namespace WebCore; … … 1358 1362 } 1359 1363 1364 #if ENABLE(WEB_AUTHN) 1365 void WebChromeClient::setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration& configuration) 1366 { 1367 m_page.send(Messages::WebPageProxy::SetMockWebAuthenticationConfiguration(configuration)); 1368 } 1369 #endif 1370 1360 1371 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r250650 r250940 382 382 void setUserIsInteracting(bool) final; 383 383 384 #if ENABLE(WEB_AUTHN) 385 void setMockWebAuthenticationConfiguration(const WebCore::MockWebAuthenticationConfiguration&) final; 386 #endif 387 384 388 String m_cachedToolTip; 385 389 mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; -
trunk/Tools/ChangeLog
r250930 r250940 1 2019-10-09 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Move the mock testing entrance to Internals 4 https://bugs.webkit.org/show_bug.cgi?id=202560 5 <rdar://problem/55973793> 6 7 Reviewed by Chris Dumez. 8 9 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 10 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 11 (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted. 12 * WebKitTestRunner/InjectedBundle/TestRunner.h: 13 * WebKitTestRunner/TestController.cpp: 14 (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted. 15 * WebKitTestRunner/TestController.h: 16 * WebKitTestRunner/TestInvocation.cpp: 17 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 18 1 19 2019-10-09 Daniel Bates <dabates@apple.com> 2 20 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r250904 r250940 392 392 void setServiceWorkerFetchTimeout(double seconds); 393 393 394 // WebAuthN 395 void setWebAuthenticationMockConfiguration(object configuration); 394 // WebAuthn 396 395 void addTestKeyToKeychain(DOMString privateKeyBase64, DOMString attrLabel, DOMString applicationTagBase64); 397 396 void cleanUpKeychain(DOMString attrLabel, optional DOMString applicationTagBase64); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r250904 r250940 2629 2629 } 2630 2630 2631 // WebAuthN 2632 void TestRunner::setWebAuthenticationMockConfiguration(JSValueRef configurationValue) 2633 { 2634 auto& injectedBundle = InjectedBundle::singleton(); 2635 WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page()); 2636 JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); 2637 if (!JSValueIsObject(context, configurationValue)) 2638 return; 2639 JSObjectRef configuration = JSValueToObject(context, configurationValue, 0); 2640 2641 Vector<WKRetainPtr<WKStringRef>> configurationKeys; 2642 Vector<WKRetainPtr<WKTypeRef>> configurationValues; 2643 2644 JSRetainPtr<JSStringRef> silentFailurePropertyName(Adopt, JSStringCreateWithUTF8CString("silentFailure")); 2645 JSValueRef silentFailureValue = JSObjectGetProperty(context, configuration, silentFailurePropertyName.get(), 0); 2646 if (!JSValueIsUndefined(context, silentFailureValue)) { 2647 if (!JSValueIsBoolean(context, silentFailureValue)) 2648 return; 2649 bool silentFailure = JSValueToBoolean(context, silentFailureValue); 2650 configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("SilentFailure"))); 2651 configurationValues.append(adoptWK(WKBooleanCreate(silentFailure)).get()); 2652 } 2653 2654 JSRetainPtr<JSStringRef> localPropertyName(Adopt, JSStringCreateWithUTF8CString("local")); 2655 JSValueRef localValue = JSObjectGetProperty(context, configuration, localPropertyName.get(), 0); 2656 if (!JSValueIsUndefined(context, localValue) && !JSValueIsNull(context, localValue)) { 2657 if (!JSValueIsObject(context, localValue)) 2658 return; 2659 JSObjectRef local = JSValueToObject(context, localValue, 0); 2660 2661 JSRetainPtr<JSStringRef> acceptAuthenticationPropertyName(Adopt, JSStringCreateWithUTF8CString("acceptAuthentication")); 2662 JSValueRef acceptAuthenticationValue = JSObjectGetProperty(context, local, acceptAuthenticationPropertyName.get(), 0); 2663 if (!JSValueIsBoolean(context, acceptAuthenticationValue)) 2664 return; 2665 bool acceptAuthentication = JSValueToBoolean(context, acceptAuthenticationValue); 2666 2667 JSRetainPtr<JSStringRef> acceptAttestationPropertyName(Adopt, JSStringCreateWithUTF8CString("acceptAttestation")); 2668 JSValueRef acceptAttestationValue = JSObjectGetProperty(context, local, acceptAttestationPropertyName.get(), 0); 2669 if (!JSValueIsBoolean(context, acceptAttestationValue)) 2670 return; 2671 bool acceptAttestation = JSValueToBoolean(context, acceptAttestationValue); 2672 2673 Vector<WKRetainPtr<WKStringRef>> localKeys; 2674 Vector<WKRetainPtr<WKTypeRef>> localValues; 2675 localKeys.append(adoptWK(WKStringCreateWithUTF8CString("AcceptAuthentication"))); 2676 localValues.append(adoptWK(WKBooleanCreate(acceptAuthentication)).get()); 2677 localKeys.append(adoptWK(WKStringCreateWithUTF8CString("AcceptAttestation"))); 2678 localValues.append(adoptWK(WKBooleanCreate(acceptAttestation)).get()); 2679 2680 if (acceptAttestation) { 2681 JSRetainPtr<JSStringRef> privateKeyBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("privateKeyBase64")); 2682 JSValueRef privateKeyBase64Value = JSObjectGetProperty(context, local, privateKeyBase64PropertyName.get(), 0); 2683 if (!JSValueIsString(context, privateKeyBase64Value)) 2684 return; 2685 2686 JSRetainPtr<JSStringRef> userCertificateBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("userCertificateBase64")); 2687 JSValueRef userCertificateBase64Value = JSObjectGetProperty(context, local, userCertificateBase64PropertyName.get(), 0); 2688 if (!JSValueIsString(context, userCertificateBase64Value)) 2689 return; 2690 2691 JSRetainPtr<JSStringRef> intermediateCACertificateBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("intermediateCACertificateBase64")); 2692 JSValueRef intermediateCACertificateBase64Value = JSObjectGetProperty(context, local, intermediateCACertificateBase64PropertyName.get(), 0); 2693 if (!JSValueIsString(context, intermediateCACertificateBase64Value)) 2694 return; 2695 2696 localKeys.append(adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64"))); 2697 localValues.append(toWK(adopt(JSValueToStringCopy(context, privateKeyBase64Value, 0)).get())); 2698 localKeys.append(adoptWK(WKStringCreateWithUTF8CString("UserCertificateBase64"))); 2699 localValues.append(toWK(adopt(JSValueToStringCopy(context, userCertificateBase64Value, 0)).get())); 2700 localKeys.append(adoptWK(WKStringCreateWithUTF8CString("IntermediateCACertificateBase64"))); 2701 localValues.append(toWK(adopt(JSValueToStringCopy(context, intermediateCACertificateBase64Value, 0)).get())); 2702 } 2703 2704 JSRetainPtr<JSStringRef> preferredUserhandleBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("preferredUserhandleBase64")); 2705 JSValueRef preferredUserhandleBase64Value = JSObjectGetProperty(context, local, preferredUserhandleBase64PropertyName.get(), 0); 2706 if (!JSValueIsUndefined(context, preferredUserhandleBase64Value) && !JSValueIsNull(context, preferredUserhandleBase64Value)) { 2707 if (!JSValueIsString(context, preferredUserhandleBase64Value)) 2708 return; 2709 2710 localKeys.append(adoptWK(WKStringCreateWithUTF8CString("PreferredUserhandleBase64"))); 2711 localValues.append(toWK(adopt(JSValueToStringCopy(context, preferredUserhandleBase64Value, 0)).get())); 2712 } 2713 2714 Vector<WKStringRef> rawLocalKeys; 2715 Vector<WKTypeRef> rawLocalValues; 2716 rawLocalKeys.resize(localKeys.size()); 2717 rawLocalValues.resize(localValues.size()); 2718 for (size_t i = 0; i < localKeys.size(); ++i) { 2719 rawLocalKeys[i] = localKeys[i].get(); 2720 rawLocalValues[i] = localValues[i].get(); 2721 } 2722 2723 configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("Local"))); 2724 configurationValues.append(adoptWK(WKDictionaryCreate(rawLocalKeys.data(), rawLocalValues.data(), rawLocalKeys.size()))); 2725 } 2726 2727 JSRetainPtr<JSStringRef> hidPropertyName(Adopt, JSStringCreateWithUTF8CString("hid")); 2728 JSValueRef hidValue = JSObjectGetProperty(context, configuration, hidPropertyName.get(), 0); 2729 if (!JSValueIsUndefined(context, hidValue) && !JSValueIsNull(context, hidValue)) { 2730 if (!JSValueIsObject(context, hidValue)) 2731 return; 2732 JSObjectRef hid = JSValueToObject(context, hidValue, 0); 2733 2734 JSRetainPtr<JSStringRef> stagePropertyName(Adopt, JSStringCreateWithUTF8CString("stage")); 2735 JSValueRef stageValue = JSObjectGetProperty(context, hid, stagePropertyName.get(), 0); 2736 if (!JSValueIsString(context, stageValue)) 2737 return; 2738 2739 JSRetainPtr<JSStringRef> subStagePropertyName(Adopt, JSStringCreateWithUTF8CString("subStage")); 2740 JSValueRef subStageValue = JSObjectGetProperty(context, hid, subStagePropertyName.get(), 0); 2741 if (!JSValueIsString(context, subStageValue)) 2742 return; 2743 2744 JSRetainPtr<JSStringRef> errorPropertyName(Adopt, JSStringCreateWithUTF8CString("error")); 2745 JSValueRef errorValue = JSObjectGetProperty(context, hid, errorPropertyName.get(), 0); 2746 if (!JSValueIsString(context, errorValue)) 2747 return; 2748 2749 Vector<WKRetainPtr<WKStringRef>> hidKeys; 2750 Vector<WKRetainPtr<WKTypeRef>> hidValues; 2751 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("Stage"))); 2752 hidValues.append(toWK(adopt(JSValueToStringCopy(context, stageValue, 0)).get())); 2753 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("SubStage"))); 2754 hidValues.append(toWK(adopt(JSValueToStringCopy(context, subStageValue, 0)).get())); 2755 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("Error"))); 2756 hidValues.append(toWK(adopt(JSValueToStringCopy(context, errorValue, 0)).get())); 2757 2758 JSRetainPtr<JSStringRef> payloadBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("payloadBase64")); 2759 JSValueRef payloadBase64Value = JSObjectGetProperty(context, hid, payloadBase64PropertyName.get(), 0); 2760 if (!JSValueIsUndefined(context, payloadBase64Value) && !JSValueIsNull(context, payloadBase64Value)) { 2761 if (!JSValueIsArray(context, payloadBase64Value)) 2762 return; 2763 2764 JSObjectRef payloadBase64 = JSValueToObject(context, payloadBase64Value, nullptr); 2765 static auto lengthProperty = adopt(JSStringCreateWithUTF8CString("length")); 2766 JSValueRef payloadBase64LengthValue = JSObjectGetProperty(context, payloadBase64, lengthProperty.get(), nullptr); 2767 if (!JSValueIsNumber(context, payloadBase64LengthValue)) 2768 return; 2769 2770 auto payloadBase64s = adoptWK(WKMutableArrayCreate()); 2771 auto payloadBase64Length = static_cast<size_t>(JSValueToNumber(context, payloadBase64LengthValue, nullptr)); 2772 for (size_t i = 0; i < payloadBase64Length; ++i) { 2773 JSValueRef payloadBase64Value = JSObjectGetPropertyAtIndex(context, payloadBase64, i, nullptr); 2774 if (!JSValueIsString(context, payloadBase64Value)) 2775 continue; 2776 WKArrayAppendItem(payloadBase64s.get(), toWK(adopt(JSValueToStringCopy(context, payloadBase64Value, 0)).get()).get()); 2777 } 2778 2779 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("PayloadBase64"))); 2780 hidValues.append(payloadBase64s); 2781 } 2782 2783 JSRetainPtr<JSStringRef> isU2fPropertyName(Adopt, JSStringCreateWithUTF8CString("isU2f")); 2784 JSValueRef isU2fValue = JSObjectGetProperty(context, hid, isU2fPropertyName.get(), 0); 2785 if (!JSValueIsUndefined(context, isU2fValue) && !JSValueIsNull(context, isU2fValue)) { 2786 if (!JSValueIsBoolean(context, isU2fValue)) 2787 return; 2788 bool isU2f = JSValueToBoolean(context, isU2fValue); 2789 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("IsU2f"))); 2790 hidValues.append(adoptWK(WKBooleanCreate(isU2f)).get()); 2791 } 2792 2793 JSRetainPtr<JSStringRef> keepAlivePropertyName(Adopt, JSStringCreateWithUTF8CString("keepAlive")); 2794 JSValueRef keepAliveValue = JSObjectGetProperty(context, hid, keepAlivePropertyName.get(), 0); 2795 if (!JSValueIsUndefined(context, keepAliveValue) && !JSValueIsNull(context, keepAliveValue)) { 2796 if (!JSValueIsBoolean(context, keepAliveValue)) 2797 return; 2798 bool keepAlive = JSValueToBoolean(context, keepAliveValue); 2799 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("KeepAlive"))); 2800 hidValues.append(adoptWK(WKBooleanCreate(keepAlive)).get()); 2801 } 2802 2803 JSRetainPtr<JSStringRef> fastDataArrivalPropertyName(Adopt, JSStringCreateWithUTF8CString("fastDataArrival")); 2804 JSValueRef fastDataArrivalValue = JSObjectGetProperty(context, hid, fastDataArrivalPropertyName.get(), 0); 2805 if (!JSValueIsUndefined(context, fastDataArrivalValue) && !JSValueIsNull(context, fastDataArrivalValue)) { 2806 if (!JSValueIsBoolean(context, fastDataArrivalValue)) 2807 return; 2808 bool fastDataArrival = JSValueToBoolean(context, fastDataArrivalValue); 2809 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("FastDataArrival"))); 2810 hidValues.append(adoptWK(WKBooleanCreate(fastDataArrival)).get()); 2811 } 2812 2813 JSRetainPtr<JSStringRef> continueAfterErrorDataPropertyName(Adopt, JSStringCreateWithUTF8CString("continueAfterErrorData")); 2814 JSValueRef continueAfterErrorDataValue = JSObjectGetProperty(context, hid, continueAfterErrorDataPropertyName.get(), 0); 2815 if (!JSValueIsUndefined(context, continueAfterErrorDataValue) && !JSValueIsNull(context, continueAfterErrorDataValue)) { 2816 if (!JSValueIsBoolean(context, continueAfterErrorDataValue)) 2817 return; 2818 bool continueAfterErrorData = JSValueToBoolean(context, continueAfterErrorDataValue); 2819 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("ContinueAfterErrorData"))); 2820 hidValues.append(adoptWK(WKBooleanCreate(continueAfterErrorData)).get()); 2821 } 2822 2823 JSRetainPtr<JSStringRef> canDowngradePropertyName(Adopt, JSStringCreateWithUTF8CString("canDowngrade")); 2824 JSValueRef canDowngradeValue = JSObjectGetProperty(context, hid, canDowngradePropertyName.get(), 0); 2825 if (!JSValueIsUndefined(context, canDowngradeValue) && !JSValueIsNull(context, canDowngradeValue)) { 2826 if (!JSValueIsBoolean(context, canDowngradeValue)) 2827 return; 2828 bool canDowngrade = JSValueToBoolean(context, canDowngradeValue); 2829 hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("CanDowngrade"))); 2830 hidValues.append(adoptWK(WKBooleanCreate(canDowngrade)).get()); 2831 } 2832 2833 Vector<WKStringRef> rawHidKeys; 2834 Vector<WKTypeRef> rawHidValues; 2835 rawHidKeys.resize(hidKeys.size()); 2836 rawHidValues.resize(hidValues.size()); 2837 for (size_t i = 0; i < hidKeys.size(); ++i) { 2838 rawHidKeys[i] = hidKeys[i].get(); 2839 rawHidValues[i] = hidValues[i].get(); 2840 } 2841 2842 configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("Hid"))); 2843 configurationValues.append(adoptWK(WKDictionaryCreate(rawHidKeys.data(), rawHidValues.data(), rawHidKeys.size()))); 2844 } 2845 2846 JSRetainPtr<JSStringRef> nfcPropertyName(Adopt, JSStringCreateWithUTF8CString("nfc")); 2847 JSValueRef nfcValue = JSObjectGetProperty(context, configuration, nfcPropertyName.get(), 0); 2848 if (!JSValueIsUndefined(context, nfcValue) && !JSValueIsNull(context, nfcValue)) { 2849 if (!JSValueIsObject(context, nfcValue)) 2850 return; 2851 JSObjectRef nfc = JSValueToObject(context, nfcValue, 0); 2852 2853 JSRetainPtr<JSStringRef> errorPropertyName(Adopt, JSStringCreateWithUTF8CString("error")); 2854 JSValueRef errorValue = JSObjectGetProperty(context, nfc, errorPropertyName.get(), 0); 2855 if (!JSValueIsString(context, errorValue)) 2856 return; 2857 2858 Vector<WKRetainPtr<WKStringRef>> nfcKeys; 2859 Vector<WKRetainPtr<WKTypeRef>> nfcValues; 2860 nfcKeys.append(adoptWK(WKStringCreateWithUTF8CString("Error"))); 2861 nfcValues.append(toWK(adopt(JSValueToStringCopy(context, errorValue, 0)).get())); 2862 2863 JSRetainPtr<JSStringRef> payloadBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("payloadBase64")); 2864 JSValueRef payloadBase64Value = JSObjectGetProperty(context, nfc, payloadBase64PropertyName.get(), 0); 2865 if (!JSValueIsUndefined(context, payloadBase64Value) && !JSValueIsNull(context, payloadBase64Value)) { 2866 if (!JSValueIsArray(context, payloadBase64Value)) 2867 return; 2868 2869 JSObjectRef payloadBase64 = JSValueToObject(context, payloadBase64Value, nullptr); 2870 static auto lengthProperty = adopt(JSStringCreateWithUTF8CString("length")); 2871 JSValueRef payloadBase64LengthValue = JSObjectGetProperty(context, payloadBase64, lengthProperty.get(), nullptr); 2872 if (!JSValueIsNumber(context, payloadBase64LengthValue)) 2873 return; 2874 2875 auto payloadBase64s = adoptWK(WKMutableArrayCreate()); 2876 auto payloadBase64Length = static_cast<size_t>(JSValueToNumber(context, payloadBase64LengthValue, nullptr)); 2877 for (size_t i = 0; i < payloadBase64Length; ++i) { 2878 JSValueRef payloadBase64Value = JSObjectGetPropertyAtIndex(context, payloadBase64, i, nullptr); 2879 if (!JSValueIsString(context, payloadBase64Value)) 2880 continue; 2881 WKArrayAppendItem(payloadBase64s.get(), toWK(adopt(JSValueToStringCopy(context, payloadBase64Value, 0)).get()).get()); 2882 } 2883 2884 nfcKeys.append(adoptWK(WKStringCreateWithUTF8CString("PayloadBase64"))); 2885 nfcValues.append(payloadBase64s); 2886 } 2887 2888 JSRetainPtr<JSStringRef> multipleTagsPropertyName(Adopt, JSStringCreateWithUTF8CString("multipleTags")); 2889 JSValueRef multipleTagsValue = JSObjectGetProperty(context, nfc, multipleTagsPropertyName.get(), 0); 2890 if (!JSValueIsUndefined(context, multipleTagsValue) && !JSValueIsNull(context, multipleTagsValue)) { 2891 if (!JSValueIsBoolean(context, multipleTagsValue)) 2892 return; 2893 bool multipleTags = JSValueToBoolean(context, multipleTagsValue); 2894 nfcKeys.append(adoptWK(WKStringCreateWithUTF8CString("MultipleTags"))); 2895 nfcValues.append(adoptWK(WKBooleanCreate(multipleTags)).get()); 2896 } 2897 2898 Vector<WKStringRef> rawNfcKeys; 2899 Vector<WKTypeRef> rawNfcValues; 2900 rawNfcKeys.resize(nfcKeys.size()); 2901 rawNfcValues.resize(nfcValues.size()); 2902 for (size_t i = 0; i < nfcKeys.size(); ++i) { 2903 rawNfcKeys[i] = nfcKeys[i].get(); 2904 rawNfcValues[i] = nfcValues[i].get(); 2905 } 2906 2907 configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("Nfc"))); 2908 configurationValues.append(adoptWK(WKDictionaryCreate(rawNfcKeys.data(), rawNfcValues.data(), rawNfcKeys.size()))); 2909 } 2910 2911 Vector<WKStringRef> rawConfigurationKeys; 2912 Vector<WKTypeRef> rawConfigurationValues; 2913 rawConfigurationKeys.resize(configurationKeys.size()); 2914 rawConfigurationValues.resize(configurationValues.size()); 2915 for (size_t i = 0; i < configurationKeys.size(); ++i) { 2916 rawConfigurationKeys[i] = configurationKeys[i].get(); 2917 rawConfigurationValues[i] = configurationValues[i].get(); 2918 } 2919 2920 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetWebAuthenticationMockConfiguration")); 2921 WKRetainPtr<WKDictionaryRef> messageBody = adoptWK(WKDictionaryCreate(rawConfigurationKeys.data(), rawConfigurationValues.data(), rawConfigurationKeys.size())); 2922 2923 WKBundlePostSynchronousMessage(injectedBundle.bundle(), messageName.get(), messageBody.get(), nullptr); 2924 } 2925 2631 // WebAuthn 2926 2632 void TestRunner::addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64) 2927 2633 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r250904 r250940 491 491 492 492 void setServiceWorkerFetchTimeout(double seconds); 493 494 // WebAuthN 495 void setWebAuthenticationMockConfiguration(JSValueRef); 493 496 494 // FIXME(189876) 497 495 void addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r250852 r250940 3622 3622 } 3623 3623 3624 void TestController::setWebAuthenticationMockConfiguration(WKDictionaryRef configuration)3625 {3626 WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(TestController::websiteDataStore(), configuration);3627 }3628 3629 3624 struct AdClickAttributionStringResultCallbackContext { 3630 3625 explicit AdClickAttributionStringResultCallbackContext(TestController& controller) -
trunk/Tools/WebKitTestRunner/TestController.h
r250852 r250940 297 297 void setServiceWorkerFetchTimeoutForTesting(double seconds); 298 298 299 void setWebAuthenticationMockConfiguration(WKDictionaryRef);300 299 void addTestKeyToKeychain(const String& privateKeyBase64, const String& attrLabel, const String& applicationTagBase64); 301 300 void cleanUpKeychain(const String& attrLabel, const String& applicationTagBase64); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r250852 r250940 1631 1631 } 1632 1632 1633 if (WKStringIsEqualToUTF8CString(messageName, "SetWebAuthenticationMockConfiguration")) {1634 ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());1635 TestController::singleton().setWebAuthenticationMockConfiguration(static_cast<WKDictionaryRef>(messageBody));1636 return nullptr;1637 }1638 1639 1633 if (WKStringIsEqualToUTF8CString(messageName, "AddTestKeyToKeychain")) { 1640 1634 ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
Note: See TracChangeset
for help on using the changeset viewer.