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

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

Issue 2398733005: Reland of Cache SubResourceIntegrity checks at Resource (patchset #2 id:20001 of https://codereview… (Closed)
Patch Set: Created 4 years, 2 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 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 7 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 ResourceFetcher::determineRevalidationPolicy(Resource::Type type, 758 ResourceFetcher::determineRevalidationPolicy(Resource::Type type,
759 const FetchRequest& fetchRequest, 759 const FetchRequest& fetchRequest,
760 Resource* existingResource, 760 Resource* existingResource,
761 bool isStaticData) const { 761 bool isStaticData) const {
762 const ResourceRequest& request = fetchRequest.resourceRequest(); 762 const ResourceRequest& request = fetchRequest.resourceRequest();
763 763
764 if (!existingResource) 764 if (!existingResource)
765 return Load; 765 return Load;
766 766
767 // Checks if the resource has an explicit policy about integrity metadata. 767 // Checks if the resource has an explicit policy about integrity metadata.
768 // Currently only applies to ScriptResources.
769 // 768 //
770 // This is necessary because ScriptResource objects do not keep the raw data 769 // This is necessary because ScriptResource and CSSStyleSheetResource objects
771 // around after the source is accessed once, so if the resource is accessed 770 // do not keep the raw data around after the source is accessed once, so if
772 // from the MemoryCache for a second time, there is no way to redo an 771 // the resource is accessed from the MemoryCache for a second time, there is
773 // integrity check. 772 // no way to redo an integrity check.
774 // 773 //
775 // Thus, Blink implements a scheme where it caches the integrity information 774 // Thus, Blink implements a scheme where it caches the integrity information
776 // for a ScriptResource after the first time it is checked, and if there is 775 // for those resources after the first time it is checked, and if there is
777 // another request for that resource, with the same integrity metadata, Blink 776 // another request for that resource, with the same integrity metadata, Blink
778 // skips the integrity calculation. However, if the integrity metadata is a 777 // skips the integrity calculation. However, if the integrity metadata is a
779 // mismatch, the MemoryCache must be skipped here, and a new request for the 778 // mismatch, the MemoryCache must be skipped here, and a new request for the
780 // resource must be made to get the raw data. This is expected to be an 779 // resource must be made to get the raw data. This is expected to be an
781 // uncommon case, however, as it implies two same-origin requests to the same 780 // uncommon case, however, as it implies two same-origin requests to the same
782 // resource, but with different integrity metadata. 781 // resource, but with different integrity metadata.
783 RecordSriResourceIntegrityMismatchEvent(CheckingForIntegrityMismatch); 782 RecordSriResourceIntegrityMismatchEvent(CheckingForIntegrityMismatch);
784 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) { 783 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) {
785 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch); 784 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch);
786 return Reload; 785 return Reload;
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 visitor->trace(m_context); 1592 visitor->trace(m_context);
1594 visitor->trace(m_archive); 1593 visitor->trace(m_archive);
1595 visitor->trace(m_loaders); 1594 visitor->trace(m_loaders);
1596 visitor->trace(m_nonBlockingLoaders); 1595 visitor->trace(m_nonBlockingLoaders);
1597 visitor->trace(m_documentResources); 1596 visitor->trace(m_documentResources);
1598 visitor->trace(m_preloads); 1597 visitor->trace(m_preloads);
1599 visitor->trace(m_resourceTimingInfoMap); 1598 visitor->trace(m_resourceTimingInfoMap);
1600 } 1599 }
1601 1600
1602 } // namespace blink 1601 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.cpp ('k') | third_party/WebKit/Source/core/fetch/ScriptResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698