Skip to content

Conversation

@chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Sep 21, 2023

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 KeepAliveURLLoader in browser starts all pending requests when
it 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:

FetchManager::Loader::Abort()
->ThreadableLoader::Abort()
->ResourceLoader::AbortFetchLaterRequest()
->ResourceLoader::Cancel()
->(Calls to blink::URLLoader/ResourceRequestSender in between...)
->ResourceRequestSender::DeletePendingRequest()
->ThrottlingURLLoader::CancelWithError(
    ..., kFetchLaterDisconnectReasonExplicitlyAborted)

ResourceRequestSender is able to learn that it is deleting an
aborted FetchLater request by asking
FetchLaterLoaderHelper::IsExplicitlyAborted() it holds, which is a
new interface implemented by the ResourceLoader that 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

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

## 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 `KeepAliveURLLoader` in browser starts all pending requests when
it 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:

```
FetchManager::Loader::Abort()
->ThreadableLoader::Abort()
->ResourceLoader::AbortFetchLaterRequest()
->ResourceLoader::Cancel()
->(Calls to blink::URLLoader/ResourceRequestSender in between...)
->ResourceRequestSender::DeletePendingRequest()
->ThrottlingURLLoader::CancelWithError(
    ..., kFetchLaterDisconnectReasonExplicitlyAborted)
```

`ResourceRequestSender` is able to learn that it is deleting an
aborted FetchLater request by asking
`FetchLaterLoaderHelper::IsExplicitlyAborted()` it holds, which is a
new interface implemented by the `ResourceLoader` that creates itself.
The helper is only provided to `ResourceRequestSender::SendAsync()`
when the request is a FetchLater request.

[1]: https://crrev.com/c/4803083/23..29/third_party/blink/renderer/core/fetch/fetch_manager.cc#b1096

Bug: 1465781
Change-Id: I8762c37e1c64b3661d760cfb62f0ea8f02dddf1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants