| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "core/loader/DocumentThreadableLoader.h" | 32 #include "core/loader/DocumentThreadableLoader.h" |
| 33 | 33 |
| 34 #include <memory> | 34 #include <memory> |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/TaskRunnerHelper.h" | 36 #include "core/dom/TaskRunnerHelper.h" |
| 37 #include "core/frame/FrameConsole.h" | 37 #include "core/frame/FrameConsole.h" |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/frame/LocalFrameClient.h" | 39 #include "core/frame/LocalFrameClient.h" |
| 40 #include "core/inspector/InspectorNetworkAgent.h" | |
| 41 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
| 42 #include "core/loader/DocumentThreadableLoaderClient.h" | 41 #include "core/loader/DocumentThreadableLoaderClient.h" |
| 43 #include "core/loader/FrameLoader.h" | 42 #include "core/loader/FrameLoader.h" |
| 44 #include "core/loader/ThreadableLoaderClient.h" | 43 #include "core/loader/ThreadableLoaderClient.h" |
| 45 #include "core/loader/ThreadableLoadingContext.h" | 44 #include "core/loader/ThreadableLoadingContext.h" |
| 46 #include "core/loader/private/CrossOriginPreflightResultCache.h" | 45 #include "core/loader/private/CrossOriginPreflightResultCache.h" |
| 47 #include "core/page/ChromeClient.h" | 46 #include "core/page/ChromeClient.h" |
| 48 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
| 49 #include "core/probe/CoreProbes.h" | 48 #include "core/probe/CoreProbes.h" |
| 50 #include "platform/SharedBuffer.h" | 49 #include "platform/SharedBuffer.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Explicitly set the ServiceWorkerMode to None here. Although the page is | 379 // Explicitly set the ServiceWorkerMode to None here. Although the page is |
| 381 // not controlled by a SW at this point, a new SW may be controlling the | 380 // not controlled by a SW at this point, a new SW may be controlling the |
| 382 // page when this request gets sent later. We should not send the actual | 381 // page when this request gets sent later. We should not send the actual |
| 383 // request to the SW. https://crbug.com/604583 | 382 // request to the SW. https://crbug.com/604583 |
| 384 // Similarly we don't want any requests that could involve a CORS preflight | 383 // Similarly we don't want any requests that could involve a CORS preflight |
| 385 // to get intercepted by a foreign fetch service worker, even if we have the | 384 // to get intercepted by a foreign fetch service worker, even if we have the |
| 386 // result of the preflight cached already. https://crbug.com/674370 | 385 // result of the preflight cached already. https://crbug.com/674370 |
| 387 crossOriginRequest.setServiceWorkerMode( | 386 crossOriginRequest.setServiceWorkerMode( |
| 388 WebURLRequest::ServiceWorkerMode::None); | 387 WebURLRequest::ServiceWorkerMode::None); |
| 389 | 388 |
| 390 bool shouldForcePreflight = request.isExternalRequest(); | 389 bool shouldForcePreflight = request.isExternalRequest() || |
| 391 if (!shouldForcePreflight) | 390 probe::shouldForceCORSPreflight(document()); |
| 392 probe::shouldForceCORSPreflight(document(), &shouldForcePreflight); | |
| 393 bool canSkipPreflight = | 391 bool canSkipPreflight = |
| 394 CrossOriginPreflightResultCache::shared().canSkipPreflight( | 392 CrossOriginPreflightResultCache::shared().canSkipPreflight( |
| 395 getSecurityOrigin()->toString(), crossOriginRequest.url(), | 393 getSecurityOrigin()->toString(), crossOriginRequest.url(), |
| 396 effectiveAllowCredentials(), crossOriginRequest.httpMethod(), | 394 effectiveAllowCredentials(), crossOriginRequest.httpMethod(), |
| 397 crossOriginRequest.httpHeaderFields()); | 395 crossOriginRequest.httpHeaderFields()); |
| 398 if (canSkipPreflight && !shouldForcePreflight) { | 396 if (canSkipPreflight && !shouldForcePreflight) { |
| 399 prepareCrossOriginRequest(crossOriginRequest); | 397 prepareCrossOriginRequest(crossOriginRequest); |
| 400 loadRequest(crossOriginRequest, crossOriginOptions); | 398 loadRequest(crossOriginRequest, crossOriginOptions); |
| 401 } else { | 399 } else { |
| 402 ResourceRequest preflightRequest = | 400 ResourceRequest preflightRequest = |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 } | 1144 } |
| 1147 | 1145 |
| 1148 DEFINE_TRACE(DocumentThreadableLoader) { | 1146 DEFINE_TRACE(DocumentThreadableLoader) { |
| 1149 visitor->trace(m_resource); | 1147 visitor->trace(m_resource); |
| 1150 visitor->trace(m_loadingContext); | 1148 visitor->trace(m_loadingContext); |
| 1151 ThreadableLoader::trace(visitor); | 1149 ThreadableLoader::trace(visitor); |
| 1152 RawResourceClient::trace(visitor); | 1150 RawResourceClient::trace(visitor); |
| 1153 } | 1151 } |
| 1154 | 1152 |
| 1155 } // namespace blink | 1153 } // namespace blink |
| OLD | NEW |