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

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

Issue 2241743002: Do not reuse opaque Resource from a service worker for non no-cors requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 // allow for this differing behavior. 683 // allow for this differing behavior.
684 // TODO(japhet): Can we get rid of one of these settings? 684 // TODO(japhet): Can we get rid of one of these settings?
685 if (existingResource->isImage() && !context().allowImage(m_imagesEnabled, ex istingResource->url())) 685 if (existingResource->isImage() && !context().allowImage(m_imagesEnabled, ex istingResource->url()))
686 return Reload; 686 return Reload;
687 687
688 // Never use cache entries for downloadToFile / useStreamOnResponse 688 // Never use cache entries for downloadToFile / useStreamOnResponse
689 // requests. The data will be delivered through other paths. 689 // requests. The data will be delivered through other paths.
690 if (request.downloadToFile() || request.useStreamOnResponse()) 690 if (request.downloadToFile() || request.useStreamOnResponse())
691 return Reload; 691 return Reload;
692 692
693 // Never reuse opaque responses from a service worker for requests that
694 // are not no-cors. https://crbug.com/625575
695 if (existingResource->response().wasFetchedViaServiceWorker() && existingRes ource->response().serviceWorkerResponseType() == WebServiceWorkerResponseTypeOpa que && request.fetchRequestMode() != WebURLRequest::FetchRequestModeNoCORS)
696 return Reload;
697
693 // If resource was populated from a SubstituteData load or data: url, use it . 698 // If resource was populated from a SubstituteData load or data: url, use it .
694 if (isStaticData) 699 if (isStaticData)
695 return Use; 700 return Use;
696 701
697 if (!existingResource->canReuse(request)) 702 if (!existingResource->canReuse(request))
698 return Reload; 703 return Reload;
699 704
700 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation. 705 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation.
701 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch 706 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch
702 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead. 707 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead.
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 visitor->trace(m_context); 1268 visitor->trace(m_context);
1264 visitor->trace(m_archive); 1269 visitor->trace(m_archive);
1265 visitor->trace(m_loaders); 1270 visitor->trace(m_loaders);
1266 visitor->trace(m_nonBlockingLoaders); 1271 visitor->trace(m_nonBlockingLoaders);
1267 visitor->trace(m_documentResources); 1272 visitor->trace(m_documentResources);
1268 visitor->trace(m_preloads); 1273 visitor->trace(m_preloads);
1269 visitor->trace(m_resourceTimingInfoMap); 1274 visitor->trace(m_resourceTimingInfoMap);
1270 } 1275 }
1271 1276
1272 } // namespace blink 1277 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/opaque-response-in-memorycache-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698