Commit bf410a40 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Stop attaching a content type for beacon with ArrayBufferView

Bug: 1051439, 876671
Change-Id: Ie6055aa48fc27293a89fd20d4273654553fe85cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2060362Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742069}
parent e3fa9aaf
...@@ -466,5 +466,11 @@ const base::Feature kCSSReducedFontLoadingInvalidations{ ...@@ -466,5 +466,11 @@ const base::Feature kCSSReducedFontLoadingInvalidations{
const base::Feature kDiscardCodeCacheAfterFirstUse{ const base::Feature kDiscardCodeCacheAfterFirstUse{
"DiscardCodeCacheAfterFirstUse", base::FEATURE_DISABLED_BY_DEFAULT}; "DiscardCodeCacheAfterFirstUse", base::FEATURE_DISABLED_BY_DEFAULT};
// The kill-switch for the fix for https://crbug.com/1051439.
// TODO(crbug.com/1053369): Remove this around M84.
const base::Feature kSuppressContentTypeForBeaconMadeWithArrayBufferView{
"SuppressContentTypeForBeaconMadeWithArrayBufferView",
base::FEATURE_ENABLED_BY_DEFAULT};
} // namespace features } // namespace features
} // namespace blink } // namespace blink
...@@ -153,6 +153,9 @@ BLINK_COMMON_EXPORT extern const base::Feature ...@@ -153,6 +153,9 @@ BLINK_COMMON_EXPORT extern const base::Feature
BLINK_COMMON_EXPORT extern const base::Feature kDiscardCodeCacheAfterFirstUse; BLINK_COMMON_EXPORT extern const base::Feature kDiscardCodeCacheAfterFirstUse;
BLINK_COMMON_EXPORT extern const base::Feature
kSuppressContentTypeForBeaconMadeWithArrayBufferView;
} // namespace features } // namespace features
} // namespace blink } // namespace blink
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "third_party/blink/renderer/core/loader/ping_loader.h" #include "third_party/blink/renderer/core/loader/ping_loader.h"
#include "base/feature_list.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/fileapi/file.h" #include "third_party/blink/renderer/core/fileapi/file.h"
...@@ -143,9 +145,12 @@ class BeaconDOMArrayBufferView final : public Beacon { ...@@ -143,9 +145,12 @@ class BeaconDOMArrayBufferView final : public Beacon {
base::checked_cast<wtf_size_t>(data_->byteLengthAsSizeT())); base::checked_cast<wtf_size_t>(data_->byteLengthAsSizeT()));
request.SetHttpBody(std::move(entity_body)); request.SetHttpBody(std::move(entity_body));
// FIXME: a reasonable choice, but not in the spec; should it give a if (!base::FeatureList::IsEnabled(
// default? features::kSuppressContentTypeForBeaconMadeWithArrayBufferView)) {
request.SetHTTPContentType(AtomicString("application/octet-stream")); // FIXME: a reasonable choice, but not in the spec; should it give a
// default?
request.SetHTTPContentType(AtomicString("application/octet-stream"));
}
} }
const AtomicString GetContentType() const override { return g_null_atom; } const AtomicString GetContentType() const override { return g_null_atom; }
......
This is a testharness.js-based test. This is a testharness.js-based test.
PASS Test content-type header for a body string PASS Test content-type header for a body string
FAIL Test content-type header for a body ArrayBufferView assert_equals: Correct Content-Type header result expected "" but got "application/octet-stream" PASS Test content-type header for a body ArrayBufferView
FAIL Test content-type header for a body ArrayBuffer assert_equals: Correct Content-Type header result expected "" but got "text/plain;charset=UTF-8" FAIL Test content-type header for a body ArrayBuffer assert_equals: Correct Content-Type header result expected "" but got "text/plain;charset=UTF-8"
PASS Test content-type header for a body Blob PASS Test content-type header for a body Blob
PASS Test content-type header for a body FormData PASS Test content-type header for a body FormData
......
...@@ -19,12 +19,11 @@ PASS ...@@ -19,12 +19,11 @@ PASS
Sending beacon with type: [object Uint32Array] Sending beacon with type: [object Uint32Array]
PASS navigator.sendBeacon("resources/save-beacon.php?name=same-origin", payload); is true PASS navigator.sendBeacon("resources/save-beacon.php?name=same-origin", payload); is true
PASS Beacon sent successfully PASS Beacon sent successfully
PASS Content-Type: application/octet-stream
PASS Origin: http://127.0.0.1:8000 PASS Origin: http://127.0.0.1:8000
PASS Referer: http://127.0.0.1:8000/sendbeacon/beacon-same-origin.html PASS Referer: http://127.0.0.1:8000/sendbeacon/beacon-same-origin.html
PASS Request-Method: POST PASS Request-Method: POST
PASS Length: 40 PASS Length: 40
PASS Body: QAAAAEEAAABCAAAAQwAAAEQAAABFAAAARgAAAEcAAABIAAAASQAAAA== PASS Body: @\0\0\0A\0\0\0B\0\0\0C\0\0\0D\0\0\0E\0\0\0F\0\0\0G\0\0\0H\0\0\0I
PASS PASS
Sending beacon with type: [object Blob] Sending beacon with type: [object Blob]
PASS navigator.sendBeacon("resources/save-beacon.php?name=same-origin", payload); is true PASS navigator.sendBeacon("resources/save-beacon.php?name=same-origin", payload); is true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment