URLPattern is a new web API that provides native support for matching URLs given a pattern string. It is designed to be usable both in javascript directly and by passing patterns to other web platform APIs; e.g. as a service worker scope.
This API has minimal interop and compat risk. It can easily be feature detected and a polyfill is available at: https://www.npmjs.com/package/urlpattern-polyfill
The URLPattern API will often be used with the URL API. To make this more natural we have tried to match URL behavior and API shape wherever possible. URLPattern is also similar in nature to RegExp and we have attempted to match its API shape as well; e.g. providing `test()` and `exec()` methods. In regard to the ergonomics of the pattern syntax itself, we have adopted the syntax from the popular javascript library path-to-regexp. Our hope is that using a popular syntax will result in the web API being more natural for developers to use.
The URLPattern API is easily feature detected and a polyfill is availabe at: https://www.npmjs.com/package/urlpattern-polyfill
The main security risks involve the addition of a new parser in the platform. Since parsers are common attack vectors it does represent a risk. We mitigate this risk by requiring that URLPattern strings must be parsed in the sandboxed renderer. In addition, we are actively fuzzing the parser.
Currently URLPattern does not have any special integration with devtools. The summary view of the URLPattern object is already useful for inspecting what patterns it will use to match. Exceptions are used to report errors in constructing a URLPattern. In the future it may be useful to provide some kind of syntax highlighting or checking of URLPattern syntax. This seems challenging, though, as the values are passed as plain javascript strings and are not a javascript type like regular expressions. This could be an area for future exploration, though.
DevTrial on desktop | 93 |
DevTrial on Webview | 93 |
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAK7rkMgCrO2VN09hUEvfwnMBLqRWzA1NVHk%3D-PBwPhtJ%2BVO3Ag%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAK7rkMgGQ1v8eCmUz3PnS%3DxWaWhb2ady35ReHuSV7UySkYgX9A%40mail.gmail.com.
Cheers,
Rego
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAK7rkMhx1m8Mog0QAD3x70VNYPBAHt-x8BNwXQnJ11iUABbUjw%40mail.gmail.com.
LGTM2. The devtrial comment summaries were particularly helpful, and show solid improvements to the API based on developer feedback. Thank you for putting that document together.-mikeOn Wed, Sep 1, 2021 at 4:38 PM Ben Kelly <wande...@chromium.org> wrote:On Wed, Sep 1, 2021 at 10:28 AM Manuel Rego Casasnovas <re...@igalia.com> wrote:
On 01/09/2021 15:09, Yoav Weiss wrote:
> Specification
>
> https://wicg.github.io/urlpattern/
> <https://wicg.github.io/urlpattern/>
Is there any plan to move the spec out of WICG to somewhere else?Yes, we would like to move it to the WHATWG URL workstream in the future. It needs a second implementor to do that, I believe. I think typically that has meant a second browser, so not sure if the rust implementation counts.This intent is mentioned in the spec under "status of this document".Thanks.Ben
Cheers,
Rego
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
LGTM3This has been a long journey; thanks so much for all the care you've put into this, Ben.
On Thursday, September 2, 2021 at 2:10:52 PM UTC+1 Mike West wrote:
LGTM2. The devtrial comment summaries were particularly helpful, and show solid improvements to the API based on developer feedback. Thank you for putting that document together.-mikeOn Wed, Sep 1, 2021 at 4:38 PM Ben Kelly <wande...@chromium.org> wrote:On Wed, Sep 1, 2021 at 10:28 AM Manuel Rego Casasnovas <re...@igalia.com> wrote:
On 01/09/2021 15:09, Yoav Weiss wrote:
> Specification
>
> https://wicg.github.io/urlpattern/
> <https://wicg.github.io/urlpattern/>
Is there any plan to move the spec out of WICG to somewhere else?Yes, we would like to move it to the WHATWG URL workstream in the future. It needs a second implementor to do that, I believe. I think typically that has meant a second browser, so not sure if the rust implementation counts.This intent is mentioned in the spec under "status of this document".Thanks.Ben
Cheers,
Rego
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.