Use in-renderer resource loading for initial WebUI navigation body [chromium/src : main]

0 views
Skip to first unread message

Rakina Zata Amni (Gerrit)

unread,
Dec 10, 2025, 10:31:04 PM (6 days ago) Dec 10
to Ming-Ying Chung, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Keren Zhu and Ming-Ying Chung

Rakina Zata Amni added 2 comments

Patchset-level comments
File-level comment, Patchset 16 (Latest):
Rakina Zata Amni . resolved

PTAL :)

File content/renderer/local_resource_url_loader_factory.cc
Line 300, Patchset 16 (Latest): // is only for direct callers for `GetResource()`.
Rakina Zata Amni . unresolved

This doesn't actually get hit in production since the body HTML should be in the ResourceBundle instead, but I'm adding this to make my test work. Somehow I couldn't find a way to override the `ResourceBundle` in the test in a browser test with a real renderer process (ContenClient overriding in the test only affects the browser process side).

Open in Gerrit

Related details

Attention is currently required from:
  • Keren Zhu
  • Ming-Ying Chung
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
Gerrit-Change-Number: 7226435
Gerrit-PatchSet: 16
Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Keren Zhu <kere...@chromium.org>
Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
Gerrit-Comment-Date: Thu, 11 Dec 2025 03:30:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Ming-Ying Chung (Gerrit)

unread,
Dec 11, 2025, 2:29:05 AM (6 days ago) Dec 11
to Rakina Zata Amni, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Keren Zhu and Rakina Zata Amni

Ming-Ying Chung added 3 comments

File content/common/web_ui_loading_util.cc
Line 85, Patchset 16 (Latest): CHECK(requested_range->ComputeBounds(output_size));
Ming-Ying Chung . unresolved

Is it intentional to crash when range header exist? It was `CallOnError()`.

Line 132, Patchset 16 (Latest): }
Ming-Ying Chung . unresolved

what happen when send_pipe_to_client is false? we don't handle OnReceiveResponse?

File content/renderer/render_frame_impl.cc
Line 2687, Patchset 16 (Latest): /*send_pipe_to_client=*/false, network::mojom::URLResponseHead::New(),
Ming-Ying Chung . unresolved

Do we need to populate any other headers in addition to content length?

Open in Gerrit

Related details

Attention is currently required from:
  • Keren Zhu
  • Rakina Zata Amni
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
Gerrit-Change-Number: 7226435
Gerrit-PatchSet: 16
Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Keren Zhu <kere...@chromium.org>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Comment-Date: Thu, 11 Dec 2025 07:28:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Rakina Zata Amni (Gerrit)

unread,
Dec 11, 2025, 9:21:05 AM (6 days ago) Dec 11
to Ming-Ying Chung, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Keren Zhu and Ming-Ying Chung

Rakina Zata Amni added 3 comments

File content/common/web_ui_loading_util.cc
Line 85, Patchset 16 (Latest): CHECK(requested_range->ComputeBounds(output_size));
Ming-Ying Chung . unresolved

Is it intentional to crash when range header exist? It was `CallOnError()`.

Rakina Zata Amni

Yeah I was assuming that since the error case from `SendData()` returns early won't hit this, but apparently this fails in some unit test.. I didn't get the time to investigate this today but will take a look soon.

Ming-Ying Chung . unresolved

what happen when send_pipe_to_client is false? we don't handle OnReceiveResponse?

Rakina Zata Amni

Yeah, this serves two purpose: We need the pipe to set the actual `response_body` in `RenderFrameImpl::CommitNavigation`, and [NavigationBodyLoader::OnReceiveResponse](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc;l=394;drc=8872eb3933fce45ec87506192ac1f14ec74b6307) (which is what the call would trigger) doesn't actually expect to be called, since normally `OnReceiveResponse()` is called on the browser process during navigation. I'll add a comment here soon to clarify.

File content/renderer/render_frame_impl.cc
Line 2687, Patchset 16 (Latest): /*send_pipe_to_client=*/false, network::mojom::URLResponseHead::New(),
Ming-Ying Chung . unresolved

Do we need to populate any other headers in addition to content length?

Rakina Zata Amni

