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

Side by Side Diff: Source/core/loader/cache/CachedResourceLoader.h

Issue 14949017: Implementation of W3C compliant CSP script-src nonce. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed broken nonce behavior on script redirects. Added test for redirects as well. Created 7 years, 7 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void incrementRequestCount(const CachedResource*); 118 void incrementRequestCount(const CachedResource*);
119 void decrementRequestCount(const CachedResource*); 119 void decrementRequestCount(const CachedResource*);
120 int requestCount() const { return m_requestCount; } 120 int requestCount() const { return m_requestCount; }
121 121
122 bool isPreloaded(const String& urlString) const; 122 bool isPreloaded(const String& urlString) const;
123 void clearPreloads(); 123 void clearPreloads();
124 void clearPendingPreloads(); 124 void clearPendingPreloads();
125 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha rset); 125 void preload(CachedResource::Type, CachedResourceRequest&, const String& cha rset);
126 void checkForPendingPreloads(); 126 void checkForPendingPreloads();
127 void printPreloadStats(); 127 void printPreloadStats();
128 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false); 128 bool canRequest(CachedResource::Type, const KURL&, bool validNonce, bool for Preload = false);
abarth-chromium 2013/05/16 00:59:27 Why not pass the enum here instead of the bool?
jww 2013/05/16 20:59:00 Done.
129 129
130 void reportMemoryUsage(MemoryObjectInfo*) const; 130 void reportMemoryUsage(MemoryObjectInfo*) const;
131 131
132 static const ResourceLoaderOptions& defaultCachedResourceOptions(); 132 static const ResourceLoaderOptions& defaultCachedResourceOptions();
133 133
134 private: 134 private:
135 explicit CachedResourceLoader(DocumentLoader*); 135 explicit CachedResourceLoader(DocumentLoader*);
136 136
137 CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, C achedResourceRequest&); 137 CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, C achedResourceRequest&);
138 CachedResourceHandle<CachedResource> revalidateResource(const CachedResource Request&, CachedResource*); 138 CachedResourceHandle<CachedResource> revalidateResource(const CachedResource Request&, CachedResource*);
139 CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, Cach edResourceRequest&, const String& charset); 139 CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, Cach edResourceRequest&, const String& charset);
140 void storeResourceTimingInitiatorInformation(const CachedResourceHandle<Cach edResource>&, const CachedResourceRequest&); 140 void storeResourceTimingInitiatorInformation(const CachedResourceHandle<Cach edResource>&, const CachedResourceRequest&);
141 void requestPreload(CachedResource::Type, CachedResourceRequest&, const Stri ng& charset); 141 void requestPreload(CachedResource::Type, CachedResourceRequest&, const Stri ng& charset);
142 142
143 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; 143 enum RevalidationPolicy { Use, Revalidate, Reload, Load };
144 RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, Resourc eRequest&, bool forPreload, CachedResource* existingResource, CachedResourceRequ est::DeferOption) const; 144 RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, Resourc eRequest&, bool forPreload, CachedResource* existingResource, CachedResourceRequ est::DeferOption) const;
145 145
146 void notifyLoadedFromMemoryCache(CachedResource*); 146 void notifyLoadedFromMemoryCache(CachedResource*);
147 bool checkInsecureContent(CachedResource::Type, const KURL&) const; 147 bool checkInsecureContent(CachedResource::Type, const KURL&) const;
148 148
149 bool checkNonceFromInitiatorElement(const Element* initiatorElement);
150
149 void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*) ; 151 void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*) ;
150 void performPostLoadActions(); 152 void performPostLoadActions();
151 153
152 bool clientDefersImage(const KURL&) const; 154 bool clientDefersImage(const KURL&) const;
153 void reloadImagesIfNotDeferred(); 155 void reloadImagesIfNotDeferred();
154 156
155 HashSet<String> m_validatedURLs; 157 HashSet<String> m_validatedURLs;
156 mutable DocumentResourceMap m_documentResources; 158 mutable DocumentResourceMap m_documentResources;
157 Document* m_document; 159 Document* m_document;
158 DocumentLoader* m_documentLoader; 160 DocumentLoader* m_documentLoader;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 m_loader->m_allowStaleResources = m_previousState; 202 m_loader->m_allowStaleResources = m_previousState;
201 } 203 }
202 private: 204 private:
203 CachedResourceLoader* m_loader; 205 CachedResourceLoader* m_loader;
204 bool m_previousState; 206 bool m_previousState;
205 }; 207 };
206 208
207 } // namespace WebCore 209 } // namespace WebCore
208 210
209 #endif 211 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698