OLD | NEW |
---|---|
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 | 584 |
585 // If we're loading the main resource of a subframe, ensure that we check | 585 // If we're loading the main resource of a subframe, ensure that we check |
586 // against the parent of the active frame, rather than the frame itself. | 586 // against the parent of the active frame, rather than the frame itself. |
587 LocalFrame* effectiveFrame = frame(); | 587 LocalFrame* effectiveFrame = frame(); |
588 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { | 588 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { |
589 // FIXME: Deal with RemoteFrames. | 589 // FIXME: Deal with RemoteFrames. |
590 if (frame()->tree().parent()->isLocalFrame()) | 590 if (frame()->tree().parent()->isLocalFrame()) |
591 effectiveFrame = toLocalFrame(frame()->tree().parent()); | 591 effectiveFrame = toLocalFrame(frame()->tree().parent()); |
592 } | 592 } |
593 | 593 |
594 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques t, url); | 594 MixedContentChecker::SuppressLogType suppressLog = forPreload ? MixedContent Checker::SuppressLog : MixedContentChecker::LogIfBlocked; |
595 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques t, url, suppressLog); | |
595 } | 596 } |
596 | 597 |
597 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour ceOrigin, const KURL& url) const | 598 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour ceOrigin, const KURL& url) const |
598 { | 599 { |
599 // Redirects can change the response URL different from one of request. | 600 // Redirects can change the response URL different from one of request. |
600 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource ->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict ionForType)) | 601 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource ->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict ionForType)) |
601 return false; | 602 return false; |
602 | 603 |
603 if (!sourceOrigin && document()) | 604 if (!sourceOrigin && document()) |
604 sourceOrigin = document()->securityOrigin(); | 605 sourceOrigin = document()->securityOrigin(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
667 if (resource->stillNeedsLoad()) | 668 if (resource->stillNeedsLoad()) |
668 return true; | 669 return true; |
669 return request.options().synchronousPolicy == RequestSynchronously && resour ce->isLoading(); | 670 return request.options().synchronousPolicy == RequestSynchronously && resour ce->isLoading(); |
670 } | 671 } |
671 | 672 |
672 void ResourceFetcher::maybeNotifyInsecureContent(const Resource* resource) const | 673 void ResourceFetcher::maybeNotifyInsecureContent(const Resource* resource) const |
673 { | 674 { |
674 // As a side effect browser will be notified. | 675 // As a side effect browser will be notified. |
675 MixedContentChecker::shouldBlockFetch(frame(), | 676 MixedContentChecker::shouldBlockFetch(frame(), |
676 resource->lastResourceRequest(), | 677 resource->lastResourceRequest(), |
677 resource->lastResourceRequest().url()) ; | 678 resource->lastResourceRequest().url(), |
679 MixedContentChecker::LogIfBlocked); | |
678 } | 680 } |
679 | 681 |
680 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type) | 682 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest& request, ResourceLoadStartType type) |
681 { | 683 { |
682 if (type == ResourceLoadingFromCache) | 684 if (type == ResourceLoadingFromCache) |
683 notifyLoadedFromMemoryCache(resource); | 685 notifyLoadedFromMemoryCache(resource); |
684 | 686 |
685 if (request.resourceRequest().url().protocolIsData() || (m_documentLoader && m_documentLoader->substituteData().isValid())) | 687 if (request.resourceRequest().url().protocolIsData() || (m_documentLoader && m_documentLoader->substituteData().isValid())) |
686 return; | 688 return; |
687 | 689 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1247 determineRequestContext(request.mutableResourceRequest(), type); | 1249 determineRequestContext(request.mutableResourceRequest(), type); |
1248 } | 1250 } |
1249 | 1251 |
1250 request.setCharset(encoding); | 1252 request.setCharset(encoding); |
1251 request.setForPreload(true); | 1253 request.setForPreload(true); |
1252 | 1254 |
1253 ResourcePtr<Resource> resource; | 1255 ResourcePtr<Resource> resource; |
1254 // Loading images involves several special cases, so use dedicated fetch met hod instead. | 1256 // Loading images involves several special cases, so use dedicated fetch met hod instead. |
1255 if (type == Resource::Image) | 1257 if (type == Resource::Image) |
1256 resource = fetchImage(request); | 1258 resource = fetchImage(request); |
1257 | 1259 else |
Mike West
2014/11/14 08:08:17
Why this change?
kouhei (in TOK)
2014/11/14 09:19:31
When fetchImage fails from CSP/mixedContent check,
| |
1258 if (!resource) | |
1259 resource = requestResource(type, request); | 1260 resource = requestResource(type, request); |
1260 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) | 1261 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) |
1261 return; | 1262 return; |
1262 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); | 1263 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); |
1263 resource->increasePreloadCount(); | 1264 resource->increasePreloadCount(); |
1264 | 1265 |
1265 if (!m_preloads) | 1266 if (!m_preloads) |
1266 m_preloads = adoptPtr(new ListHashSet<Resource*>); | 1267 m_preloads = adoptPtr(new ListHashSet<Resource*>); |
1267 m_preloads->add(resource.get()); | 1268 m_preloads->add(resource.get()); |
1268 | 1269 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1565 | 1566 |
1566 void ResourceFetcher::trace(Visitor* visitor) | 1567 void ResourceFetcher::trace(Visitor* visitor) |
1567 { | 1568 { |
1568 visitor->trace(m_document); | 1569 visitor->trace(m_document); |
1569 visitor->trace(m_loaders); | 1570 visitor->trace(m_loaders); |
1570 visitor->trace(m_multipartLoaders); | 1571 visitor->trace(m_multipartLoaders); |
1571 ResourceLoaderHost::trace(visitor); | 1572 ResourceLoaderHost::trace(visitor); |
1572 } | 1573 } |
1573 | 1574 |
1574 } | 1575 } |
OLD | NEW |