← Back to release summary

The ServiceWorker static routing API not condition support

Category
Service Worker
Type
Chromium catches up
Status
Enabled by default (Chrome 127)
Intent stage
None

Summary

The ServiceWorker static routing API is an API used for routing the request to the network, the ServiceWorker fetch handler, or directly looking up from cache, and so on. Each route consists of a condition and a source, and the condition is used for matching the request. For Chromium implementations, the "or" condition is only the supported condition. However, to write the condition more flexibly, supporting the "not" condition is expected, which matches the inverted condition inside.

Motivation

When writing a rule without the "not" condition, it gets unnecessary complexed. To proceed something, it should be written as the reversed rule, and the default route should also be set to represent the matching case. If there is multiple rules, writing a condition that won't matches other condition gets extremely difficult. If we introduce the "not" condition, the way to write such inverted rule gets much more easier.

Standards & signals

Docs: https://docs.google.com/document/d/1B2D8w_2M4j9CZC1VccBOAhfCdiRP3yPCSV5UKKDhU70/edit#heading=h.ns1mpsv4yi7x

View on chromestatus.com