2019-10-01 15:55:16 +02:00
|
|
|
diff --git content/browser/storage_partition_impl.cc content/browser/storage_partition_impl.cc
|
2019-11-26 22:26:48 +01:00
|
|
|
index 818a6370957a..46282b320b0b 100644
|
2019-10-01 15:55:16 +02:00
|
|
|
--- content/browser/storage_partition_impl.cc
|
|
|
|
+++ content/browser/storage_partition_impl.cc
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -577,10 +577,6 @@ class LoginHandlerDelegate {
|
2019-07-12 22:44:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
WebContents* web_contents = web_contents_getter_.Run();
|
|
|
|
- if (!web_contents) {
|
|
|
|
- OnAuthCredentials(base::nullopt);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
|
|
// WeakPtr is not strictly necessary here due to OnRequestCancelled.
|
|
|
|
creating_login_delegate_ = true;
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -637,12 +633,6 @@ void OnAuthRequiredContinuation(
|
2019-09-04 17:13:32 +02:00
|
|
|
web_contents_getter =
|
|
|
|
base::BindRepeating(GetWebContents, process_id, routing_id);
|
|
|
|
}
|
2019-07-12 22:44:43 +02:00
|
|
|
- if (!web_contents_getter.Run()) {
|
2019-10-01 15:55:16 +02:00
|
|
|
- mojo::Remote<network::mojom::AuthChallengeResponder>
|
|
|
|
- auth_challenge_responder_remote(std::move(auth_challenge_responder));
|
|
|
|
- auth_challenge_responder_remote->OnAuthCredentials(base::nullopt);
|
2019-07-12 22:44:43 +02:00
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
new LoginHandlerDelegate(std::move(auth_challenge_responder),
|
|
|
|
std::move(web_contents_getter), auth_info,
|
2019-09-04 17:13:32 +02:00
|
|
|
is_request_for_main_frame, process_id, routing_id,
|
2019-11-26 22:26:48 +01:00
|
|
|
@@ -2277,7 +2267,10 @@ void StoragePartitionImpl::GetQuotaSettings(
|
|
|
|
void StoragePartitionImpl::InitNetworkContext() {
|
|
|
|
network_context_ = GetContentClient()->browser()->CreateNetworkContext(
|
|
|
|
browser_context_, is_in_memory_, relative_partition_path_);
|
|
|
|
- DCHECK(network_context_);
|
|
|
|
+ if (!network_context_) {
|
|
|
|
+ // May happen during shutdown.
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
network_context_client_receiver_.reset();
|
|
|
|
network_context_->SetClient(
|
2019-07-12 22:44:43 +02:00
|
|
|
diff --git services/network/public/cpp/simple_url_loader.cc services/network/public/cpp/simple_url_loader.cc
|
2019-11-12 17:11:44 +01:00
|
|
|
index 1cc4198e6057..0fae6dbe25a2 100644
|
2019-07-12 22:44:43 +02:00
|
|
|
--- services/network/public/cpp/simple_url_loader.cc
|
|
|
|
+++ services/network/public/cpp/simple_url_loader.cc
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -230,6 +230,7 @@ class SimpleURLLoaderImpl : public SimpleURLLoader,
|
2019-07-12 22:44:43 +02:00
|
|
|
void SetRetryOptions(int max_retries, int retry_mode) override;
|
2019-11-12 17:11:44 +01:00
|
|
|
void SetURLLoaderFactoryOptions(uint32_t options) override;
|
2019-07-12 22:44:43 +02:00
|
|
|
void SetTimeoutDuration(base::TimeDelta timeout_duration) override;
|
|
|
|
+ void SetRequestId(int32_t request_id) override;
|
|
|
|
|
|
|
|
int NetError() const override;
|
2019-11-12 17:11:44 +01:00
|
|
|
const mojom::URLResponseHead* ResponseInfo() const override;
|
|
|
|
@@ -348,6 +349,8 @@ class SimpleURLLoaderImpl : public SimpleURLLoader,
|
2019-07-12 22:44:43 +02:00
|
|
|
// The next values contain all the information required to restart the
|
|
|
|
// request.
|
|
|
|
|
|
|
|
+ int32_t request_id_ = 0;
|
|
|
|
+
|
|
|
|
// Populated in the constructor, and cleared once no longer needed, when no
|
|
|
|
// more retries are possible.
|
|
|
|
std::unique_ptr<ResourceRequest> resource_request_;
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -1373,6 +1376,12 @@ void SimpleURLLoaderImpl::SetTimeoutDuration(base::TimeDelta timeout_duration) {
|
2019-07-12 22:44:43 +02:00
|
|
|
timeout_duration_ = timeout_duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
+void SimpleURLLoaderImpl::SetRequestId(int32_t request_id) {
|
|
|
|
+ // Check if a request has not yet been started.
|
|
|
|
+ DCHECK(!body_handler_);
|
|
|
|
+ request_id_ = request_id;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int SimpleURLLoaderImpl::NetError() const {
|
|
|
|
// Should only be called once the request is compelete.
|
|
|
|
DCHECK(request_state_->finished);
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -1521,7 +1530,7 @@ void SimpleURLLoaderImpl::StartRequest(
|
|
|
|
string_upload_data_pipe_getter_->GetRemoteForNewUpload());
|
2019-07-12 22:44:43 +02:00
|
|
|
}
|
|
|
|
url_loader_factory->CreateLoaderAndStart(
|
|
|
|
- mojo::MakeRequest(&url_loader_), 0 /* routing_id */, 0 /* request_id */,
|
|
|
|
+ mojo::MakeRequest(&url_loader_), 0 /* routing_id */, request_id_,
|
2019-11-12 17:11:44 +01:00
|
|
|
url_loader_factory_options_, *resource_request_, std::move(client_ptr),
|
2019-07-12 22:44:43 +02:00
|
|
|
net::MutableNetworkTrafficAnnotationTag(annotation_tag_));
|
|
|
|
|
|
|
|
diff --git services/network/public/cpp/simple_url_loader.h services/network/public/cpp/simple_url_loader.h
|
2019-11-12 17:11:44 +01:00
|
|
|
index 88d602b0915c..ffe9b5adcebf 100644
|
2019-07-12 22:44:43 +02:00
|
|
|
--- services/network/public/cpp/simple_url_loader.h
|
|
|
|
+++ services/network/public/cpp/simple_url_loader.h
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -332,6 +332,9 @@ class COMPONENT_EXPORT(NETWORK_CPP) SimpleURLLoader {
|
2019-07-12 22:44:43 +02:00
|
|
|
// as much time as it wants.
|
|
|
|
virtual void SetTimeoutDuration(base::TimeDelta timeout_duration) = 0;
|
|
|
|
|
|
|
|
+ // Set the ID that will be associated with the request.
|
|
|
|
+ virtual void SetRequestId(int32_t request_id) = 0;
|
|
|
|
+
|
|
|
|
// Returns the net::Error representing the final status of the request. May
|
|
|
|
// only be called once the loader has informed the caller of completion.
|
|
|
|
virtual int NetError() const = 0;
|