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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); | 1306 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); |
1307 } | 1307 } |
1308 | 1308 |
1309 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in
itiatorInfo) | 1309 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest&
request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in
itiatorInfo) |
1310 { | 1310 { |
1311 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); | 1311 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red
irectResponse, initiatorInfo); |
1312 } | 1312 } |
1313 | 1313 |
1314 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) | 1314 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc
eResponse& response) |
1315 { | 1315 { |
1316 // FIXME: When response.wasFetchedViaServiceWorker() is true, we need to che
ck the URL of the responce for CSP and CORS. | 1316 if (response.wasFetchedViaServiceWorker()) { |
| 1317 if (!canRequest(resource->type(), response.url(), resource->options(), f
alse, FetchRequest::UseDefaultOriginRestrictionForType)) { |
| 1318 resource->loader()->cancel(); |
| 1319 context().dispatchDidFail(m_documentLoader, resource->identifier(),
ResourceError(errorDomainBlinkInternal, 0, response.url().string(), "Original ur
l check of ServiceWorker fetched resource failed.")); |
| 1320 return; |
| 1321 } |
| 1322 } |
1317 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); | 1323 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier(
), response, resource->loader()); |
1318 } | 1324 } |
1319 | 1325 |
1320 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) | 1326 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data,
int dataLength, int encodedDataLength) |
1321 { | 1327 { |
1322 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d
ata, dataLength, encodedDataLength); | 1328 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d
ata, dataLength, encodedDataLength); |
1323 } | 1329 } |
1324 | 1330 |
1325 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength,
int encodedDataLength) | 1331 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength,
int encodedDataLength) |
1326 { | 1332 { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 } | 1529 } |
1524 } | 1530 } |
1525 | 1531 |
1526 void ResourceFetcher::trace(Visitor* visitor) | 1532 void ResourceFetcher::trace(Visitor* visitor) |
1527 { | 1533 { |
1528 visitor->trace(m_document); | 1534 visitor->trace(m_document); |
1529 ResourceLoaderHost::trace(visitor); | 1535 ResourceLoaderHost::trace(visitor); |
1530 } | 1536 } |
1531 | 1537 |
1532 } | 1538 } |
OLD | NEW |