Closed pmeenan closed 9 months ago
@horo-t could you PTAL?
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
Does it make sense to have a URLPatternOptions option to disable regexp
processing? That would make it cleaner to specify in both use cases.
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?
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.
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