Index: third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp |
diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp |
index 33a1b2dfd2fd26d0f7ee65b8effdf47c5f20bacb..18ee7c3bb82e0d02701d0480f0a8e827831c5a00 100644 |
--- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp |
+++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp |
@@ -9,6 +9,7 @@ |
#include "core/dom/DOMArrayBufferView.h" |
#include "core/dom/ExceptionCode.h" |
#include "core/dom/ExecutionContext.h" |
+#include "core/fetch/FetchUtils.h" |
#include "core/fileapi/Blob.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/Settings.h" |
@@ -111,16 +112,20 @@ bool NavigatorBeacon::sendBeacon(ExecutionContext* context, Navigator& navigator |
int bytes = 0; |
bool allowed; |
- if (data.isArrayBufferView()) |
+ if (data.isArrayBufferView()) { |
allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.getAsArrayBufferView(), bytes); |
- else if (data.isBlob()) |
- allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.getAsBlob(), bytes); |
- else if (data.isString()) |
+ } else if (data.isBlob()) { |
+ Blob* blob = data.getAsBlob(); |
+ if (!FetchUtils::isSimpleContentType(AtomicString(blob->type()))) |
+ UseCounter::count(context, UseCounter::SendBeaconWithNonSimpleContentType); |
+ allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, blob, bytes); |
+ } else if (data.isString()) { |
allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.getAsString(), bytes); |
- else if (data.isFormData()) |
+ } else if (data.isFormData()) { |
allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, data.getAsFormData(), bytes); |
- else |
+ } else { |
allowed = BeaconLoader::sendBeacon(impl.frame(), allowance, url, String(), bytes); |
+ } |
return impl.beaconResult(context, allowed, bytes); |
} |