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

Unified Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 1299493003: Attach mixed content status to resource requests when sent to devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: mkwst comments Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/fetch/ResourceFetcher.cpp
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index 7df5fd157395b48b3b5fe739197e389275547e59..2352748bd0a36a0dc8b5c236d87b53a660eaa185 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -213,7 +213,7 @@ bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
{
// Redirects can change the response URL different from one of request.
bool forPreload = resource->isUnusedPreload();
- if (!context().canRequest(resource->type(), resource->resourceRequest(), url, resource->options(), forPreload, FetchRequest::UseDefaultOriginRestrictionForType))
+ if (!context().canRequest(resource->type(), resource->mutableResourceRequest(), url, resource->options(), forPreload, FetchRequest::UseDefaultOriginRestrictionForType))
return false;
if (!sourceOrigin)
@@ -303,7 +303,7 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(FetchRequest& request, co
if (!url.isValid())
return nullptr;
- if (!context().canRequest(factory.type(), request.resourceRequest(), url, request.options(), request.forPreload(), request.originRestriction()))
+ if (!context().canRequest(factory.type(), request.mutableResourceRequest(), url, request.options(), request.forPreload(), request.originRestriction()))
return nullptr;
context().dispatchWillRequestResource(&request);
@@ -877,14 +877,14 @@ void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
context().dispatchWillSendRequest(identifier, request, redirectResponse, initiatorInfo);
}
-void ResourceFetcher::didReceiveResponse(const Resource* resource, const ResourceResponse& response)
+void ResourceFetcher::didReceiveResponse(Resource* resource, const ResourceResponse& response)
{
// If the response is fetched via ServiceWorker, the original URL of the response could be different from the URL of the request.
// We check the URL not to load the resources which are forbidden by the page CSP. This behavior is not specified in the CSP specification yet.
// FIXME(mkwst): Fix this behavior when the CSP docs are updated.
if (response.wasFetchedViaServiceWorker()) {
const KURL& originalURL = response.originalURLViaServiceWorker();
- if (!originalURL.isEmpty() && !context().canRequest(resource->type(), resource->resourceRequest(), originalURL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType)) {
+ if (!originalURL.isEmpty() && !context().canRequest(resource->type(), resource->mutableResourceRequest(), originalURL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType)) {
resource->loader()->cancel();
bool isInternalRequest = resource->options().initiatorInfo.name == FetchInitiatorTypeNames::internal;
context().dispatchDidFail(resource->identifier(), ResourceError(errorDomainBlinkInternal, 0, originalURL.string(), "Unsafe attempt to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), isInternalRequest);

Powered by Google App Engine
This is Rietveld 408576698