From 17c1e99ce4b3a05d5f71e15513b2f1e4251047e2 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Sat, 10 Aug 2024 09:27:28 +0100 Subject: [PATCH] LibWeb: Use keepalive maximum size in NavigatorBeacon This is defined as 64 KiB in the fetch spec. See: - https://wpt.live/beacon/beacon-basic.https.window.html --- Userland/Libraries/LibWeb/HTML/NavigatorBeacon.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/NavigatorBeacon.cpp b/Userland/Libraries/LibWeb/HTML/NavigatorBeacon.cpp index ea83d438af13..dac0ab41fc18 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigatorBeacon.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigatorBeacon.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,8 @@ WebIDL::ExceptionOr NavigatorBeaconMixin::send_beacon(String const& url, O auto& content_type = body_with_type.type; // 6.2 If the amount of data that can be queued to be sent by keepalive enabled requests is exceeded by the size of transmittedData (as defined in HTTP-network-or-cache fetch), set the return value to false and terminate these steps. - // FIXME: We don't have a size limit in Fetching::fetch + if (transmitted_data->length().has_value() && transmitted_data->length().value() > Fetch::Fetching::keepalive_maximum_size) + return false; // 6.3 If contentType is not null: if (content_type.has_value()) {