LibWeb: Honor User-Agent spoofing in Fetch headers

This makes spoofing consistent between legacy ResourceLoader loads,
Fetch loads, and the JavaScript `navigator` APIs.
This commit is contained in:
Andreas Kling 2023-12-27 11:43:14 +01:00
parent a30d263522
commit 89da988da1
Notes: sideshowbarker 2024-07-17 02:59:43 +09:00
3 changed files with 4 additions and 4 deletions

View file

@ -1354,7 +1354,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
if (!http_request->header_list()->contains("User-Agent"sv.bytes())) {
auto header = Infrastructure::Header {
.name = MUST(ByteBuffer::copy("User-Agent"sv.bytes())),
.value = TRY_OR_THROW_OOM(vm, Infrastructure::default_user_agent_value()),
.value = Infrastructure::default_user_agent_value(),
};
TRY_OR_THROW_OOM(vm, http_request->header_list()->append(move(header)));
}