Ready for Trial: URLPattern

92 views
Skip to first unread message

Ben Kelly

unread,
Jul 22, 2021, 1:17:44 PM7/22/21
to blink-dev

Contact emails

wande...@chromium.org

Explainer

https://github.com/WICG/urlpattern/blob/master/explainer.md

Specification

(Actively being written, but yet complete:)

Other Documentation
https://web.dev/urlpattern/
https://github.com/WICG/urlpattern/blob/main/mdn-drafts/QUICK-REFERENCE.md

Summary

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.


Blink component

Blink>URLPattern

TAG review

https://github.com/w3ctag/design-reviews/issues/417

TAG review status

Issues addressed

Risks



Interoperability and Compatibility

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



Gecko: No signal

WebKit: No signal

Web developers: No signals

Ergonomics

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.



Activation

The URLPattern API is easily feature detected and a polyfill is available at: https://www.npmjs.com/package/urlpattern-polyfill



Security

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.


Debuggability

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.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

DevTrial instructions

https://github.com/WICG/urlpattern/blob/main/howto.md

Flag name

about://flags/#enable-experimental-web-platform-features

Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1141510

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5731920199548928

Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/d/msg/blink-dev/jBMvUEkyBq8/IwYIZmhEBQAJ


This intent message was generated by Chrome Platform Status.

Thomas Steiner

unread,
Jul 22, 2021, 1:43:03 PM7/22/21
to Ben Kelly, blink-dev
I'd say applying the criteria defined in https://goo.gle/developer-signals it's safe to state developers are positive about this feature, based on the ReTweets, Likes, and linked blog posts on tweets matching the search query: https://twitter.com/search?q=url%3AURLPattern&src=typed_query&f=live. Specifically standing out: https://h3manth.com/new/blog/2021/urlpattern-api/ and https://twitter.com/wanderview/status/1339609333353615364. The article https://web.dev/urlpattern/ has just landed, but it's getting shared already.

Ben Kelly

unread,
Jul 22, 2021, 1:52:49 PM7/22/21
to Thomas Steiner, blink-dev
On Thu, Jul 22, 2021 at 1:42 PM Thomas Steiner <to...@google.com> wrote:
On Thu, Jul 22, 2021 at 7:17 PM Ben Kelly <wande...@chromium.org> wrote:
Gecko: No signal

WebKit: No signal

Web developers: No signals

I'd say applying the criteria defined in https://goo.gle/developer-signals it's safe to state developers are positive about this feature, based on the ReTweets, Likes, and linked blog posts on tweets matching the search query: https://twitter.com/search?q=url%3AURLPattern&src=typed_query&f=live. Specifically standing out: https://h3manth.com/new/blog/2021/urlpattern-api/ and https://twitter.com/wanderview/status/1339609333353615364. The article https://web.dev/urlpattern/ has just landed, but it's getting shared already.

The feedback does seem positive so far, but some of that was for earlier forms of the API.  To me "ready for trial" is really when we start asking web developers for their thoughts regarding the final proposed API.  Hopefully it remains positive, but I'd like to wait for more data to come in.  The signal will be filled out by the time we send the intent-to-ship.

As an aside, I have not asked other browser vendors for formal signals yet since the spec is not complete.  (They were involved in earlier spec discussions at TPAC, etc.)  I hope to get that done in the next week or so, but we'll see.

Anyway, I hope to have signals populated to some degree in about 3 weeks or so.

Thanks.

Ben

Ben Kelly

unread,
Aug 13, 2021, 3:52:11 PM8/13/21
to Thomas Steiner, blink-dev
A quick update on URLPattern:
  • The spec is now written.
  • We have gotten feedback from developers via social media, github, and a survey.  See the feedback summary for details.
  • I am going to request signals from other browser vendors now.
  • I intend to do some performance investigation next.
Assuming we don't get any drastically different feedback I hope to send an intent to ship in the next couple weeks.
Reply all
Reply to author
Forward
0 new messages