| Index: content/browser/appcache/appcache_subresource_url_factory.cc
|
| diff --git a/content/browser/appcache/appcache_subresource_url_factory.cc b/content/browser/appcache/appcache_subresource_url_factory.cc
|
| index 4b6f9fd36b56372749525dd7296dfdc9fb592209..7cf3e200ec1592c4ce28ffe227893c2fd2468228 100644
|
| --- a/content/browser/appcache/appcache_subresource_url_factory.cc
|
| +++ b/content/browser/appcache/appcache_subresource_url_factory.cc
|
| @@ -21,6 +21,13 @@
|
|
|
| namespace content {
|
|
|
| +namespace {
|
| +
|
| +// Set to true if we are running as part of tests.
|
| +bool g_for_testing = false;
|
| +
|
| +} // namespace.
|
| +
|
| // Implements the URLLoaderFactory mojom for AppCache requests.
|
| AppCacheSubresourceURLFactory::AppCacheSubresourceURLFactory(
|
| mojom::URLLoaderFactoryRequest request,
|
| @@ -63,17 +70,17 @@ void AppCacheSubresourceURLFactory::CreateLoaderAndStart(
|
|
|
| // If the host is invalid, it means that the renderer has probably died.
|
| // (Frame has navigated elsewhere?)
|
| - if (!appcache_host_.get())
|
| + if (!appcache_host_.get() && !g_for_testing) {
|
| + NotifyError(std::move(client), net::ERR_FAILED);
|
| return;
|
| + }
|
|
|
| std::unique_ptr<AppCacheRequestHandler> handler =
|
| appcache_host_->CreateRequestHandler(
|
| AppCacheURLLoaderRequest::Create(request), request.resource_type,
|
| request.should_reset_appcache);
|
| if (!handler) {
|
| - ResourceRequestCompletionStatus request_result;
|
| - request_result.error_code = net::ERR_FAILED;
|
| - client->OnComplete(request_result);
|
| + NotifyError(std::move(client), net::ERR_FAILED);
|
| return;
|
| }
|
|
|
| @@ -109,4 +116,17 @@ void AppCacheSubresourceURLFactory::OnConnectionError() {
|
| base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
|
| }
|
|
|
| +void AppCacheSubresourceURLFactory::NotifyError(
|
| + mojom::URLLoaderClientPtr client,
|
| + int error_code) {
|
| + ResourceRequestCompletionStatus request_result;
|
| + request_result.error_code = error_code;
|
| + client->OnComplete(request_result);
|
| +}
|
| +
|
| +// static
|
| +void AppCacheSubresourceURLFactory::SetForTesting(bool for_testing) {
|
| + g_for_testing = for_testing;
|
| +}
|
| +
|
| } // namespace content
|
|
|