Commit f81c4ab
Delay SW loader deletion until fetch clone is complete
When using `race-network-and-fetch-handler`, the
ServiceWorkerMainResourceLoader could be destroyed after the network
response is received, but before the fetch handler has finished cloning
the response body. This could lead to a race condition where the loader
is deleted prematurely.
This change ensures that the loader's lifetime is extended until the
response body has been fully cloned for the fetch handler or the mojo
disconnection to the ServiceWorker. A callback is introduced to signal
the completion of the cloning process or disconnection, and the deletion
logic is updated to wait for this signal before invalidating the loader.
This behavior is gated behind the
`kServiceWorkerStaticRouterRaceRequestFix2` feature flag.
Change-Id: If7ec62b18c99c8fc13faf657a44969a42bf7f82a
Bug: 340949948
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7079632
Reviewed-by: Rakina Zata Amni <[email protected]>
Reviewed-by: Yoshisato Yanagisawa <[email protected]>
Commit-Queue: Shunya Shishido <[email protected]>
Reviewed-by: Keita Suzuki <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1538932}1 parent d1ec182 commit f81c4ab
File tree
2 files changed
+46
-16
lines changed- service-workers/service-worker
- resources
2 files changed
+46
-16
lines changedLines changed: 19 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
| 37 | + | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
40 | 65 | | |
41 | 66 | | |
42 | 67 | | |
| |||
0 commit comments