From de0e106017933720d90124f26aaa53dbf3209bc5 Mon Sep 17 00:00:00 2001 From: Yoshisato Yanagisawa Date: Wed, 29 Jan 2025 17:41:51 +0000 Subject: [PATCH] Bug 1944496 [wpt PR 50363] - Raise for the race-network-and-fetch-handler source without handler, a=testonly Automatic update from web-platform-tests Raise for the race-network-and-fetch-handler source without handler This reflects the change in https://github.com/w3c/ServiceWorker/pull/1719. Instead of silently fallback to network, let me make `addRoutes()` raise if the race-network-and-fetch-handler source is used without having a fetch handler. Fixed: 391990601 Change-Id: Ic944e183286cd056235b0fe272c543533dfaa86f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6211317 Reviewed-by: Takashi Toyoshima Commit-Queue: Yoshisato Yanagisawa Reviewed-by: Shunya Shishido Reviewed-by: Hidehiko Abe Reviewed-by: Keita Suzuki Cr-Commit-Position: refs/heads/main@{#1412763} -- wpt-commits: dcdc147a9ad20ccdef156d4444fbf526a2380235 wpt-pr: 50363 --- .../static-router-no-fetch-handler.https.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testing/web-platform/tests/service-workers/service-worker/static-router-no-fetch-handler.https.html b/testing/web-platform/tests/service-workers/service-worker/static-router-no-fetch-handler.https.html index e98dd08a90ad6..4dbbbe69c7dfe 100644 --- a/testing/web-platform/tests/service-workers/service-worker/static-router-no-fetch-handler.https.html +++ b/testing/web-platform/tests/service-workers/service-worker/static-router-no-fetch-handler.https.html @@ -15,6 +15,8 @@ const RULE_KEY_SOURCE_CACHE = 'condition-urlpattern-string-source-cache'; const RULE_KEY_SOURCE_FETCH_EVENT = 'condition-request-source-fetch-event'; +const RULE_KEY_SOURCE_RACE_NETWORK_AND_FETCH_HANDLER = + 'condition-urlpattern-string-source-race-network-and-fetch-handler'; const SW_SRC = 'resources/static-router-no-fetch-handler-sw.js'; const CACHED_FILE = 'cache.txt'; @@ -44,5 +46,15 @@ assert_equals(errors.length, 1); }, 'addRoutes should raise if the fetch-event source is used without onfetch') +promise_test(async t => { + const worker = + await registerAndActivate(t, + RULE_KEY_SOURCE_RACE_NETWORK_AND_FETCH_HANDLER, SW_SRC); + t.add_cleanup(() => {reset_info_in_worker(worker)}); + + const {errors} = await get_info_from_worker(worker); + assert_equals(errors.length, 1); +}, 'addRoutes should raise if the race-network-and-fetch-handler source is used without onfetch') +