Automatic update from web-platform-tests [FedCM] Address FedCM spec change for IdentityCredentialError interface The error.code property, previously used to convey error information, has been renamed to error.error. This change is intended to prevent confusion and potential overriding with the DOMException's built-in code property. The data type remains a DOMString. Bug: 427474985 Change-Id: I85ca0fca0f9e9c31b76a309aa65ebc261e782365 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6904666 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: suresh potti <sureshpotti@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Cr-Commit-Position: refs/heads/main@{#1521689} -- wpt-commits: 9d52518d8ff815f9764fef4fbb18dff3fdee9d69 wpt-pr: 55099
76 lines
2.8 KiB
HTML
76 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<title>FedCM IdentityCredentialError.error attribute</title>
|
|
<meta name="timeout" content="long">
|
|
<link rel="help" href="https://fedidcg.github.io/FedCM">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
|
|
<script type="module">
|
|
import {request_options_with_mediation_required,
|
|
fedcm_test,
|
|
select_manifest,
|
|
fedcm_get_and_select_first_account,
|
|
fedcm_error_dialog_click_button,
|
|
fedcm_error_dialog_dismiss} from '../support/fedcm-helper.sub.js';
|
|
|
|
test(() => {
|
|
const errorInit = {
|
|
error: "invalid_request",
|
|
url: "https://example.com/error"
|
|
};
|
|
|
|
const error = new IdentityCredentialError("Test error", errorInit);
|
|
|
|
assert_equals(error.error, "invalid_request", "error attribute should work");
|
|
assert_equals(error.url, "https://example.com/error", "url should work");
|
|
}, 'IdentityCredentialError.error attribute works');
|
|
|
|
test(() => {
|
|
const errorInit = {
|
|
code: "unauthorized_client",
|
|
url: "https://example.com/error"
|
|
};
|
|
|
|
const error = new IdentityCredentialError("Test error", errorInit);
|
|
|
|
// error attribute should be empty because code was ignored
|
|
assert_equals(error.error, "", "error should be empty when only code is provided and flag is enabled");
|
|
assert_equals(error.url, "https://example.com/error", "url should work");
|
|
}, 'Constructor ignores code field');
|
|
|
|
// Error attribute in FedCM flow - dialog dismiss
|
|
fedcm_test(async t => {
|
|
let test_options =
|
|
request_options_with_mediation_required("manifest_id_assertion_endpoint_returns_error_format.json");
|
|
await select_manifest(t, test_options);
|
|
|
|
try {
|
|
const cred = fedcm_get_and_select_first_account(t, test_options);
|
|
fedcm_error_dialog_dismiss(t);
|
|
await cred;
|
|
assert_unreached("IdentityCredentialError should be thrown");
|
|
} catch (e) {
|
|
assert_equals(e.name, "IdentityCredentialError");
|
|
assert_equals(e.error, "unauthorized_client", "error attribute works in FedCM flow");
|
|
}
|
|
}, 'error attribute works in dialog dismiss workflow');
|
|
|
|
// Error attribute in FedCM flow - button click
|
|
fedcm_test(async t => {
|
|
let test_options = request_options_with_mediation_required("manifest_id_assertion_endpoint_returns_error_format.json");
|
|
await select_manifest(t, test_options);
|
|
|
|
try {
|
|
const cred = fedcm_get_and_select_first_account(t, test_options);
|
|
fedcm_error_dialog_click_button(t, "ErrorGotIt");
|
|
await cred;
|
|
assert_unreached("IdentityCredentialError should be thrown");
|
|
} catch (e) {
|
|
assert_equals(e.name, "IdentityCredentialError");
|
|
assert_equals(e.error, "unauthorized_client", "error attribute works when button clicked");
|
|
}
|
|
}, 'error attribute works in button click flow');
|
|
|
|
</script> |