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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 { | 1342 { |
1343 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); | 1343 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); |
1344 } | 1344 } |
1345 | 1345 |
1346 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) | 1346 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) |
1347 { | 1347 { |
1348 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); | 1348 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); |
1349 | 1349 |
1350 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. | 1350 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. |
1351 if (response.wasFetchedViaServiceWorker()) { | 1351 if (response.wasFetchedViaServiceWorker()) { |
1352 if (!canRequest(resource->type(), resource->resourceRequest(), response.
url(), resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForT
ype)) { | 1352 KURL originalURL = response.url(); |
| 1353 // FIXME: Use response.originalURLViaServiceWorker() after the chromium
side patch will land. |
| 1354 if (!response.originalURLViaServiceWorker().isEmpty()) |
| 1355 originalURL = response.originalURLViaServiceWorker(); |
| 1356 if (!canRequest(resource->type(), resource->resourceRequest(), originalU
RL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType
)) { |
1353 resource->loader()->cancel(); | 1357 resource->loader()->cancel(); |
1354 bool isInternalRequest = resource->options().initiatorInfo.name == F
etchInitiatorTypeNames::internal; | 1358 bool isInternalRequest = resource->options().initiatorInfo.name == F
etchInitiatorTypeNames::internal; |
1355 context().dispatchDidFail(m_documentLoader, resource->identifier(),
ResourceError(errorDomainBlinkInternal, 0, response.url().string(), "Unsafe atte
mpt to load URL " + response.url().elidedString() + " fetched by a ServiceWorker
."), isInternalRequest); | 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); |
1356 return; | 1360 return; |
1357 } | 1361 } |
1358 } | 1362 } |
1359 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); | 1363 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); |
1360 } | 1364 } |
1361 | 1365 |
1362 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) | 1366 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) |
1363 { | 1367 { |
1364 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d
ata, dataLength, encodedDataLength); | 1368 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d
ata, dataLength, encodedDataLength); |
1365 } | 1369 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 | 1576 |
1573 void ResourceFetcher::trace(Visitor* visitor) | 1577 void ResourceFetcher::trace(Visitor* visitor) |
1574 { | 1578 { |
1575 visitor->trace(m_document); | 1579 visitor->trace(m_document); |
1576 visitor->trace(m_loaders); | 1580 visitor->trace(m_loaders); |
1577 visitor->trace(m_multipartLoaders); | 1581 visitor->trace(m_multipartLoaders); |
1578 ResourceLoaderHost::trace(visitor); | 1582 ResourceLoaderHost::trace(visitor); |
1579 } | 1583 } |
1580 | 1584 |
1581 } | 1585 } |
OLD | NEW |