Similar to the `OnReceiveResponse()` call, this isn't actually needed by the `NavigationBodyLoader`, it only needs the `OnComplete()` call that has the body length. There is a call to [ResourceLoadInfoNotifierWrapper()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc;l=444;drc=397107e399d4b0f4a6e801e7a888d7d71778529c) with the response head but I think that also doesn't need the content length. However I think it's a bit subtle and there might be future usage that needs the actual body length in the header.. So maybe this function needs to return the modified header as well. I'll update in the next patch.

Open in Gerrit

Related details

Attention is currently required from:
  • Keren Zhu
  • Ming-Ying Chung
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
Gerrit-Change-Number: 7226435
Gerrit-PatchSet: 16
Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Keren Zhu <kere...@chromium.org>
Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
Gerrit-Comment-Date: Thu, 11 Dec 2025 14:20:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ming-Ying Chung <my...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Keren Zhu (Gerrit)

unread,
Dec 11, 2025, 11:49:14 PM (5 days ago) Dec 11
to Rakina Zata Amni, Ming-Ying Chung, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Ming-Ying Chung and Rakina Zata Amni

Keren Zhu added 2 comments

File content/common/web_ui_loading_util.cc
Line 76, Patchset 16 (Latest): bool send_pipe_to_client,
Keren Zhu . unresolved

This parameter is probably too confusing. If there are 2 different ways of using the result pipe, let the caller handles it.

Can we refactor this to always return the pipe? i.e. make it `GetPipe()`.

Line 131, Patchset 16 (Latest): std::move(pipe_consumer_handle), std::nullopt);
Keren Zhu . unresolved

As the bot has caught it, this is probably a use-after-move? The moved `pipe_consumer_handle` is returned at the end of the function.

Open in Gerrit

Related details

Attention is currently required from:
  • Ming-Ying Chung
  • Rakina Zata Amni
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
Gerrit-Change-Number: 7226435
Gerrit-PatchSet: 16
Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
Gerrit-Comment-Date: Fri, 12 Dec 2025 04:49:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Rakina Zata Amni (Gerrit)

unread,
Dec 12, 2025, 12:58:16 AM (5 days ago) Dec 12
to Ming-Ying Chung, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Keren Zhu and Ming-Ying Chung

Rakina Zata Amni added 5 comments

File content/common/web_ui_loading_util.cc
Line 76, Patchset 16: bool send_pipe_to_client,
Keren Zhu . resolved

This parameter is probably too confusing. If there are 2 different ways of using the result pipe, let the caller handles it.

Can we refactor this to always return the pipe? i.e. make it `GetPipe()`.

Rakina Zata Amni

That's true, actually I had that at the start but wanted to remove some repetition. But looking at it now it doesn't seem worth the confusion, changing it back and removing some params makes it look so much nicer, thanks!

Line 85, Patchset 16: CHECK(requested_range->ComputeBounds(output_size));
Ming-Ying Chung . resolved

Is it intentional to crash when range header exist? It was `CallOnError()`.

Rakina Zata Amni

Yeah I was assuming that since the error case from `SendData()` returns early won't hit this, but apparently this fails in some unit test.. I didn't get the time to investigate this today but will take a look soon.

Rakina Zata Amni

Oh actually didn't realize that this function doesn't want to be called twice. I think we can just remove the CHECK.

Line 131, Patchset 16: std::move(pipe_consumer_handle), std::nullopt);
Keren Zhu . resolved

As the bot has caught it, this is probably a use-after-move? The moved `pipe_consumer_handle` is returned at the end of the function.

Rakina Zata Amni

This is I think OK since the case where the `pipe_consumer_handle` is used by the caller is mutually exclusive with when we send it using `OnReceiveResponse()`. But it is error-prone, so I've removed it together with the change above.

Line 132, Patchset 16: }
Ming-Ying Chung . resolved

what happen when send_pipe_to_client is false? we don't handle OnReceiveResponse?

Rakina Zata Amni

Yeah, this serves two purpose: We need the pipe to set the actual `response_body` in `RenderFrameImpl::CommitNavigation`, and [NavigationBodyLoader::OnReceiveResponse](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc;l=394;drc=8872eb3933fce45ec87506192ac1f14ec74b6307) (which is what the call would trigger) doesn't actually expect to be called, since normally `OnReceiveResponse()` is called on the browser process during navigation. I'll add a comment here soon to clarify.

