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

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

Issue 2400723005: Revert 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.
768 // 769 //
769 // This is necessary because ScriptResource and CSSStyleSheetResource objects 770 // This is necessary because ScriptResource objects do not keep the raw data
770 // do not keep the raw data around after the source is accessed once, so if 771 // around after the source is accessed once, so if the resource is accessed
771 // the resource is accessed from the MemoryCache for a second time, there is 772 // from the MemoryCache for a second time, there is no way to redo an
772 // no way to redo an integrity check. 773 // integrity check.
773 // 774 //
774 // Thus, Blink implements a scheme where it caches the integrity information 775 // Thus, Blink implements a scheme where it caches the integrity information
775 // for those resources after the first time it is checked, and if there is 776 // for a ScriptResource after the first time it is checked, and if there is
776 // another request for that resource, with the same integrity metadata, Blink 777 // another request for that resource, with the same integrity metadata, Blink
777 // skips the integrity calculation. However, if the integrity metadata is a 778 // skips the integrity calculation. However, if the integrity metadata is a
778 // mismatch, the MemoryCache must be skipped here, and a new request for the 779 // mismatch, the MemoryCache must be skipped here, and a new request for the
779 // resource must be made to get the raw data. This is expected to be an 780 // resource must be made to get the raw data. This is expected to be an
780 // uncommon case, however, as it implies two same-origin requests to the same 781 // uncommon case, however, as it implies two same-origin requests to the same
781 // resource, but with different integrity metadata. 782 // resource, but with different integrity metadata.
782 RecordSriResourceIntegrityMismatchEvent(CheckingForIntegrityMismatch); 783 RecordSriResourceIntegrityMismatchEvent(CheckingForIntegrityMismatch);
783 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) { 784 if (existingResource->mustRefetchDueToIntegrityMetadata(fetchRequest)) {
784 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch); 785 RecordSriResourceIntegrityMismatchEvent(RefetchDueToIntegrityMismatch);
785 return Reload; 786 return Reload;
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 visitor->trace(m_context); 1593 visitor->trace(m_context);
1593 visitor->trace(m_archive); 1594 visitor->trace(m_archive);
1594 visitor->trace(m_loaders); 1595 visitor->trace(m_loaders);
1595 visitor->trace(m_nonBlockingLoaders); 1596 visitor->trace(m_nonBlockingLoaders);
1596 visitor->trace(m_documentResources); 1597 visitor->trace(m_documentResources);
1597 visitor->trace(m_preloads); 1598 visitor->trace(m_preloads);
1598 visitor->trace(m_resourceTimingInfoMap); 1599 visitor->trace(m_resourceTimingInfoMap);
1599 } 1600 }
1600 1601
1601 } // namespace blink 1602 } // 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