| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 Loading... |
| 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 | 31 |
| 32 #include "core/loader/PingLoader.h" | 32 #include "core/loader/PingLoader.h" |
| 33 | 33 |
| 34 #include "core/dom/DOMArrayBufferView.h" | 34 #include "core/dom/DOMArrayBufferView.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/SecurityContext.h" |
| 36 #include "core/fetch/CrossOriginAccessControl.h" | 37 #include "core/fetch/CrossOriginAccessControl.h" |
| 37 #include "core/fetch/FetchContext.h" | 38 #include "core/fetch/FetchContext.h" |
| 38 #include "core/fetch/FetchInitiatorTypeNames.h" | 39 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 39 #include "core/fetch/FetchUtils.h" | 40 #include "core/fetch/FetchUtils.h" |
| 40 #include "core/fetch/ResourceFetcher.h" | 41 #include "core/fetch/ResourceFetcher.h" |
| 41 #include "core/fetch/UniqueIdentifier.h" | 42 #include "core/fetch/UniqueIdentifier.h" |
| 42 #include "core/fileapi/File.h" | 43 #include "core/fileapi/File.h" |
| 43 #include "core/frame/FrameConsole.h" | 44 #include "core/frame/FrameConsole.h" |
| 44 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
| 46 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 45 #include "core/html/FormData.h" | 47 #include "core/html/FormData.h" |
| 46 #include "core/inspector/ConsoleMessage.h" | 48 #include "core/inspector/ConsoleMessage.h" |
| 47 #include "core/inspector/InspectorInstrumentation.h" | 49 #include "core/inspector/InspectorInstrumentation.h" |
| 48 #include "core/inspector/InspectorTraceEvents.h" | 50 #include "core/inspector/InspectorTraceEvents.h" |
| 49 #include "core/loader/FrameLoader.h" | 51 #include "core/loader/FrameLoader.h" |
| 50 #include "core/loader/FrameLoaderClient.h" | 52 #include "core/loader/FrameLoaderClient.h" |
| 51 #include "core/loader/MixedContentChecker.h" | 53 #include "core/loader/MixedContentChecker.h" |
| 52 #include "core/page/Page.h" | 54 #include "core/page/Page.h" |
| 53 #include "platform/exported/WrappedResourceRequest.h" | 55 #include "platform/exported/WrappedResourceRequest.h" |
| 54 #include "platform/exported/WrappedResourceResponse.h" | 56 #include "platform/exported/WrappedResourceResponse.h" |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 AllowStoredCredentials, false); | 468 AllowStoredCredentials, false); |
| 467 } | 469 } |
| 468 | 470 |
| 469 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl
ink-auditing | 471 // http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperl
ink-auditing |
| 470 void PingLoader::sendLinkAuditPing(LocalFrame* frame, | 472 void PingLoader::sendLinkAuditPing(LocalFrame* frame, |
| 471 const KURL& pingURL, | 473 const KURL& pingURL, |
| 472 const KURL& destinationURL) { | 474 const KURL& destinationURL) { |
| 473 if (!pingURL.protocolIsInHTTPFamily()) | 475 if (!pingURL.protocolIsInHTTPFamily()) |
| 474 return; | 476 return; |
| 475 | 477 |
| 478 if (ContentSecurityPolicy* policy = |
| 479 frame->securityContext()->contentSecurityPolicy()) { |
| 480 if (!policy->allowConnectToSource(pingURL)) |
| 481 return; |
| 482 } |
| 483 |
| 476 ResourceRequest request(pingURL); | 484 ResourceRequest request(pingURL); |
| 477 request.setHTTPMethod(HTTPNames::POST); | 485 request.setHTTPMethod(HTTPNames::POST); |
| 478 request.setHTTPContentType("text/ping"); | 486 request.setHTTPContentType("text/ping"); |
| 479 request.setHTTPBody(EncodedFormData::create("PING")); | 487 request.setHTTPBody(EncodedFormData::create("PING")); |
| 480 request.setHTTPHeaderField(HTTPNames::Cache_Control, "max-age=0"); | 488 request.setHTTPHeaderField(HTTPNames::Cache_Control, "max-age=0"); |
| 481 finishPingRequestInitialization(request, frame, | 489 finishPingRequestInitialization(request, frame, |
| 482 WebURLRequest::RequestContextPing); | 490 WebURLRequest::RequestContextPing); |
| 483 | 491 |
| 484 // addAdditionalRequestHeaders() will have added a referrer for same origin | 492 // addAdditionalRequestHeaders() will have added a referrer for same origin |
| 485 // requests, but the spec omits the referrer. | 493 // requests, but the spec omits the referrer. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 bool PingLoader::sendBeacon(LocalFrame* frame, | 559 bool PingLoader::sendBeacon(LocalFrame* frame, |
| 552 int allowance, | 560 int allowance, |
| 553 const KURL& beaconURL, | 561 const KURL& beaconURL, |
| 554 Blob* data, | 562 Blob* data, |
| 555 int& payloadLength) { | 563 int& payloadLength) { |
| 556 BeaconBlob beacon(data); | 564 BeaconBlob beacon(data); |
| 557 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); | 565 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); |
| 558 } | 566 } |
| 559 | 567 |
| 560 } // namespace blink | 568 } // namespace blink |
| OLD | NEW |