Skip to content

Commit eacce71

Browse files
committed
servo: Merge #17491 - Introduce service-worker mode (from KiChjang:update-fetch); r=jdm
Bringing in the spec changes from whatwg/fetch#435. Source-Repo: https://github.com/servo/servo Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252 UltraBlame original commit: 7ad2e4b94b03bb9e821f6962fc7df6fc0f936519
1 parent 28256a5 commit eacce71

File tree

6 files changed

+180
-77
lines changed

6 files changed

+180
-77
lines changed

servo/components/net/http_loader.rs

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ request
347347
:
348348
{
349349
ResponseTainting
350+
ServiceWorkersMode
350351
Type
351352
}
352353
;
@@ -3452,17 +3453,80 @@ Response
34523453
None
34533454
;
34543455
if
3456+
request
3457+
.
3458+
service_workers_mode
34553459
!
3460+
=
3461+
ServiceWorkersMode
3462+
:
3463+
:
3464+
None
3465+
{
3466+
if
34563467
request
34573468
.
3458-
skip_service_worker
3469+
service_workers_mode
3470+
=
3471+
=
3472+
ServiceWorkersMode
3473+
:
3474+
:
3475+
All
3476+
{
3477+
}
3478+
if
3479+
response
3480+
.
3481+
is_none
3482+
(
3483+
)
34593484
&
34603485
&
3461-
!
34623486
request
34633487
.
3464-
is_service_worker_global_scope
3488+
is_subresource_request
3489+
(
3490+
)
3491+
&
3492+
&
3493+
match
3494+
request
3495+
.
3496+
origin
3497+
{
3498+
Origin
3499+
:
3500+
:
3501+
Origin
3502+
(
3503+
ref
3504+
origin
3505+
)
3506+
if
3507+
*
3508+
origin
3509+
=
3510+
=
3511+
request
3512+
.
3513+
url
3514+
(
3515+
)
3516+
.
3517+
origin
3518+
(
3519+
)
3520+
=
3521+
>
3522+
true
3523+
_
3524+
=
3525+
>
3526+
false
3527+
}
34653528
{
3529+
}
34663530
if
34673531
let
34683532
Some
@@ -3753,12 +3817,27 @@ clone
37533817
}
37543818
}
37553819
}
3820+
if
37563821
request
37573822
.
3758-
skip_service_worker
3823+
redirect_mode
37593824
=
3760-
true
3825+
=
3826+
RedirectMode
3827+
:
3828+
:
3829+
Follow
3830+
{
3831+
request
3832+
.
3833+
service_workers_mode
3834+
=
3835+
ServiceWorkersMode
3836+
:
3837+
:
3838+
Foreign
37613839
;
3840+
}
37623841
let
37633842
mut
37643843
fetch_result
@@ -6637,9 +6716,6 @@ clone
66376716
)
66386717
request
66396718
.
6640-
is_service_worker_global_scope
6641-
request
6642-
.
66436719
pipeline_id
66446720
)
66456721
;

