Skip to content

Commit

Permalink
Bug 1866956 [wpt PR 43272] - Add baseURL to the URLPattern condition …
Browse files Browse the repository at this point in the history
…while routing rule registration, a=testonly

Automatic update from web-platform-tests
Add baseURL to the URLPattern condition while routing rule registration

This behavior change was originally started in
whatwg/urlpattern#182, and follows the spec
change in whatwg/urlpattern#199.

This CL changes the behavior of the router rule registration in the
ServiceWorker Static Routing API, especially when the |urlPattern|
condition receives URLPatternInit or USVString.

Before this CL, the URLPatternInit input was accepted as it is, that
means any unspecified fields are resulted in the wildcards (*). This
behavior is inconsistent with the case when |urlPattern| accepts a
string. When a string is passed, missing fields are complemented by
baseURL, the SW script URL is internally treated as baseURL.

After this CL, the URLPatternInit input also internally uses the SW
script URL as a baseURL if it's not explicitly provided. This is
achieved by the helper method `URLPattern::From()`, which was added in
[1].

This change doesn't affect the case when the input is URLPattern, which
means the input is the object constructed via `new URLPattern()`.

[1] crrev.com/c/5053645

Bug: 1371756
Change-Id: I5cce80fde05cf18237c8b6412b00e017ff5aad5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5039680
Reviewed-by: Takashi Toyoshima <toyoshimchromium.org>
Reviewed-by: Kouhei Ueno <kouheichromium.org>
Commit-Queue: Shunya Shishido <sisidovskichromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawachromium.org>
Auto-Submit: Shunya Shishido <sisidovskichromium.org>
Cr-Commit-Position: refs/heads/main{#1229724}

--

wpt-commits: ffe06ef95d4d48be147e640fd9d1c489b810f929
wpt-pr: 43272

UltraBlame original commit: 8cba5e465039e56ad23ca65c4e4b1c307f2f8379
  • Loading branch information
marco-c committed Dec 7, 2023
1 parent 81d1d34 commit 8df3a22
Show file tree
Hide file tree
Showing 3 changed files with 866 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ routerRules
'
condition
-
url
urlpattern
-
pattern
constructed
-
source
-
Expand Down Expand Up @@ -82,6 +82,82 @@ network
'
condition
-
urlpattern
-
urlpatterninit
-
source
-
network
'
:
[
{
condition
:
{
urlPattern
:
{
pathname
:
'
/
*
*
/
direct
.
txt
'
}
}
source
:
'
network
'
}
]
'
condition
-
urlpattern
-
string
-
source
-
network
'
:
[
{
condition
:
{
urlPattern
:
'
/
*
*
/
direct
.
txt
'
}
source
:
'
network
'
}
]
'
condition
-
request
-
source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@
'
condition
-
url
urlpattern
-
pattern
constructed
-
source
-
network
'
;
const
SCOPE
=
Expand Down
Loading

0 comments on commit 8df3a22

Please sign in to comment.