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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in
itiatorInfo) | 1343 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in
itiatorInfo) |
1344 { | 1344 { |
1345 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); | 1345 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); |
1346 } | 1346 } |
1347 | 1347 |
1348 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) | 1348 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) |
1349 { | 1349 { |
1350 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); | 1350 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); |
1351 | 1351 |
1352 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. | 1352 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. |
| 1353 // We check the URL not to load the resources which are forbidden by the pag
e CSP. This behavior is not specified in the CSP specification yet. |
1353 if (response.wasFetchedViaServiceWorker()) { | 1354 if (response.wasFetchedViaServiceWorker()) { |
1354 KURL originalURL = response.url(); | 1355 const KURL& originalURL = response.originalURLViaServiceWorker(); |
1355 // FIXME: Use response.originalURLViaServiceWorker() after the chromium
side patch will land. | |
1356 if (!response.originalURLViaServiceWorker().isEmpty()) | |
1357 originalURL = response.originalURLViaServiceWorker(); | |
1358 if (!canRequest(resource->type(), resource->resourceRequest(), originalU
RL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType
)) { | 1356 if (!canRequest(resource->type(), resource->resourceRequest(), originalU
RL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType
)) { |
1359 resource->loader()->cancel(); | 1357 resource->loader()->cancel(); |
1360 bool isInternalRequest = resource->options().initiatorInfo.name == F
etchInitiatorTypeNames::internal; | 1358 bool isInternalRequest = resource->options().initiatorInfo.name == F
etchInitiatorTypeNames::internal; |
1361 context().dispatchDidFail(m_documentLoader, resource->identifier(),
ResourceError(errorDomainBlinkInternal, 0, originalURL.string(), "Unsafe attempt
to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), i
sInternalRequest); | 1359 context().dispatchDidFail(m_documentLoader, resource->identifier(),
ResourceError(errorDomainBlinkInternal, 0, originalURL.string(), "Unsafe attempt
to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), i
sInternalRequest); |
1362 return; | 1360 return; |
1363 } | 1361 } |
1364 } | 1362 } |
1365 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); | 1363 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); |
1366 } | 1364 } |
1367 | 1365 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 | 1576 |
1579 void ResourceFetcher::trace(Visitor* visitor) | 1577 void ResourceFetcher::trace(Visitor* visitor) |
1580 { | 1578 { |
1581 visitor->trace(m_document); | 1579 visitor->trace(m_document); |
1582 visitor->trace(m_loaders); | 1580 visitor->trace(m_loaders); |
1583 visitor->trace(m_multipartLoaders); | 1581 visitor->trace(m_multipartLoaders); |
1584 ResourceLoaderHost::trace(visitor); | 1582 ResourceLoaderHost::trace(visitor); |
1585 } | 1583 } |
1586 | 1584 |
1587 } | 1585 } |
OLD | NEW |