Skip to content

Commit

Permalink
LibWeb: Use keepalive maximum size in NavigatorBeacon
Browse files Browse the repository at this point in the history
This is defined as 64 KiB in the fetch spec.

See:
 - https://wpt.live/beacon/beacon-basic.https.window.html
(cherry picked from commit 17c1e99ce4b3a05d5f71e15513b2f1e4251047e2)
  • Loading branch information
jamierocks authored and nico committed Nov 8, 2024
1 parent 485c96a commit 009dfe0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Userland/Libraries/LibWeb/HTML/NavigatorBeacon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Fetch/Fetching/Fetching.h>
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
#include <LibWeb/Fetch/Infrastructure/HTTP/Bodies.h>
#include <LibWeb/HTML/Navigator.h>
#include <LibWeb/HTML/NavigatorBeacon.h>
#include <LibWeb/HTML/Scripting/Environments.h>
Expand Down Expand Up @@ -50,7 +51,8 @@ WebIDL::ExceptionOr<bool> 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()) {
Expand Down

0 comments on commit 009dfe0

Please sign in to comment.