| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/loader/BeaconLoader.h" | 5 #include "core/loader/BeaconLoader.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMArrayBufferView.h" | 7 #include "core/dom/DOMArrayBufferView.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/fetch/CrossOriginAccessControl.h" | 9 #include "core/fetch/CrossOriginAccessControl.h" |
| 10 #include "core/fetch/FetchContext.h" | 10 #include "core/fetch/FetchContext.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (MixedContentChecker::shouldBlockFetch(frame, request, request.url())
) | 90 if (MixedContentChecker::shouldBlockFetch(frame, request, request.url())
) |
| 91 return false; | 91 return false; |
| 92 | 92 |
| 93 payloadLength = entitySize; | 93 payloadLength = entitySize; |
| 94 if (!beacon.serialize(request, allowance, payloadLength)) | 94 if (!beacon.serialize(request, allowance, payloadLength)) |
| 95 return false; | 95 return false; |
| 96 | 96 |
| 97 FetchInitiatorInfo initiatorInfo; | 97 FetchInitiatorInfo initiatorInfo; |
| 98 initiatorInfo.name = FetchInitiatorTypeNames::beacon; | 98 initiatorInfo.name = FetchInitiatorTypeNames::beacon; |
| 99 | 99 |
| 100 // Leak the loader, since it will kill itself as soon as it receives a r
esponse. | 100 // The loader keeps itself alive until it receives a response and dispos
es itself. |
| 101 RawPtr<BeaconLoader> loader = new BeaconLoader(frame, request, initiator
Info, AllowStoredCredentials); | 101 BeaconLoader* loader = new BeaconLoader(frame, request, initiatorInfo, A
llowStoredCredentials); |
| 102 loader->ref(); | 102 ASSERT_UNUSED(loader, loader); |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 bool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beac
onURL, const String& data, int& payloadLength) | 107 bool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beac
onURL, const String& data, int& payloadLength) |
| 108 { | 108 { |
| 109 BeaconData<String> beacon(data); | 109 BeaconData<String> beacon(data); |
| 110 return Sender::send(frame, allowance, beaconURL, beacon, payloadLength); | 110 return Sender::send(frame, allowance, beaconURL, beacon, payloadLength); |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 request.setHTTPBody(entityBody.release()); | 233 request.setHTTPBody(entityBody.release()); |
| 234 request.setHTTPContentType(contentType); | 234 request.setHTTPContentType(contentType); |
| 235 | 235 |
| 236 payloadLength = entitySize; | 236 payloadLength = entitySize; |
| 237 return true; | 237 return true; |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace | 240 } // namespace |
| 241 | 241 |
| 242 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |