Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2283473002: Fixes for the failing URLLoaderFactoryImplTest content_unittests with PlzNavigate enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/loader/DEPS ('k') | content/browser/loader/test_url_loader_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 if (IsRequestIDInUse(GlobalRequestID(child_id, request_id))) { 1275 if (IsRequestIDInUse(GlobalRequestID(child_id, request_id))) {
1276 bad_message::ReceivedBadMessage(filter_, 1276 bad_message::ReceivedBadMessage(filter_,
1277 bad_message::RDH_INVALID_REQUEST_ID); 1277 bad_message::RDH_INVALID_REQUEST_ID);
1278 return; 1278 return;
1279 } 1279 }
1280 1280
1281 // PlzNavigate: reject invalid renderer main resource request. 1281 // PlzNavigate: reject invalid renderer main resource request.
1282 bool is_navigation_stream_request = 1282 bool is_navigation_stream_request =
1283 IsBrowserSideNavigationEnabled() && 1283 IsBrowserSideNavigationEnabled() &&
1284 IsResourceTypeFrame(request_data.resource_type); 1284 IsResourceTypeFrame(request_data.resource_type);
1285 if (is_navigation_stream_request && 1285 // The process_type check is to ensure that unittests are not blocked from
1286 !request_data.resource_body_stream_url.SchemeIs(url::kBlobScheme)) { 1286 // issuing http requests.
1287 if ((process_type == PROCESS_TYPE_RENDERER) && is_navigation_stream_request
1288 && !request_data.resource_body_stream_url.SchemeIs(url::kBlobScheme)) {
1287 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_URL); 1289 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_URL);
1288 return; 1290 return;
1289 } 1291 }
1290 1292
1291 // Reject invalid priority. 1293 // Reject invalid priority.
1292 if (request_data.priority < net::MINIMUM_PRIORITY || 1294 if (request_data.priority < net::MINIMUM_PRIORITY ||
1293 request_data.priority > net::MAXIMUM_PRIORITY) { 1295 request_data.priority > net::MAXIMUM_PRIORITY) {
1294 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_PRIORITY); 1296 bad_message::ReceivedBadMessage(filter_, bad_message::RDH_INVALID_PRIORITY);
1295 return; 1297 return;
1296 } 1298 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 AbortRequestBeforeItStarts(filter_, sync_result, request_id, 1393 AbortRequestBeforeItStarts(filter_, sync_result, request_id,
1392 std::move(url_loader_client)); 1394 std::move(url_loader_client));
1393 return; 1395 return;
1394 } 1396 }
1395 1397
1396 int process_type = filter_->process_type(); 1398 int process_type = filter_->process_type();
1397 int child_id = filter_->child_id(); 1399 int child_id = filter_->child_id();
1398 1400
1399 bool is_navigation_stream_request = 1401 bool is_navigation_stream_request =
1400 IsBrowserSideNavigationEnabled() && 1402 IsBrowserSideNavigationEnabled() &&
1401 IsResourceTypeFrame(request_data.resource_type); 1403 IsResourceTypeFrame(request_data.resource_type) &&
1404 process_type == PROCESS_TYPE_RENDERER;
1402 1405
1403 ResourceContext* resource_context = NULL; 1406 ResourceContext* resource_context = NULL;
1404 net::URLRequestContext* request_context = NULL; 1407 net::URLRequestContext* request_context = NULL;
1405 filter_->GetContexts(request_data.resource_type, &resource_context, 1408 filter_->GetContexts(request_data.resource_type, &resource_context,
1406 &request_context); 1409 &request_context);
1407 1410
1408 // Allow the observer to block/handle the request. 1411 // Allow the observer to block/handle the request.
1409 if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method, 1412 if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method,
1410 request_data.url, 1413 request_data.url,
1411 request_data.resource_type, 1414 request_data.resource_type,
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 ResourceType resource_type, 1683 ResourceType resource_type,
1681 ResourceContext* resource_context, 1684 ResourceContext* resource_context,
1682 RequestContextType fetch_request_context_type, 1685 RequestContextType fetch_request_context_type,
1683 AppCacheService* appcache_service, 1686 AppCacheService* appcache_service,
1684 int child_id, 1687 int child_id,
1685 int route_id, 1688 int route_id,
1686 std::unique_ptr<ResourceHandler> handler) { 1689 std::unique_ptr<ResourceHandler> handler) {
1687 // PlzNavigate: do not add ResourceThrottles for main resource requests from 1690 // PlzNavigate: do not add ResourceThrottles for main resource requests from
1688 // the renderer. Decisions about the navigation should have been done in the 1691 // the renderer. Decisions about the navigation should have been done in the
1689 // initial request. 1692 // initial request.
1690 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && 1693 bool is_renderer =
1691 child_id != -1) { 1694 filter_ ? (filter_->process_type() == PROCESS_TYPE_RENDERER) : false;
1695 if (is_renderer && IsBrowserSideNavigationEnabled() &&
1696 IsResourceTypeFrame(resource_type)) {
1692 DCHECK(request->url().SchemeIs(url::kBlobScheme)); 1697 DCHECK(request->url().SchemeIs(url::kBlobScheme));
1693 return handler; 1698 return handler;
1694 } 1699 }
1695 1700
1696 PluginService* plugin_service = nullptr; 1701 PluginService* plugin_service = nullptr;
1697 #if defined(ENABLE_PLUGINS) 1702 #if defined(ENABLE_PLUGINS)
1698 plugin_service = PluginService::GetInstance(); 1703 plugin_service = PluginService::GetInstance();
1699 #endif 1704 #endif
1700 // Insert a buffered event handler before the actual one. 1705 // Insert a buffered event handler before the actual one.
1701 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, 1706 handler.reset(new MimeTypeResourceHandler(std::move(handler), this,
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 << iter->filesystem_url().spec(); 2724 << iter->filesystem_url().spec();
2720 return false; 2725 return false;
2721 } 2726 }
2722 } 2727 }
2723 } 2728 }
2724 } 2729 }
2725 return true; 2730 return true;
2726 } 2731 }
2727 2732
2728 } // namespace content 2733 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/DEPS ('k') | content/browser/loader/test_url_loader_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698