| 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::ReportingStatus mixedContentReporting = forPreload ? |
| 595 MixedContentChecker::SuppressReport : MixedContentChecker::SendReport; |
| 596 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques
t, url, mixedContentReporting); |
| 595 } | 597 } |
| 596 | 598 |
| 597 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
ceOrigin, const KURL& url) const | 599 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
ceOrigin, const KURL& url) const |
| 598 { | 600 { |
| 599 // Redirects can change the response URL different from one of request. | 601 // 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)) | 602 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource
->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict
ionForType)) |
| 601 return false; | 603 return false; |
| 602 | 604 |
| 603 if (!sourceOrigin && document()) | 605 if (!sourceOrigin && document()) |
| 604 sourceOrigin = document()->securityOrigin(); | 606 sourceOrigin = document()->securityOrigin(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 if (resource->stillNeedsLoad()) | 669 if (resource->stillNeedsLoad()) |
| 668 return true; | 670 return true; |
| 669 return request.options().synchronousPolicy == RequestSynchronously && resour
ce->isLoading(); | 671 return request.options().synchronousPolicy == RequestSynchronously && resour
ce->isLoading(); |
| 670 } | 672 } |
| 671 | 673 |
| 672 void ResourceFetcher::maybeNotifyInsecureContent(const Resource* resource) const | 674 void ResourceFetcher::maybeNotifyInsecureContent(const Resource* resource) const |
| 673 { | 675 { |
| 674 // As a side effect browser will be notified. | 676 // As a side effect browser will be notified. |
| 675 MixedContentChecker::shouldBlockFetch(frame(), | 677 MixedContentChecker::shouldBlockFetch(frame(), |
| 676 resource->lastResourceRequest(), | 678 resource->lastResourceRequest(), |
| 677 resource->lastResourceRequest().url())
; | 679 resource->lastResourceRequest().url(), |
| 680 MixedContentChecker::SendReport); |
| 678 } | 681 } |
| 679 | 682 |
| 680 // Limit the number of URLs in m_validatedURLs to avoid memory bloat. | 683 // Limit the number of URLs in m_validatedURLs to avoid memory bloat. |
| 681 // http://crbug.com/52411 | 684 // http://crbug.com/52411 |
| 682 static const int kMaxValidatedURLsSize = 10000; | 685 static const int kMaxValidatedURLsSize = 10000; |
| 683 | 686 |
| 684 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest&
request, ResourceLoadStartType type) | 687 void ResourceFetcher::requestLoadStarted(Resource* resource, const FetchRequest&
request, ResourceLoadStartType type) |
| 685 { | 688 { |
| 686 if (type == ResourceLoadingFromCache) | 689 if (type == ResourceLoadingFromCache) |
| 687 notifyLoadedFromMemoryCache(resource); | 690 notifyLoadedFromMemoryCache(resource); |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 determineRequestContext(request.mutableResourceRequest(), type); | 1257 determineRequestContext(request.mutableResourceRequest(), type); |
| 1255 } | 1258 } |
| 1256 | 1259 |
| 1257 request.setCharset(encoding); | 1260 request.setCharset(encoding); |
| 1258 request.setForPreload(true); | 1261 request.setForPreload(true); |
| 1259 | 1262 |
| 1260 ResourcePtr<Resource> resource; | 1263 ResourcePtr<Resource> resource; |
| 1261 // Loading images involves several special cases, so use dedicated fetch met
hod instead. | 1264 // Loading images involves several special cases, so use dedicated fetch met
hod instead. |
| 1262 if (type == Resource::Image) | 1265 if (type == Resource::Image) |
| 1263 resource = fetchImage(request); | 1266 resource = fetchImage(request); |
| 1264 | 1267 else |
| 1265 if (!resource) | |
| 1266 resource = requestResource(type, request); | 1268 resource = requestResource(type, request); |
| 1267 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) | 1269 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) |
| 1268 return; | 1270 return; |
| 1269 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); | 1271 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); |
| 1270 resource->increasePreloadCount(); | 1272 resource->increasePreloadCount(); |
| 1271 | 1273 |
| 1272 if (!m_preloads) | 1274 if (!m_preloads) |
| 1273 m_preloads = adoptPtr(new ListHashSet<Resource*>); | 1275 m_preloads = adoptPtr(new ListHashSet<Resource*>); |
| 1274 m_preloads->add(resource.get()); | 1276 m_preloads->add(resource.get()); |
| 1275 | 1277 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 | 1574 |
| 1573 void ResourceFetcher::trace(Visitor* visitor) | 1575 void ResourceFetcher::trace(Visitor* visitor) |
| 1574 { | 1576 { |
| 1575 visitor->trace(m_document); | 1577 visitor->trace(m_document); |
| 1576 visitor->trace(m_loaders); | 1578 visitor->trace(m_loaders); |
| 1577 visitor->trace(m_multipartLoaders); | 1579 visitor->trace(m_multipartLoaders); |
| 1578 ResourceLoaderHost::trace(visitor); | 1580 ResourceLoaderHost::trace(visitor); |
| 1579 } | 1581 } |
| 1580 | 1582 |
| 1581 } | 1583 } |
| OLD | NEW |