Commit 036e4e01 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Revert "Fix ExtensionWebRequestApiTest.WebRequestUnloadImmediately with network service"

This reverts commit c9cbab07.

Reason for revert: Caused flakiness https://crbug.com/871601

Original change's description:
> Fix ExtensionWebRequestApiTest.WebRequestUnloadImmediately with network service
> 
> The error event was not being sent when the client was reset.
> 
> Bug: 721414
> Cq-Include-Trybots: luci.chromium.try:linux_mojo
> Change-Id: I951422061022d50644d8453900af14be27bb9eaf
> Reviewed-on: https://chromium-review.googlesource.com/1150403
> Commit-Queue: Clark DuVall <cduvall@chromium.org>
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#580911}

TBR=jam@chromium.org,cduvall@chromium.org

Change-Id: If5d71d67ad54ed590408c7ef1af0c71431c788d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 721414
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Reviewed-on: https://chromium-review.googlesource.com/1164822Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581156}
parent 3a633dbf
...@@ -62,11 +62,11 @@ WebRequestProxyingURLLoaderFactory::InProgressRequest::InProgressRequest( ...@@ -62,11 +62,11 @@ WebRequestProxyingURLLoaderFactory::InProgressRequest::InProgressRequest(
target_client_(std::move(client)), target_client_(std::move(client)),
proxied_client_binding_(this), proxied_client_binding_(this),
weak_factory_(this) { weak_factory_(this) {
// If there is a client error, clean up the request. // If there is a client error, remove this request from the proxy. |factory_|
// outlives this class, so base::Unretained is safe.
target_client_.set_connection_error_handler(base::BindOnce( target_client_.set_connection_error_handler(base::BindOnce(
&WebRequestProxyingURLLoaderFactory::InProgressRequest::OnRequestError, &WebRequestProxyingURLLoaderFactory::RemoveRequest,
weak_factory_.GetWeakPtr(), base::Unretained(factory_), network_service_request_id_, request_id_));
network::URLLoaderCompletionStatus(net::ERR_ABORTED)));
} }
WebRequestProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() { WebRequestProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() {
...@@ -79,7 +79,6 @@ WebRequestProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() { ...@@ -79,7 +79,6 @@ WebRequestProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() {
} }
void WebRequestProxyingURLLoaderFactory::InProgressRequest::Restart() { void WebRequestProxyingURLLoaderFactory::InProgressRequest::Restart() {
request_completed_ = false;
// Derive a new WebRequestInfo value any time |Restart()| is called, because // Derive a new WebRequestInfo value any time |Restart()| is called, because
// the details in |request_| may have changed e.g. if we've been redirected. // the details in |request_| may have changed e.g. if we've been redirected.
info_.emplace( info_.emplace(
...@@ -497,7 +496,6 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest:: ...@@ -497,7 +496,6 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest::
redirect_info.new_url); redirect_info.new_url);
target_client_->OnReceiveRedirect(redirect_info, current_response_); target_client_->OnReceiveRedirect(redirect_info, current_response_);
request_.url = redirect_info.new_url; request_.url = redirect_info.new_url;
request_completed_ = true;
} }
void WebRequestProxyingURLLoaderFactory::InProgressRequest:: void WebRequestProxyingURLLoaderFactory::InProgressRequest::
...@@ -531,14 +529,13 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest:: ...@@ -531,14 +529,13 @@ void WebRequestProxyingURLLoaderFactory::InProgressRequest::
continuation.Run(net::OK); continuation.Run(net::OK);
} }
void WebRequestProxyingURLLoaderFactory::InProgressRequest::OnRequestError( void WebRequestProxyingURLLoaderFactory::InProgressRequest::OnRequestError(
const network::URLLoaderCompletionStatus& status) { const network::URLLoaderCompletionStatus& status) {
if (!request_completed_) { target_client_->OnComplete(status);
target_client_->OnComplete(status); ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred(
ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( factory_->browser_context_, factory_->info_map_, &info_.value(),
factory_->browser_context_, factory_->info_map_, &info_.value(), true /* started */, status.error_code);
true /* started */, status.error_code);
}
// Deletes |this|. // Deletes |this|.
factory_->RemoveRequest(network_service_request_id_, request_id_); factory_->RemoveRequest(network_service_request_id_, request_id_);
......
...@@ -163,8 +163,6 @@ class WebRequestProxyingURLLoaderFactory ...@@ -163,8 +163,6 @@ class WebRequestProxyingURLLoaderFactory
// lifetime. // lifetime.
base::Optional<net::AuthCredentials> auth_credentials_; base::Optional<net::AuthCredentials> auth_credentials_;
bool request_completed_ = false;
base::WeakPtrFactory<InProgressRequest> weak_factory_; base::WeakPtrFactory<InProgressRequest> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(InProgressRequest); DISALLOW_COPY_AND_ASSIGN(InProgressRequest);
......
...@@ -187,6 +187,11 @@ ...@@ -187,6 +187,11 @@
-IOThreadBrowserTestWithHangingPacRequest.Shutdown -IOThreadBrowserTestWithHangingPacRequest.Shutdown
-ProxySettingsApiTest.ProxyEventsParseError -ProxySettingsApiTest.ProxyEventsParseError
# http://crbug.com/721414
# TODO(rockot): add support for webRequest API.
# Note WebRequestUnloadImmediately is disabled on Linux
-ExtensionWebRequestApiTest.WebRequestUnloadImmediately
# http://crbug.com/827582 # http://crbug.com/827582
# Editing response cookies through headers with webRequest is not supported with # Editing response cookies through headers with webRequest is not supported with
# the network service. # the network service.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment