| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "core/fetch/ScriptResource.h" | 44 #include "core/fetch/ScriptResource.h" |
| 45 #include "core/fetch/XSLStyleSheetResource.h" | 45 #include "core/fetch/XSLStyleSheetResource.h" |
| 46 #include "core/html/HTMLElement.h" | 46 #include "core/html/HTMLElement.h" |
| 47 #include "core/html/HTMLFrameOwnerElement.h" | 47 #include "core/html/HTMLFrameOwnerElement.h" |
| 48 #include "core/html/imports/HTMLImportsController.h" | 48 #include "core/html/imports/HTMLImportsController.h" |
| 49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
| 50 #include "core/inspector/InspectorInstrumentation.h" | 50 #include "core/inspector/InspectorInstrumentation.h" |
| 51 #include "core/loader/DocumentLoader.h" | 51 #include "core/loader/DocumentLoader.h" |
| 52 #include "core/loader/FrameLoader.h" | 52 #include "core/loader/FrameLoader.h" |
| 53 #include "core/loader/FrameLoaderClient.h" | 53 #include "core/loader/FrameLoaderClient.h" |
| 54 #include "core/loader/MixedContentChecker.h" | |
| 55 #include "core/loader/PingLoader.h" | 54 #include "core/loader/PingLoader.h" |
| 56 #include "core/loader/SubstituteData.h" | 55 #include "core/loader/SubstituteData.h" |
| 57 #include "core/loader/UniqueIdentifier.h" | 56 #include "core/loader/UniqueIdentifier.h" |
| 58 #include "core/loader/appcache/ApplicationCacheHost.h" | 57 #include "core/loader/appcache/ApplicationCacheHost.h" |
| 59 #include "core/frame/LocalDOMWindow.h" | 58 #include "core/frame/LocalDOMWindow.h" |
| 60 #include "core/frame/LocalFrame.h" | 59 #include "core/frame/LocalFrame.h" |
| 61 #include "core/frame/csp/ContentSecurityPolicy.h" | 60 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 62 #include "core/timing/Performance.h" | 61 #include "core/timing/Performance.h" |
| 63 #include "core/timing/ResourceTimingInfo.h" | 62 #include "core/timing/ResourceTimingInfo.h" |
| 64 #include "core/frame/Settings.h" | 63 #include "core/frame/Settings.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 572 |
| 574 // If we're loading the main resource of a subframe, ensure that we check | 573 // If we're loading the main resource of a subframe, ensure that we check |
| 575 // against the parent of the active frame, rather than the frame itself. | 574 // against the parent of the active frame, rather than the frame itself. |
| 576 LocalFrame* effectiveFrame = frame(); | 575 LocalFrame* effectiveFrame = frame(); |
| 577 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { | 576 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { |
| 578 // FIXME: Deal with RemoteFrames. | 577 // FIXME: Deal with RemoteFrames. |
| 579 if (frame()->tree().parent()->isLocalFrame()) | 578 if (frame()->tree().parent()->isLocalFrame()) |
| 580 effectiveFrame = toLocalFrame(frame()->tree().parent()); | 579 effectiveFrame = toLocalFrame(frame()->tree().parent()); |
| 581 } | 580 } |
| 582 | 581 |
| 583 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques
t.requestContext(), resourceRequest.frameType(), url); | 582 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques
t, url); |
| 584 } | 583 } |
| 585 | 584 |
| 586 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
ceOrigin, const KURL& url) const | 585 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour
ceOrigin, const KURL& url) const |
| 587 { | 586 { |
| 588 // Redirects can change the response URL different from one of request. | 587 // Redirects can change the response URL different from one of request. |
| 589 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource
->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict
ionForType)) | 588 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource
->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict
ionForType)) |
| 590 return false; | 589 return false; |
| 591 | 590 |
| 592 if (!sourceOrigin && document()) | 591 if (!sourceOrigin && document()) |
| 593 sourceOrigin = document()->securityOrigin(); | 592 sourceOrigin = document()->securityOrigin(); |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 // Ensure main resources aren't preloaded, since the cache can't actually re
use the preload. | 1198 // Ensure main resources aren't preloaded, since the cache can't actually re
use the preload. |
| 1200 if (type == Resource::MainResource) | 1199 if (type == Resource::MainResource) |
| 1201 return; | 1200 return; |
| 1202 | 1201 |
| 1203 String encoding; | 1202 String encoding; |
| 1204 if (type == Resource::Script || type == Resource::CSSStyleSheet) | 1203 if (type == Resource::Script || type == Resource::CSSStyleSheet) |
| 1205 encoding = charset.isEmpty() ? m_document->charset().string() : charset; | 1204 encoding = charset.isEmpty() ? m_document->charset().string() : charset; |
| 1206 | 1205 |
| 1207 request.setCharset(encoding); | 1206 request.setCharset(encoding); |
| 1208 request.setForPreload(true); | 1207 request.setForPreload(true); |
| 1209 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon
textPrefetch); | |
| 1210 | 1208 |
| 1211 ResourcePtr<Resource> resource; | 1209 ResourcePtr<Resource> resource; |
| 1212 // Loading images involves several special cases, so use dedicated fetch met
hod instead. | 1210 // Loading images involves several special cases, so use dedicated fetch met
hod instead. |
| 1213 if (type == Resource::Image) | 1211 if (type == Resource::Image) |
| 1214 resource = fetchImage(request); | 1212 resource = fetchImage(request); |
| 1215 if (!resource) | 1213 if (!resource) |
| 1216 resource = requestResource(type, request); | 1214 resource = requestResource(type, request); |
| 1217 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) | 1215 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) |
| 1218 return; | 1216 return; |
| 1219 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); | 1217 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 | 1507 |
| 1510 void ResourceFetcher::trace(Visitor* visitor) | 1508 void ResourceFetcher::trace(Visitor* visitor) |
| 1511 { | 1509 { |
| 1512 visitor->trace(m_document); | 1510 visitor->trace(m_document); |
| 1513 visitor->trace(m_loaders); | 1511 visitor->trace(m_loaders); |
| 1514 visitor->trace(m_multipartLoaders); | 1512 visitor->trace(m_multipartLoaders); |
| 1515 ResourceLoaderHost::trace(visitor); | 1513 ResourceLoaderHost::trace(visitor); |
| 1516 } | 1514 } |
| 1517 | 1515 |
| 1518 } | 1516 } |
| OLD | NEW |