Skip to content

Commit 8df3a22

Browse files
committed
Bug 1866956 [wpt PR 43272] - Add baseURL to the URLPattern condition 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
1 parent 81d1d34 commit 8df3a22

File tree

3 files changed

+866
-12
lines changed

3 files changed

+866
-12
lines changed

testing/web-platform/tests/service-workers/service-worker/tentative/static-router/resources/router-rules.js

+78-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ routerRules
3838
'
3939
condition
4040
-
41-
url
41+
urlpattern
4242
-
43-
pattern
43+
constructed
4444
-
4545
source
4646
-
@@ -82,6 +82,82 @@ network
8282
'
8383
condition
8484
-
85+
urlpattern
86+
-
87+
urlpatterninit
88+
-
89+
source
90+
-
91+
network
92+
'
93+
:
94+
[
95+
{
96+
condition
97+
:
98+
{
99+
urlPattern
100+
:
101+
{
102+
pathname
103+
:
104+
'
105+
/
106+
*
107+
*
108+
/
109+
direct
110+
.
111+
txt
112+
'
113+
}
114+
}
115+
source
116+
:
117+
'
118+
network
119+
'
120+
}
121+
]
122+
'
123+
condition
124+
-
125+
urlpattern
126+
-
127+
string
128+
-
129+
source
130+
-
131+
network
132+
'
133+
:
134+
[
135+
{
136+
condition
137+
:
138+
{
139+
urlPattern
140+
:
141+
'
142+
/
143+
*
144+
*
145+
/
146+
direct
147+
.
148+
txt
149+
'
150+
}
151+
source
152+
:
153+
'
154+
network
155+
'
156+
}
157+
]
158+
'
159+
condition
160+
-
85161
request
86162
-
87163
source

testing/web-platform/tests/service-workers/service-worker/tentative/static-router/static-router-main-resource.https.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,15 @@
137137
'
138138
condition
139139
-
140-
url
140+
urlpattern
141141
-
142-
pattern
142+
constructed
143143
-
144144
source
145145
-
146146
network
147147
'
148+
;
148149
const
149150
SCOPE
150151
=

0 commit comments

Comments
 (0)