Rakina Zata Amni

This confusing part is now removed :)

File content/renderer/render_frame_impl.cc
Line 2687, Patchset 16: /*send_pipe_to_client=*/false, network::mojom::URLResponseHead::New(),
Ming-Ying Chung . unresolved

Do we need to populate any other headers in addition to content length?

Rakina Zata Amni

Similar to the `OnReceiveResponse()` call, this isn't actually needed by the `NavigationBodyLoader`, it only needs the `OnComplete()` call that has the body length. There is a call to [ResourceLoadInfoNotifierWrapper()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc;l=444;drc=397107e399d4b0f4a6e801e7a888d7d71778529c) with the response head but I think that also doesn't need the content length. However I think it's a bit subtle and there might be future usage that needs the actual body length in the header.. So maybe this function needs to return the modified header as well. I'll update in the next patch.

Rakina Zata Amni

Ah I think I get what your question is now, there are headers that need to be set for WebUI navigations. That is actually added in the next CL: https://chromium-review.googlesource.com/c/chromium/src/+/7236606/8/content/browser/webui/initial_webui_navigation_url_loader.cc#69

(Also the header handling here has been simplified and we do update the content length in the header now!)

Open in Gerrit

Related details

Attention is currently required from:
  • Keren Zhu
  • Ming-Ying Chung
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
Gerrit-Change-Number: 7226435
Gerrit-PatchSet: 17
Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Keren Zhu <kere...@chromium.org>
Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
Gerrit-Comment-Date: Fri, 12 Dec 2025 05:57:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Keren Zhu <kere...@chromium.org>
Comment-In-Reply-To: Rakina Zata Amni <rak...@chromium.org>
Comment-In-Reply-To: Ming-Ying Chung <my...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Keren Zhu (Gerrit)

unread,
Dec 13, 2025, 12:31:32 AM (4 days ago) Dec 13
to Rakina Zata Amni, Ming-Ying Chung, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
Attention needed from Ming-Ying Chung and Rakina Zata Amni

Keren Zhu voted and added 3 comments

Votes added by Keren Zhu

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 20 (Latest):
Keren Zhu . resolved

lgtm, thanks!

File content/common/web_ui_loading_util.h
Line 47, Patchset 20 (Latest):// Send the given bytes to the client, or returns it, depending on whether
// `send_pipe_to_client` is true (calls OnReceiveResponse with the pipe
Keren Zhu . unresolved

This comment needs update.

File content/common/web_ui_loading_util.cc
Line 70, Patchset 20 (Latest): auto pipe_and_size = GetPipe(bytes, requested_range);
Keren Zhu . unresolved
optional: decompose the pair into 2 variables
```suggestion
auto [pipe, size] = GetPipe(bytes, requested_range);
```
Open in Gerrit

Related details

