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

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

Issue 732003002: Use the request URL as the URL of the resources which are fetched ServiceWorker [3/3 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1340
1341 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo) 1341 void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& in itiatorInfo)
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.
yhirano 2014/11/19 04:06:21 Can you add a comment here that this check aims no
horo 2014/11/19 04:55:59 Done.
1351 if (response.wasFetchedViaServiceWorker()) { 1351 if (response.wasFetchedViaServiceWorker()) {
1352 KURL originalURL = response.url(); 1352 const KURL& originalURL = response.originalURLViaServiceWorker();
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 if (!canRequest(resource->type(), resource->resourceRequest(), originalU RL, resource->options(), false, FetchRequest::UseDefaultOriginRestrictionForType )) {
1357 resource->loader()->cancel(); 1354 resource->loader()->cancel();
1358 bool isInternalRequest = resource->options().initiatorInfo.name == F etchInitiatorTypeNames::internal; 1355 bool isInternalRequest = resource->options().initiatorInfo.name == F etchInitiatorTypeNames::internal;
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 context().dispatchDidFail(m_documentLoader, resource->identifier(), ResourceError(errorDomainBlinkInternal, 0, originalURL.string(), "Unsafe attempt to load URL " + originalURL.elidedString() + " fetched by a ServiceWorker."), i sInternalRequest);
1360 return; 1357 return;
1361 } 1358 }
1362 } 1359 }
1363 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier( ), response, resource->loader()); 1360 context().dispatchDidReceiveResponse(m_documentLoader, resource->identifier( ), response, resource->loader());
1364 } 1361 }
1365 1362
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 1573
1577 void ResourceFetcher::trace(Visitor* visitor) 1574 void ResourceFetcher::trace(Visitor* visitor)
1578 { 1575 {
1579 visitor->trace(m_document); 1576 visitor->trace(m_document);
1580 visitor->trace(m_loaders); 1577 visitor->trace(m_loaders);
1581 visitor->trace(m_multipartLoaders); 1578 visitor->trace(m_multipartLoaders);
1582 ResourceLoaderHost::trace(visitor); 1579 ResourceLoaderHost::trace(visitor);
1583 } 1580 }
1584 1581
1585 } 1582 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698