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

Side by Side Diff: third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp

Issue 1723353002: Add deprecation message for AppCache in insecure contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase on ToT Created 4 years, 9 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/loader/appcache/ApplicationCacheHost.h" 31 #include "core/loader/appcache/ApplicationCacheHost.h"
32 32
33 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 33 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
34 #include "core/events/ApplicationCacheErrorEvent.h" 34 #include "core/events/ApplicationCacheErrorEvent.h"
35 #include "core/events/ProgressEvent.h" 35 #include "core/events/ProgressEvent.h"
36 #include "core/frame/Deprecation.h"
36 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
38 #include "core/frame/OriginsUsingFeatures.h"
37 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/frame/UseCounter.h"
38 #include "core/inspector/InspectorApplicationCacheAgent.h" 41 #include "core/inspector/InspectorApplicationCacheAgent.h"
39 #include "core/inspector/InspectorInstrumentation.h" 42 #include "core/inspector/InspectorInstrumentation.h"
40 #include "core/loader/DocumentLoader.h" 43 #include "core/loader/DocumentLoader.h"
41 #include "core/loader/FrameLoader.h" 44 #include "core/loader/FrameLoader.h"
42 #include "core/loader/FrameLoaderClient.h" 45 #include "core/loader/FrameLoaderClient.h"
43 #include "core/loader/appcache/ApplicationCache.h" 46 #include "core/loader/appcache/ApplicationCache.h"
44 #include "core/page/FrameTree.h" 47 #include "core/page/FrameTree.h"
45 #include "core/page/Page.h" 48 #include "core/page/Page.h"
46 #include "platform/exported/WrappedResourceRequest.h" 49 #include "platform/exported/WrappedResourceRequest.h"
47 #include "platform/exported/WrappedResourceResponse.h" 50 #include "platform/exported/WrappedResourceResponse.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 111 }
109 112
110 void ApplicationCacheHost::selectCacheWithoutManifest() 113 void ApplicationCacheHost::selectCacheWithoutManifest()
111 { 114 {
112 if (m_host) 115 if (m_host)
113 m_host->selectCacheWithoutManifest(); 116 m_host->selectCacheWithoutManifest();
114 } 117 }
115 118
116 void ApplicationCacheHost::selectCacheWithManifest(const KURL& manifestURL) 119 void ApplicationCacheHost::selectCacheWithManifest(const KURL& manifestURL)
117 { 120 {
121 DCHECK(m_documentLoader);
122
123 LocalFrame* frame = m_documentLoader->frame();
124 Document* document = frame->document();
125 if (document->isSecureContext()) {
126 UseCounter::count(document, UseCounter::ApplicationCacheManifestSelectSe cureOrigin);
127 UseCounter::countCrossOriginIframe(*document, UseCounter::ApplicationCac heManifestSelectSecureOrigin);
128 } else {
129 Deprecation::countDeprecation(document, UseCounter::ApplicationCacheMani festSelectInsecureOrigin);
130 UseCounter::countCrossOriginIframe(*document, UseCounter::ApplicationCac heManifestSelectInsecureOrigin);
jochen (gone - plz use gerrit) 2016/02/29 15:44:42 This hits ASSERT(Deprecation::deprecationMessage(f
jww 2016/03/01 19:55:02 Yikes, thanks. It appears that I also did this for
131 OriginsUsingFeatures::countAnyWorld(*document, OriginsUsingFeatures::Fea ture::ApplicationCacheManifestSelectInsecureOrigin);
132 }
118 if (m_host && !m_host->selectCacheWithManifest(manifestURL)) { 133 if (m_host && !m_host->selectCacheWithManifest(manifestURL)) {
119 // It's a foreign entry, restart the current navigation from the top 134 // It's a foreign entry, restart the current navigation from the top
120 // of the navigation algorithm. The navigation will not result in the 135 // of the navigation algorithm. The navigation will not result in the
121 // same resource being loaded, because "foreign" entries are never picke d 136 // same resource being loaded, because "foreign" entries are never picke d
122 // during navigation. 137 // during navigation.
123 // see ApplicationCacheGroup::selectCache() 138 // see ApplicationCacheGroup::selectCache()
124 LocalFrame* frame = m_documentLoader->frame(); 139 frame->navigate(*document, document->url(), true, UserGestureStatus::Non e);
125 frame->navigate(*frame->document(), frame->document()->url(), true, User GestureStatus::None);
126 } 140 }
127 } 141 }
128 142
129 void ApplicationCacheHost::didReceiveResponseForMainResource(const ResourceRespo nse& response) 143 void ApplicationCacheHost::didReceiveResponseForMainResource(const ResourceRespo nse& response)
130 { 144 {
131 if (m_host) { 145 if (m_host) {
132 WrappedResourceResponse wrapped(response); 146 WrappedResourceResponse wrapped(response);
133 m_host->didReceiveResponseForMainResource(wrapped); 147 m_host->didReceiveResponseForMainResource(wrapped);
134 } 148 }
135 } 149 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 notifyApplicationCache(ERROR_EVENT, 0, 0, reason, url.string(), status, mess age); 304 notifyApplicationCache(ERROR_EVENT, 0, 0, reason, url.string(), status, mess age);
291 } 305 }
292 306
293 DEFINE_TRACE(ApplicationCacheHost) 307 DEFINE_TRACE(ApplicationCacheHost)
294 { 308 {
295 visitor->trace(m_domApplicationCache); 309 visitor->trace(m_domApplicationCache);
296 visitor->trace(m_documentLoader); 310 visitor->trace(m_documentLoader);
297 } 311 }
298 312
299 } // namespace blink 313 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/appcache/ApplicationCache.cpp ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698