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

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

Issue 1303833002: Add WebPageImportanceSignals::issuedNonGetFetchFromScript() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: m_document\.page() not ->page() Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 30 matching lines...) Expand all
41 #include "core/frame/FrameConsole.h" 41 #include "core/frame/FrameConsole.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/csp/ContentSecurityPolicy.h" 43 #include "core/frame/csp/ContentSecurityPolicy.h"
44 #include "core/inspector/InspectorInstrumentation.h" 44 #include "core/inspector/InspectorInstrumentation.h"
45 #include "core/inspector/InspectorTraceEvents.h" 45 #include "core/inspector/InspectorTraceEvents.h"
46 #include "core/loader/CrossOriginPreflightResultCache.h" 46 #include "core/loader/CrossOriginPreflightResultCache.h"
47 #include "core/loader/DocumentThreadableLoaderClient.h" 47 #include "core/loader/DocumentThreadableLoaderClient.h"
48 #include "core/loader/FrameLoader.h" 48 #include "core/loader/FrameLoader.h"
49 #include "core/loader/FrameLoaderClient.h" 49 #include "core/loader/FrameLoaderClient.h"
50 #include "core/loader/ThreadableLoaderClient.h" 50 #include "core/loader/ThreadableLoaderClient.h"
51 #include "core/page/ChromeClient.h"
52 #include "core/page/Page.h"
51 #include "platform/SharedBuffer.h" 53 #include "platform/SharedBuffer.h"
52 #include "platform/Task.h" 54 #include "platform/Task.h"
53 #include "platform/network/ResourceRequest.h" 55 #include "platform/network/ResourceRequest.h"
54 #include "platform/weborigin/SchemeRegistry.h" 56 #include "platform/weborigin/SchemeRegistry.h"
55 #include "platform/weborigin/SecurityOrigin.h" 57 #include "platform/weborigin/SecurityOrigin.h"
56 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
57 #include "public/platform/WebURLRequest.h" 59 #include "public/platform/WebURLRequest.h"
58 #include "wtf/Assertions.h" 60 #include "wtf/Assertions.h"
59 61
60 namespace blink { 62 namespace blink {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 m_requestStartedSeconds = monotonicallyIncreasingTime(); 157 m_requestStartedSeconds = monotonicallyIncreasingTime();
156 158
157 // Save any CORS simple headers on the request here. If this request redirec ts cross-origin, we cancel the old request 159 // Save any CORS simple headers on the request here. If this request redirec ts cross-origin, we cancel the old request
158 // create a new one, and copy these headers. 160 // create a new one, and copy these headers.
159 const HTTPHeaderMap& headerMap = request.httpHeaderFields(); 161 const HTTPHeaderMap& headerMap = request.httpHeaderFields();
160 for (const auto& header : headerMap) { 162 for (const auto& header : headerMap) {
161 if (FetchUtils::isSimpleHeader(header.key, header.value)) 163 if (FetchUtils::isSimpleHeader(header.key, header.value))
162 m_simpleRequestHeaders.add(header.key, header.value); 164 m_simpleRequestHeaders.add(header.key, header.value);
163 } 165 }
164 166
167 // DocumentThreadableLoader is used by all javascript initiated fetch, so
168 // we use this chance to record non-GET fetch script requests.
169 // However, this is based on the following assumptions, so please be careful
170 // when adding similar logic:
171 // - ThreadableLoader is used as backend for all javascript initiated networ k
172 // fetches.
173 // - Note that ThreadableLoader is also used for non-network fetch such as
174 // FileReaderLoader. However it emulates GET method so signal is not
175 // recorded here.
176 // - ThreadableLoader w/ non-GET request is only created from javascript
177 // initiated fetch.
178 // - Some non-script initiated fetches such as WorkerScriptLoader also use
179 // ThreadableLoader, but they are guaranteed to use GET method.
180 if (request.httpMethod() != "GET") {
181 if (Page* page = m_document.page())
182 page->chromeClient().didObserveNonGetFetchFromScript();
183 }
184
165 // If the fetch request will be handled by the ServiceWorker, the 185 // If the fetch request will be handled by the ServiceWorker, the
166 // FetchRequestMode of the request must be FetchRequestModeCORS or 186 // FetchRequestMode of the request must be FetchRequestModeCORS or
167 // FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can 187 // FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can
168 // return a opaque response which is from the other origin site and the 188 // return a opaque response which is from the other origin site and the
169 // script in the page can read the content. 189 // script in the page can read the content.
170 // 190 //
171 // We assume that ServiceWorker is skipped for sync requests and non-HTTP 191 // We assume that ServiceWorker is skipped for sync requests and non-HTTP
172 // familiy requests by content/ code. 192 // familiy requests by content/ code.
173 if (m_async && !request.skipServiceWorker() && request.url().protocolIsInHTT PFamily() && m_document.fetcher()->isControlledByServiceWorker()) { 193 if (m_async && !request.skipServiceWorker() && request.url().protocolIsInHTT PFamily() && m_document.fetcher()->isControlledByServiceWorker()) {
174 ResourceRequest newRequest(request); 194 ResourceRequest newRequest(request);
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 return DoNotAllowStoredCredentials; 865 return DoNotAllowStoredCredentials;
846 return m_resourceLoaderOptions.allowCredentials; 866 return m_resourceLoaderOptions.allowCredentials;
847 } 867 }
848 868
849 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 869 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
850 { 870 {
851 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); 871 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin ();
852 } 872 }
853 873
854 } // namespace blink 874 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698