Skip to content

Commit

Permalink
Raise for the race-network-and-fetch-handler source without handler
Browse files Browse the repository at this point in the history
This reflects the change in w3c/ServiceWorker#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 <[email protected]>
Commit-Queue: Yoshisato Yanagisawa <[email protected]>
Reviewed-by: Shunya Shishido <[email protected]>
Reviewed-by: Hidehiko Abe <[email protected]>
Reviewed-by: Keita Suzuki <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1412763}
  • Loading branch information
yoshisatoyanagisawa authored and chromium-wpt-export-bot committed Jan 29, 2025
1 parent 318f66d commit 2e80094
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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')

</script>
</body>

0 comments on commit 2e80094

Please sign in to comment.