Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 399543002: [ServiceWorker] Make fetch() method better conformance with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated yhirano's comment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 context().dispatchDidFail(m_documentLoader, resource->identifier(), error); 1292 context().dispatchDidFail(m_documentLoader, resource->identifier(), error);
1293 } 1293 }
1294 1294
1295 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo) 1295 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo)
1296 { 1296 {
1297 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red irectResponse, initiatorInfo); 1297 context().dispatchWillSendRequest(m_documentLoader, identifier, request, red irectResponse, initiatorInfo);
1298 } 1298 }
1299 1299
1300 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc eResponse& response) 1300 void ResourceFetcher::didReceiveResponse(const Resource* resource, const Resourc eResponse& response)
1301 { 1301 {
1302 // FIXME: When response.wasFetchedViaServiceWorker() is true, we need to che ck the URL of the responce for CSP and CORS. 1302 // If the response is fetched via ServiceWorker, the original URL of the res ponse could be different from the URL of the request.
1303 if (response.wasFetchedViaServiceWorker()) {
1304 if (!canRequest(resource->type(), resource->lastResourceRequest().reques tContext(), response.url(), resource->options(), false, FetchRequest::UseDefault OriginRestrictionForType)) {
1305 resource->loader()->cancel();
1306 context().dispatchDidFail(m_documentLoader, resource->identifier(), ResourceError(errorDomainBlinkInternal, 0, response.url().string(), "Original ur l check of ServiceWorker fetched resource failed."));
jochen (gone - plz use gerrit) 2014/07/24 14:37:26 the error message would leave me a bit confused ab
horo 2014/07/24 15:50:22 Done.
1307 return;
1308 }
1309 }
1303 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier( ), response, resource->loader()); 1310 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier( ), response, resource->loader());
1304 } 1311 }
1305 1312
1306 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data, int dataLength, int encodedDataLength) 1313 void ResourceFetcher::didReceiveData(const Resource* resource, const char* data, int dataLength, int encodedDataLength)
1307 { 1314 {
1308 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d ata, dataLength, encodedDataLength); 1315 context().dispatchDidReceiveData(m_documentLoader, resource->identifier(), d ata, dataLength, encodedDataLength);
1309 } 1316 }
1310 1317
1311 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength, int encodedDataLength) 1318 void ResourceFetcher::didDownloadData(const Resource* resource, int dataLength, int encodedDataLength)
1312 { 1319 {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 } 1516 }
1510 } 1517 }
1511 1518
1512 void ResourceFetcher::trace(Visitor* visitor) 1519 void ResourceFetcher::trace(Visitor* visitor)
1513 { 1520 {
1514 visitor->trace(m_document); 1521 visitor->trace(m_document);
1515 ResourceLoaderHost::trace(visitor); 1522 ResourceLoaderHost::trace(visitor);
1516 } 1523 }
1517 1524
1518 } 1525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698