| 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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 | 898 |
| 899 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr
or& error) | 899 void ResourceFetcher::didFailLoading(const Resource* resource, const ResourceErr
or& error) |
| 900 { | 900 { |
| 901 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); | 901 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); |
| 902 removeResourceLoader(resource->loader()); | 902 removeResourceLoader(resource->loader()); |
| 903 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); | 903 m_resourceTimingInfoMap.take(const_cast<Resource*>(resource)); |
| 904 bool isInternalRequest = resource->options().initiatorInfo.name == FetchInit
iatorTypeNames::internal; | 904 bool isInternalRequest = resource->options().initiatorInfo.name == FetchInit
iatorTypeNames::internal; |
| 905 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); | 905 context().dispatchDidFail(resource->identifier(), error, isInternalRequest); |
| 906 } | 906 } |
| 907 | 907 |
| 908 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) | 908 void ResourceFetcher::didReceiveResponse(Resource* resource, const ResourceRespo
nse& response) |
| 909 { | 909 { |
| 910 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. | 910 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. |
| 911 // We check the URL not to load the resources which are forbidden by the pag
e CSP. | 911 // We check the URL not to load the resources which are forbidden by the pag
e CSP. |
| 912 // https://w3c.github.io/webappsec-csp/#should-block-response | 912 // https://w3c.github.io/webappsec-csp/#should-block-response |
| 913 if (response.wasFetchedViaServiceWorker()) { | 913 if (response.wasFetchedViaServiceWorker()) { |
| 914 const KURL& originalURL = response.originalURLViaServiceWorker(); | 914 const KURL& originalURL = response.originalURLViaServiceWorker(); |
| 915 if (!originalURL.isEmpty() && !context().allowResponse(resource->getType
(), resource->resourceRequest(), originalURL, resource->options())) { | 915 if (!originalURL.isEmpty() && !context().allowResponse(resource->getType
(), resource->resourceRequest(), originalURL, resource->options())) { |
| 916 resource->loader()->cancel(); | 916 resource->loader()->cancel(); |
| 917 bool isInternalRequest = resource->options().initiatorInfo.name == F
etchInitiatorTypeNames::internal; | 917 bool isInternalRequest = resource->options().initiatorInfo.name == F
etchInitiatorTypeNames::internal; |
| 918 context().dispatchDidFail(resource->identifier(), ResourceError(erro
rDomainBlinkInternal, 0, originalURL.getString(), "Unsafe attempt to load URL "
+ originalURL.elidedString() + " fetched by a ServiceWorker."), isInternalReques
t); | 918 context().dispatchDidFail(resource->identifier(), ResourceError(erro
rDomainBlinkInternal, 0, originalURL.getString(), "Unsafe attempt to load URL "
+ originalURL.elidedString() + " fetched by a ServiceWorker."), isInternalReques
t); |
| 919 return; | 919 return; |
| 920 } | 920 } |
| 921 } | 921 } |
| 922 context().dispatchDidReceiveResponse(resource->identifier(), response, resou
rce->resourceRequest().frameType(), resource->resourceRequest().requestContext()
, resource->loader()); | 922 context().dispatchDidReceiveResponse(resource->identifier(), response, resou
rce->resourceRequest().frameType(), resource->resourceRequest().requestContext()
, resource); |
| 923 } | 923 } |
| 924 | 924 |
| 925 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) | 925 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) |
| 926 { | 926 { |
| 927 context().dispatchDidReceiveData(resource->identifier(), data, dataLength, e
ncodedDataLength); | 927 context().dispatchDidReceiveData(resource->identifier(), data, dataLength, e
ncodedDataLength); |
| 928 } | 928 } |
| 929 | 929 |
| 930 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength,
int encodedDataLength) | 930 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength,
int encodedDataLength) |
| 931 { | 931 { |
| 932 context().dispatchDidDownloadData(resource->identifier(), dataLength, encode
dDataLength); | 932 context().dispatchDidDownloadData(resource->identifier(), dataLength, encode
dDataLength); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 visitor->trace(m_context); | 1164 visitor->trace(m_context); |
| 1165 visitor->trace(m_archive); | 1165 visitor->trace(m_archive); |
| 1166 visitor->trace(m_loaders); | 1166 visitor->trace(m_loaders); |
| 1167 visitor->trace(m_nonBlockingLoaders); | 1167 visitor->trace(m_nonBlockingLoaders); |
| 1168 visitor->trace(m_documentResources); | 1168 visitor->trace(m_documentResources); |
| 1169 visitor->trace(m_preloads); | 1169 visitor->trace(m_preloads); |
| 1170 visitor->trace(m_resourceTimingInfoMap); | 1170 visitor->trace(m_resourceTimingInfoMap); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 } // namespace blink | 1173 } // namespace blink |
| OLD | NEW |