servo/components/net_traits/request.rs

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,26 @@ HeapSizeOf
246246
]
247247
pub
248248
enum
249+
ServiceWorkersMode
250+
{
251+
All
252+
Foreign
253+
None
254+
}
255+
#
256+
[
257+
derive
258+
(
259+
Copy
260+
Clone
261+
PartialEq
262+
Serialize
263+
Deserialize
264+
HeapSizeOf
265+
)
266+
]
267+
pub
268+
enum
249269
RedirectMode
250270
{
251271
Follow
@@ -418,6 +438,10 @@ u8
418438
>
419439
>
420440
pub
441+
service_workers_mode
442+
:
443+
ServiceWorkersMode
444+
pub
421445
type_
422446
:
423447
Type
@@ -542,6 +566,12 @@ false
542566
body
543567
:
544568
None
569+
service_workers_mode
570+
:
571+
ServiceWorkersMode
572+
:
573+
:
574+
All
545575
type_
546576
:
547577
Type
@@ -693,10 +723,6 @@ u8
693723
>
694724
>
695725
pub
696-
is_service_worker_global_scope
697-
:
698-
bool
699-
pub
700726
window
701727
:
702728
Window
@@ -705,9 +731,9 @@ keep_alive
705731
:
706732
bool
707733
pub
708-
skip_service_worker
734+
service_workers_mode
709735
:
710-
bool
736+
ServiceWorkersMode
711737
pub
712738
initiator
713739
:
@@ -806,9 +832,6 @@ Option
806832
<
807833
Origin
808834
>
809-
is_service_worker_global_scope
810-
:
811-
bool
812835
pipeline_id
813836
:
814837
Option
@@ -848,9 +871,6 @@ false
848871
body
849872
:
850873
None
851-
is_service_worker_global_scope
852-
:
853-
is_service_worker_global_scope
854874
window
855875
:
856876
Window
@@ -860,9 +880,12 @@ Client
860880
keep_alive
861881
:
862882
false
863-
skip_service_worker
883+
service_workers_mode
864884
:
865-
false
885+
ServiceWorkersMode
886+
:
887+
:
888+
All
866889
initiator
867890
:
868891
Initiator
@@ -1007,7 +1030,6 @@ origin
10071030
)
10081031
)
10091032
)
1010-
false
10111033
init
10121034
.
10131035
pipeline_id
@@ -1047,6 +1069,14 @@ body
10471069
;
10481070
req
10491071
.
1072+
service_workers_mode
1073+
=
1074+
init
1075+
.
1076+
service_workers_mode
1077+
;
1078+
req
1079+
.
10501080
type_
10511081
=
10521082
init

servo/components/script/dom/request.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,6 @@ GlobalScope
585585
url
586586
:
587587
ServoUrl
588-
is_service_worker_global_scope
589-
:
590-
bool
591588
)
592589
-
593590
>
@@ -614,7 +611,6 @@ net_request_from_global
614611
(
615612
global
616613
url
617-
is_service_worker_global_scope
618614
)
619615
)
620616
body_used
@@ -674,9 +670,6 @@ GlobalScope
674670
url
675671
:
676672
ServoUrl
677-
is_service_worker_global_scope
678-
:
679-
bool
680673
)
681674
-
682675
>
@@ -695,7 +688,6 @@ new_inherited
695688
(
696689
global
697690
url
698-
is_service_worker_global_scope
699691
)
700692
global
701693
RequestBinding
@@ -929,7 +921,6 @@ net_request_from_global
929921
(
930922
global
931923
url
932-
false
933924
)
934925
;
935926
/
@@ -1186,7 +1177,6 @@ temporary_request
11861177
current_url
11871178
(
11881179
)
1189-
false
11901180
)
11911181
;
11921182
request
@@ -2200,7 +2190,6 @@ Request
22002190
from_net_request
22012191
(
22022192
global
2203-
false
22042193
request
22052194
)
22062195
;
@@ -3199,9 +3188,6 @@ global
31993188
:
32003189
&
32013190
GlobalScope
3202-
is_service_worker_global_scope
3203-
:
3204-
bool
32053191
net_request
32063192
:
32073193
NetTraitsRequest
@@ -3227,7 +3213,6 @@ net_request
32273213
current_url
32283214
(
32293215
)
3230-
is_service_worker_global_scope
32313216
)
32323217
;
32333218
*
@@ -3282,13 +3267,6 @@ url
32823267
)
32833268
;
32843269
let
3285-
is_service_worker_global_scope
3286-
=
3287-
req
3288-
.
3289-
is_service_worker_global_scope
3290-
;
3291-
let
32923270
body_used
32933271
=
32943272
r
@@ -3342,7 +3320,6 @@ global
33423320
(
33433321
)
33443322
url
3345-
is_service_worker_global_scope
33463323
)
33473324
;
33483325
r_clone
@@ -3495,9 +3472,6 @@ GlobalScope
34953472
url
34963473
:
34973474
ServoUrl
3498-
is_service_worker_global_scope
3499-
:
3500-
bool
35013475
)
35023476
-
35033477
>
@@ -3541,7 +3515,6 @@ Some
35413515
(
35423516
origin
35433517
)
3544-
is_service_worker_global_scope
35453518
Some
35463519
(
35473520
pipeline_id

0 commit comments

Comments
 (0)