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

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

Issue 2177283006: Do not reuse opaque Resource from a service worker for non no-cors requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests, reflect comments 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // allow for this differing behavior. 689 // allow for this differing behavior.
690 // TODO(japhet): Can we get rid of one of these settings? 690 // TODO(japhet): Can we get rid of one of these settings?
691 if (existingResource->isImage() && !context().allowImage(m_imagesEnabled, ex istingResource->url())) 691 if (existingResource->isImage() && !context().allowImage(m_imagesEnabled, ex istingResource->url()))
692 return Reload; 692 return Reload;
693 693
694 // Never use cache entries for downloadToFile / useStreamOnResponse 694 // Never use cache entries for downloadToFile / useStreamOnResponse
695 // requests. The data will be delivered through other paths. 695 // requests. The data will be delivered through other paths.
696 if (request.downloadToFile() || request.useStreamOnResponse()) 696 if (request.downloadToFile() || request.useStreamOnResponse())
697 return Reload; 697 return Reload;
698 698
699 // Never reuse opaque responses from a service worker for requests that
700 // are not no-cors. https://crbug.com/625575
701 if (existingResource->response().wasFetchedViaServiceWorker() && existingRes ource->response().serviceWorkerResponseType() == WebServiceWorkerResponseTypeOpa que && request.fetchRequestMode() != WebURLRequest::FetchRequestModeNoCORS)
702 return Reload;
703
699 // If resource was populated from a SubstituteData load or data: url, use it . 704 // If resource was populated from a SubstituteData load or data: url, use it .
700 if (isStaticData) 705 if (isStaticData)
701 return Use; 706 return Use;
702 707
703 if (!existingResource->canReuse(request)) 708 if (!existingResource->canReuse(request))
704 return Reload; 709 return Reload;
705 710
706 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation. 711 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation.
707 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch 712 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch
708 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead. 713 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead.
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 visitor->trace(m_context); 1316 visitor->trace(m_context);
1312 visitor->trace(m_archive); 1317 visitor->trace(m_archive);
1313 visitor->trace(m_loaders); 1318 visitor->trace(m_loaders);
1314 visitor->trace(m_nonBlockingLoaders); 1319 visitor->trace(m_nonBlockingLoaders);
1315 visitor->trace(m_documentResources); 1320 visitor->trace(m_documentResources);
1316 visitor->trace(m_preloads); 1321 visitor->trace(m_preloads);
1317 visitor->trace(m_resourceTimingInfoMap); 1322 visitor->trace(m_resourceTimingInfoMap);
1318 } 1323 }
1319 1324
1320 } // namespace blink 1325 } // 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