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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); | 1329 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); |
1330 } | 1330 } |
1331 | 1331 |
1332 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in
itiatorInfo) | 1332 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in
itiatorInfo) |
1333 { | 1333 { |
1334 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); | 1334 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); |
1335 } | 1335 } |
1336 | 1336 |
1337 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) | 1337 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) |
1338 { | 1338 { |
1339 // FIXME: When response.wasFetchedViaServiceWorker() is true, we need to che
ck the URL of the responce for CSP and CORS. | 1339 // If the response is fetched via ServiceWorker, the original URL of the res
ponse could be different from the URL of the request. |
| 1340 if (response.wasFetchedViaServiceWorker()) { |
| 1341 if (!canRequest(resource->type(), response.url(), resource->options(), f
alse, FetchRequest::UseDefaultOriginRestrictionForType)) { |
| 1342 resource->loader()->cancel(); |
| 1343 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
.")); |
| 1344 return; |
| 1345 } |
| 1346 } |
1340 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); | 1347 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); |
1341 } | 1348 } |
1342 | 1349 |
1343 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) | 1350 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) |
1344 { | 1351 { |
1345 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d
ata, dataLength, encodedDataLength); | 1352 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d
ata, dataLength, encodedDataLength); |
1346 } | 1353 } |
1347 | 1354 |
1348 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength,
int encodedDataLength) | 1355 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength,
int encodedDataLength) |
1349 { | 1356 { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 } | 1553 } |
1547 } | 1554 } |
1548 | 1555 |
1549 void ResourceFetcher::trace(Visitor* visitor) | 1556 void ResourceFetcher::trace(Visitor* visitor) |
1550 { | 1557 { |
1551 visitor->trace(m_document); | 1558 visitor->trace(m_document); |
1552 ResourceLoaderHost::trace(visitor); | 1559 ResourceLoaderHost::trace(visitor); |
1553 } | 1560 } |
1554 | 1561 |
1555 } | 1562 } |
OLD | NEW |