Attention is currently required from:
  • Ming-Ying Chung
  • Rakina Zata Amni
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
    Gerrit-Change-Number: 7226435
    Gerrit-PatchSet: 20
    Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
    Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
    Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
    Gerrit-Comment-Date: Sat, 13 Dec 2025 05:31:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ming-Ying Chung (Gerrit)

    unread,
    Dec 14, 2025, 11:44:25 PM (2 days ago) Dec 14
    to Rakina Zata Amni, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org
    Attention needed from Rakina Zata Amni

    Ming-Ying Chung voted and added 3 comments

    Votes added by Ming-Ying Chung

    Code-Review+1

    3 comments

    File content/renderer/render_frame_impl.cc
    Line 2665, Patchset 20 (Latest): // Initial WebUI navigations loads the response body locally within the
    // renderer instead of reading from the pipe from the browser. Set up the
    // pipes here.
    mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote;
    mojo::PendingRemote<network::mojom::URLLoader> loader_remote;
    std::ignore = loader_remote.InitWithNewPipeAndPassReceiver();
    Ming-Ying Chung . unresolved

    I think it's worth making these more clear that why loader_remote is dropped (does it work without receiver?) but client_remote is still needed.

    Line 2687, Patchset 16: /*send_pipe_to_client=*/false, network::mojom::URLResponseHead::New(),
    Ming-Ying Chung . resolved

    Do we need to populate any other headers in addition to content length?

    Rakina Zata Amni

    Similar to the `OnReceiveResponse()` call, this isn't actually needed by the `NavigationBodyLoader`, it only needs the `OnComplete()` call that has the body length. There is a call to [ResourceLoadInfoNotifierWrapper()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc;l=444;drc=397107e399d4b0f4a6e801e7a888d7d71778529c) with the response head but I think that also doesn't need the content length. However I think it's a bit subtle and there might be future usage that needs the actual body length in the header.. So maybe this function needs to return the modified header as well. I'll update in the next patch.

    Rakina Zata Amni

    Ah I think I get what your question is now, there are headers that need to be set for WebUI navigations. That is actually added in the next CL: https://chromium-review.googlesource.com/c/chromium/src/+/7236606/8/content/browser/webui/initial_webui_navigation_url_loader.cc#69

    (Also the header handling here has been simplified and we do update the content length in the header now!)

    Ming-Ying Chung

    Yes that's what mean. Thanks.

    Line 2665, Patchset 20 (Latest): // Initial WebUI navigations loads the response body locally within the
    // renderer instead of reading from the pipe from the browser. Set up the
    // pipes here.
    mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote;
    mojo::PendingRemote<network::mojom::URLLoader> loader_remote;
    std::ignore = loader_remote.InitWithNewPipeAndPassReceiver();
    url_loader_client_endpoints = network::mojom::URLLoaderClientEndpoints::New(
    std::move(loader_remote),
    client_remote.InitWithNewPipeAndPassReceiver());

    // Read the response body locally within the renderer, and make the
    // `response_body` pipe point to the result.
    CHECK(subresource_loader_factories);
    CHECK(subresource_loader_factories->local_resource_loader_config());
    CHECK(subresource_loader_factories->local_resource_loader_config()
    ->sources.contains(commit_params->origin_to_commit));
    const blink::mojom::LocalResourceSourcePtr& source =
    subresource_loader_factories->local_resource_loader_config()
    ->sources[commit_params->origin_to_commit];
    const std::map<std::string, std::string> replacement_strings(
    source->replacement_strings.begin(), source->replacement_strings.end());
    size_t output_size;
    std::tie(response_body, output_size) = webui::GetPipe(
    LocalResourceURLLoaderFactory::GetResource(
    common_params->url, source, replacement_strings, "text/html"),
    /*requested_range=*/std::nullopt);

    // Update the content length, and send the completion signal with the
    // correct length. Note that we don't need to call `OnReceiveResponse()`
    // here, since `NavigationBodyLoader` doesn't need it, and just reads from
    // the `response_body` pipe directly.
    response_head->content_length = output_size;
    mojo::Remote<network::mojom::URLLoaderClient> client(
    std::move(client_remote));
    network::URLLoaderCompletionStatus status(net::OK);
    status.encoded_data_length = output_size;
    status.encoded_body_length = output_size;
    status.decoded_body_length = output_size;
    client->OnComplete(status);
    Ming-Ying Chung . resolved

    optional but maybe we cn extract this out into a helper.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Rakina Zata Amni
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
    Gerrit-Change-Number: 7226435
    Gerrit-PatchSet: 20
    Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
    Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
    Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
    Gerrit-Comment-Date: Mon, 15 Dec 2025 04:43:50 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rakina Zata Amni (Gerrit)

    unread,
    Dec 15, 2025, 2:45:23 AM (2 days ago) Dec 15
    to Ming-Ying Chung, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org

    Rakina Zata Amni added 5 comments

    File content/common/web_ui_loading_util.h
    Line 47, Patchset 20:// Send the given bytes to the client, or returns it, depending on whether

    // `send_pipe_to_client` is true (calls OnReceiveResponse with the pipe
    Keren Zhu . resolved

    This comment needs update.

    Rakina Zata Amni

    Done

    File content/common/web_ui_loading_util.cc
    Line 70, Patchset 20: auto pipe_and_size = GetPipe(bytes, requested_range);
    Keren Zhu . resolved
    optional: decompose the pair into 2 variables
    ```suggestion
    auto [pipe, size] = GetPipe(bytes, requested_range);
    ```
    Rakina Zata Amni

    Done

    File content/renderer/local_resource_url_loader_factory.cc
    Line 300, Patchset 16: // is only for direct callers for `GetResource()`.
    Rakina Zata Amni . resolved

    This doesn't actually get hit in production since the body HTML should be in the ResourceBundle instead, but I'm adding this to make my test work. Somehow I couldn't find a way to override the `ResourceBundle` in the test in a browser test with a real renderer process (ContenClient overriding in the test only affects the browser process side).

    Rakina Zata Amni

    Done

    File content/renderer/render_frame_impl.cc
    Line 2665, Patchset 20: // Initial WebUI navigations loads the response body locally within the

    // renderer instead of reading from the pipe from the browser. Set up the
    // pipes here.
    mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote;
    mojo::PendingRemote<network::mojom::URLLoader> loader_remote;
    std::ignore = loader_remote.InitWithNewPipeAndPassReceiver();
    Ming-Ying Chung . resolved

    I think it's worth making these more clear that why loader_remote is dropped (does it work without receiver?) but client_remote is still needed.

    Rakina Zata Amni

    Added comment, and it's actually possible to just use a `NullRemote` so I switched to that

    Line 2665, Patchset 20: // Initial WebUI navigations loads the response body locally within the
    Rakina Zata Amni

    Yeah that's a good idea, done

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
      Gerrit-Change-Number: 7226435
      Gerrit-PatchSet: 21
      Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
      Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
      Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Comment-Date: Mon, 15 Dec 2025 07:44:49 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Keren Zhu <kere...@chromium.org>
      satisfied_requirement
      open
      diffy

      Rakina Zata Amni (Gerrit)

      unread,
      Dec 15, 2025, 3:05:17 AM (2 days ago) Dec 15
      to Ming-Ying Chung, Keren Zhu, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org

      Rakina Zata Amni voted and added 1 comment

      Votes added by Rakina Zata Amni

      Commit-Queue+2

      1 comment

      Patchset-level comments
      Rakina Zata Amni . resolved

      Thanks for the reviews!

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
      Gerrit-Change-Number: 7226435
      Gerrit-PatchSet: 21
      Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
      Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
      Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Comment-Date: Mon, 15 Dec 2025 08:04:42 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Dec 15, 2025, 3:08:01 AM (2 days ago) Dec 15
      to Rakina Zata Amni, Ming-Ying Chung, Keren Zhu, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, blink-...@chromium.org, creis...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, navigation...@chromium.org

      Chromium LUCI CQ submitted the change with unreviewed changes

      Unreviewed changes

      20 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: content/renderer/render_frame_impl.cc
      Insertions: 46, Deletions: 37.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: content/common/web_ui_loading_util.h
      Insertions: 2, Deletions: 4.

      The diff is too large to show. Please review the diff.
      ```
      ```
      The name of the file: content/common/web_ui_loading_util.cc
      Insertions: 6, Deletions: 7.

      The diff is too large to show. Please review the diff.
      ```

      Change information

      Commit message:
      Use in-renderer resource loading for initial WebUI navigation body

      The HTML body for initial WebUIs already exist in the ResourceBundle
      accessible from within the renderer process. This means when
      navigating to initial WebUIs, we can skip the async step on the
      browser-side WebUIURLLoader to load the body, and do that from
      within the renderer when committing the navigation instead. This
      helps remove an asynchronous step on the browser side that prevents
      the initial WebUI navigation to go from start -> commit
      synchronously.
      Bug: 457618572
      Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
      Reviewed-by: Keren Zhu <kere...@chromium.org>
      Reviewed-by: Ming-Ying Chung <my...@chromium.org>
      Commit-Queue: Rakina Zata Amni <rak...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1558587}
      Files:
      • M content/common/web_ui_loading_util.cc
      • M content/common/web_ui_loading_util.h
      • M content/renderer/local_resource_url_loader_factory.cc
      • M content/renderer/local_resource_url_loader_factory.h
      • M content/renderer/render_frame_impl.cc
      Change size: M
      Delta: 5 files changed, 160 insertions(+), 65 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Keren Zhu, +1 by Ming-Ying Chung
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I9ae25d2b25b27e0b48e42a15e2f3e07da5cd8bc9
      Gerrit-Change-Number: 7226435
      Gerrit-PatchSet: 22
      Gerrit-Owner: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Keren Zhu <kere...@chromium.org>
      Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
      Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages