[fetch-later] Implement aborting a FetchLater request #42104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
(FetchLater is a flag-guarded new API)
Aborting is implemented by propagating a custom mojo disconnection
reason from remote<URLLoader> (renderer) to receiver<URLLoader>
(browser).
Unlike previous approach 1, this CL does not introduce new IPC. So
there should be no IPC sequencing issue.
Before this CL
The
KeepAliveURLLoaderin browser starts all pending requests whenit learns the disconnection of its receiver<URLLoader>.
After this CL
By default, it will still start pending request on disconnection of
receiver<URLLoader>. However, if the disconnection comes with a custom
reason of pair (kClientDisconnectReason,
kFetchLaterDisconnectReasonExplicitlyAborted), the
pending request will be aborted instead.
Details
Every time JS abort() call happens for a FetchLater request,
the following extra flow is executed:
ResourceRequestSenderis able to learn that it is deleting anaborted FetchLater request by asking
FetchLaterLoaderHelper::IsExplicitlyAborted()it holds, which is anew interface implemented by the
ResourceLoaderthat creates itself.The helper is only provided to
ResourceRequestSender::SendAsync()when the request is a FetchLater request.
Bug: 1465781
Change-Id: I8762c37e1c64b3661d760cfb62f0ea8f02dddf1c
Reviewed-on: https://chromium-review.googlesource.com/4881364
WPT-Export-Revision: 7ba7812bcab27a8effa3369c603f38d818d98a21