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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 sendPingCommon(frame, request, FetchInitiatorTypeNames::ping, | 516 sendPingCommon(frame, request, FetchInitiatorTypeNames::ping, |
517 AllowStoredCredentials, false); | 517 AllowStoredCredentials, false); |
518 } | 518 } |
519 | 519 |
520 void PingLoader::sendViolationReport(LocalFrame* frame, | 520 void PingLoader::sendViolationReport(LocalFrame* frame, |
521 const KURL& reportURL, | 521 const KURL& reportURL, |
522 PassRefPtr<EncodedFormData> report, | 522 PassRefPtr<EncodedFormData> report, |
523 ViolationReportType type) { | 523 ViolationReportType type) { |
524 ResourceRequest request(reportURL); | 524 ResourceRequest request(reportURL); |
525 request.setHTTPMethod(HTTPNames::POST); | 525 request.setHTTPMethod(HTTPNames::POST); |
526 request.setHTTPContentType(type == ContentSecurityPolicyViolationReport | 526 switch (type) { |
527 ? "application/csp-report" | 527 case ContentSecurityPolicyViolationReport: |
528 : "application/json"); | 528 request.setHTTPContentType("application/csp-report"); |
| 529 break; |
| 530 case XSSAuditorViolationReport: |
| 531 request.setHTTPContentType("application/xss-auditor-report"); |
| 532 break; |
| 533 } |
529 request.setHTTPBody(std::move(report)); | 534 request.setHTTPBody(std::move(report)); |
530 finishPingRequestInitialization(request, frame, | 535 finishPingRequestInitialization(request, frame, |
531 WebURLRequest::RequestContextCSPReport); | 536 WebURLRequest::RequestContextCSPReport); |
532 | 537 |
533 StoredCredentials credentialsAllowed = | 538 StoredCredentials credentialsAllowed = |
534 SecurityOrigin::create(reportURL)->isSameSchemeHostPort( | 539 SecurityOrigin::create(reportURL)->isSameSchemeHostPort( |
535 frame->document()->getSecurityOrigin()) | 540 frame->document()->getSecurityOrigin()) |
536 ? AllowStoredCredentials | 541 ? AllowStoredCredentials |
537 : DoNotAllowStoredCredentials; | 542 : DoNotAllowStoredCredentials; |
538 sendPingCommon(frame, request, FetchInitiatorTypeNames::violationreport, | 543 sendPingCommon(frame, request, FetchInitiatorTypeNames::violationreport, |
(...skipping 30 matching lines...) Expand all Loading... |
569 bool PingLoader::sendBeacon(LocalFrame* frame, | 574 bool PingLoader::sendBeacon(LocalFrame* frame, |
570 int allowance, | 575 int allowance, |
571 const KURL& beaconURL, | 576 const KURL& beaconURL, |
572 Blob* data, | 577 Blob* data, |
573 int& payloadLength) { | 578 int& payloadLength) { |
574 BeaconBlob beacon(data); | 579 BeaconBlob beacon(data); |
575 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); | 580 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); |
576 } | 581 } |
577 | 582 |
578 } // namespace blink | 583 } // namespace blink |
OLD | NEW |