WICG / compression-dictionary-transport

Other
92 stars 8 forks source link

Switched the match param to use a URLPattern #51

Closed pmeenan closed 9 months ago

pmeenan commented 9 months ago

This changes the match param to be a patternString for a URLPattern and uses URLPattern for the pattern matching (including relative URL support).

Fixes #42, fixes #48

pmeenan commented 9 months ago

@horo-t could you PTAL?

horo-t commented 9 months ago

URLPattern API supports regular expressions. And I think regular expressions are too powerful to evaluate in the network service.

So we should mention that patternString must not include regexp token type.

ServiceWorker Static Routing API is also using urlPattern. But the Chrome's service worker team decided not to support regular expressions because they need to evaluate the urlPattern in the browser process.

FYI: @yoshisatoyanagisawa @sisidovski @wanderview

pmeenan commented 9 months ago

Does it make sense to have a URLPatternOptions option to disable regexp processing? That would make it cleaner to specify in both use cases.

horo-t commented 9 months ago

lgtm.

Introducing a new option in URLPatternOptions to disable regexp processing sounds good to me. Could you please file an issue in URLPattern GitHub repository?

jeremyroman commented 9 months ago

I'm not sure whether we'd want to make it an explicit option or not, because I wouldn't want authors to have to supply that option to any patterns they construct themselves, in order to be able to subsequently pass it through to (JS) APIs. But the bikeshed over whether it's an option, or a spec algorithm, or something else, should probably happen on WICG/urlpattern.