Bug 1887944 [wpt PR 45323] - [FedCM] Normalize origins, a=testonly

Automatic update from web-platform-tests
[FedCM] Normalize origins

In particular, on wpt.live, "origin" includes a default port of :443
but event.origin does not. Roundtrip both through new URL() so that
they get normalized the same way.

Bug: 331237776
Change-Id: I5a6857bda9d938232879e5da67cdd4fdace1417f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5394210
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1277940}

--

wpt-commits: c5dbf3e68662f2a9aa1a9c0c39cea6ea5e161cb2
wpt-pr: 45323
This commit is contained in:
Christian Biesinger 2024-03-27 23:09:05 +00:00 коммит произвёл moz-wptsync-bot
Родитель d2a7a5563d
Коммит c8b8aad906
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -8,7 +8,9 @@ export function open_and_wait_for_popup(origin, path) {
// We rely on the popup page to send us a message when done.
const popup_message_handler = (event) => {
if (event.origin == origin) {
// We use new URL() to ensure the two origins are normalized the same
// way (especially so that default ports are handled identically).
if (new URL(event.origin).toString() == new URL(origin).toString()) {
popup_window.close();
window.removeEventListener('message', popup_message_handler);
resolve();