Skip to content

Commit

Permalink
fix: Adjust missplaced comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchaofan committed Apr 24, 2024
1 parent d67bd9a commit 8853a60
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions shell/browser/net/electron_url_loader_factory.cc
Expand Up @@ -327,10 +327,6 @@ void ElectronURLLoaderFactory::StartLoading(
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory,
ProtocolType type,
gin::Arguments* args) {
// Send network error when there is no argument passed.
//
// Note that we should not throw JS error in the callback no matter what is
// passed, to keep compatibility with old code.
v8::Local<v8::Value> response;
if (!args->GetNext(&response) || response->IsNullOrUndefined() ||
(response->IsObject() &&
Expand All @@ -340,6 +336,7 @@ void ElectronURLLoaderFactory::StartLoading(
->Length() == 0)) {
std::string scheme = request.url.scheme();
if (scheme == "https" || scheme == "http" || scheme == "file") {
// re-send request
mojo::Remote<network::mojom::URLLoaderFactory> target_factory_remote(
std::move(target_factory));
// Pass-through to the original factory.
Expand All @@ -348,6 +345,10 @@ void ElectronURLLoaderFactory::StartLoading(
options | kBypassCustomProtocolHandlers, request, std::move(client),
traffic_annotation);
} else {
// Send network error when there is no argument passed.
//
// Note that we should not throw JS error in the callback no matter what
// is passed, to keep compatibility with old code.
OnComplete(std::move(client), request_id,
network::URLLoaderCompletionStatus(net::ERR_NOT_IMPLEMENTED));
}
Expand Down

0 comments on commit 8853a60

Please sign in to comment.