diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
index ba1014d821..647bec6413 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
@@ -128,7 +128,7 @@ void HTMLFormElement::submit_form(JS::GCPtr submitter, bool from_su
auto body = url_encode(parameters, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded).to_byte_buffer();
request.set_method("POST");
request.set_header("Content-Type", "application/x-www-form-urlencoded");
- request.set_body(body);
+ request.set_body(move(body));
}
if (auto* page = document().page())
diff --git a/Userland/Libraries/LibWeb/Loader/LoadRequest.h b/Userland/Libraries/LibWeb/Loader/LoadRequest.h
index 0e989cc7c8..c17dfab7ca 100644
--- a/Userland/Libraries/LibWeb/Loader/LoadRequest.h
+++ b/Userland/Libraries/LibWeb/Loader/LoadRequest.h
@@ -33,7 +33,7 @@ public:
void set_method(String const& method) { m_method = method; }
ByteBuffer const& body() const { return m_body; }
- void set_body(ByteBuffer const& body) { m_body = body; }
+ void set_body(ByteBuffer body) { m_body = move(body); }
void start_timer() { m_load_timer.start(); };
Time load_time() const { return m_load_timer.elapsed_time(); }
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 5ac73a2f36..067cb42aac 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -440,16 +440,17 @@ WebIDL::ExceptionOr XMLHttpRequest::send(Optionalpage());
request.set_method(m_method);
if (serialized_document.has_value()) {
- request.set_body(serialized_document.value());
+ request.set_body(serialized_document.release_value());
} else if (body_with_type.has_value()) {
TRY(body_with_type->body.source().visit(
[&](ByteBuffer const& buffer) -> WebIDL::ExceptionOr {
- request.set_body(buffer);
+ auto byte_buffer = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(buffer));
+ request.set_body(move(byte_buffer));
return {};
},
[&](JS::Handle const& blob) -> WebIDL::ExceptionOr {
auto byte_buffer = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(blob->bytes()));
- request.set_body(byte_buffer);
+ request.set_body(move(byte_buffer));
return {};
},
[](auto&) -> WebIDL::ExceptionOr {