| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 DCHECK(!redirectResponse.isNull()); | 309 DCHECK(!redirectResponse.isNull()); |
| 310 | 310 |
| 311 String errorDescription; | 311 String errorDescription; |
| 312 ResourceLoaderOptions options; | 312 ResourceLoaderOptions options; |
| 313 // TODO(tyoshino): Save updated data in options.securityOrigin and pass it | 313 // TODO(tyoshino): Save updated data in options.securityOrigin and pass it |
| 314 // on the next time. | 314 // on the next time. |
| 315 if (!CrossOriginAccessControl::handleRedirect( | 315 if (!CrossOriginAccessControl::handleRedirect( |
| 316 m_origin, newRequest, redirectResponse, AllowStoredCredentials, | 316 m_origin, newRequest, redirectResponse, AllowStoredCredentials, |
| 317 options, errorDescription)) { | 317 options, errorDescription)) { |
| 318 if (LocalFrame* localFrame = frame()) { | 318 if (LocalFrame* localFrame = frame()) { |
| 319 if (localFrame->document()) | 319 if (localFrame->document()) { |
| 320 localFrame->document()->addConsoleMessage(ConsoleMessage::create( | 320 localFrame->document()->addConsoleMessage(ConsoleMessage::create( |
| 321 JSMessageSource, ErrorMessageLevel, errorDescription)); | 321 JSMessageSource, ErrorMessageLevel, errorDescription)); |
| 322 } |
| 322 } | 323 } |
| 323 // Cancel the load and self destruct. | 324 // Cancel the load and self destruct. |
| 324 dispose(); | 325 dispose(); |
| 325 | 326 |
| 326 return false; | 327 return false; |
| 327 } | 328 } |
| 328 // FIXME: http://crbug.com/427429 is needed to correctly propagate updates of | 329 // FIXME: http://crbug.com/427429 is needed to correctly propagate updates of |
| 329 // Origin: following this successful redirect. | 330 // Origin: following this successful redirect. |
| 330 | 331 |
| 331 return true; | 332 return true; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 484 |
| 484 // addAdditionalRequestHeaders() will have added a referrer for same origin | 485 // addAdditionalRequestHeaders() will have added a referrer for same origin |
| 485 // requests, but the spec omits the referrer. | 486 // requests, but the spec omits the referrer. |
| 486 request.clearHTTPReferrer(); | 487 request.clearHTTPReferrer(); |
| 487 | 488 |
| 488 request.setHTTPHeaderField(HTTPNames::Ping_To, | 489 request.setHTTPHeaderField(HTTPNames::Ping_To, |
| 489 AtomicString(destinationURL.getString())); | 490 AtomicString(destinationURL.getString())); |
| 490 | 491 |
| 491 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); | 492 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); |
| 492 if (protocolIs(frame->document()->url().getString(), "http") || | 493 if (protocolIs(frame->document()->url().getString(), "http") || |
| 493 frame->document()->getSecurityOrigin()->canAccess(pingOrigin.get())) | 494 frame->document()->getSecurityOrigin()->canAccess(pingOrigin.get())) { |
| 494 request.setHTTPHeaderField( | 495 request.setHTTPHeaderField( |
| 495 HTTPNames::Ping_From, | 496 HTTPNames::Ping_From, |
| 496 AtomicString(frame->document()->url().getString())); | 497 AtomicString(frame->document()->url().getString())); |
| 498 } |
| 497 | 499 |
| 498 sendPingCommon(frame, request, FetchInitiatorTypeNames::ping, | 500 sendPingCommon(frame, request, FetchInitiatorTypeNames::ping, |
| 499 AllowStoredCredentials, false); | 501 AllowStoredCredentials, false); |
| 500 } | 502 } |
| 501 | 503 |
| 502 void PingLoader::sendViolationReport(LocalFrame* frame, | 504 void PingLoader::sendViolationReport(LocalFrame* frame, |
| 503 const KURL& reportURL, | 505 const KURL& reportURL, |
| 504 PassRefPtr<EncodedFormData> report, | 506 PassRefPtr<EncodedFormData> report, |
| 505 ViolationReportType type) { | 507 ViolationReportType type) { |
| 506 ResourceRequest request(reportURL); | 508 ResourceRequest request(reportURL); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 bool PingLoader::sendBeacon(LocalFrame* frame, | 553 bool PingLoader::sendBeacon(LocalFrame* frame, |
| 552 int allowance, | 554 int allowance, |
| 553 const KURL& beaconURL, | 555 const KURL& beaconURL, |
| 554 Blob* data, | 556 Blob* data, |
| 555 int& payloadLength) { | 557 int& payloadLength) { |
| 556 BeaconBlob beacon(data); | 558 BeaconBlob beacon(data); |
| 557 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); | 559 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); |
| 558 } | 560 } |
| 559 | 561 |
| 560 } // namespace blink | 562 } // namespace blink |
| OLD | NEW |