tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit b561dfb29e9a61bde1fdcce1cf4e60effb289f07
parent 30f65e42e09d26135fab47c2d1d719eed3180f23
Author: Suresh Potti <sureshpotti@microsoft.com>
Date:   Thu,  9 Oct 2025 16:29:09 +0000

Bug 1991138 [wpt PR 55099] - [FedCM] Address FedCM spec change for IdentityCredentialError interface, a=testonly

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

Diffstat:
Atesting/web-platform/tests/fedcm/fedcm-error-attribute/fedcm-error-attribute.https.html | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atesting/web-platform/tests/fedcm/support/error_with_error_and_url_format.py | 12++++++++++++
Atesting/web-platform/tests/fedcm/support/manifest_id_assertion_endpoint_returns_error_format.json | 6++++++
3 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/fedcm/fedcm-error-attribute/fedcm-error-attribute.https.html b/testing/web-platform/tests/fedcm/fedcm-error-attribute/fedcm-error-attribute.https.html @@ -0,0 +1,76 @@ +<!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> +\ No newline at end of file diff --git a/testing/web-platform/tests/fedcm/support/error_with_error_and_url_format.py b/testing/web-platform/tests/fedcm/support/error_with_error_and_url_format.py @@ -0,0 +1,12 @@ +import importlib +error_checker = importlib.import_module("fedcm.support.request-params-check") + +def main(request, response): + request_error = error_checker.tokenCheck(request) + if (request_error): + return request_error + + response.headers.set(b"Content-Type", b"application/json") + response.status = (401, b"Unauthorized") + + return "{\"error\": {\"error\": \"unauthorized_client\", \"url\": \"error.html\"}}" diff --git a/testing/web-platform/tests/fedcm/support/manifest_id_assertion_endpoint_returns_error_format.json b/testing/web-platform/tests/fedcm/support/manifest_id_assertion_endpoint_returns_error_format.json @@ -0,0 +1,6 @@ +{ + "accounts_endpoint": "accounts.py", + "client_metadata_endpoint": "client_metadata.py", + "id_assertion_endpoint": "error_with_error_and_url_format.py", + "login_url": "login.html" +}