mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
LibWeb: Sync statusText check with spec update
Synced change from https://github.com/whatwg/fetch/pull/1795. No functional changes; only update comments to reflect the latest spec.
This commit is contained in:
parent
8ac5424f3a
commit
9c76260756
Notes:
github-actions[bot]
2024-12-15 08:34:31 +00:00
Author: https://github.com/F3n67u Commit: https://github.com/LadybirdBrowser/ladybird/commit/9c762607568 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2909 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/shannonbooth ✅
1 changed files with 2 additions and 2 deletions
|
@ -87,7 +87,7 @@ GC::Ref<Response> Response::create(JS::Realm& realm, GC::Ref<Infrastructure::Res
|
|||
// https://httpwg.org/specs/rfc9112.html#status.line
|
||||
static bool is_valid_status_text(StringView status_text)
|
||||
{
|
||||
// A status text is a valid status text if it matches the reason-phrase token production.
|
||||
// A status text is valid if it is either the empty string or matches the reason-phrase token production.
|
||||
// reason-phrase = 1*( HTAB / SP / VCHAR / obs-text )
|
||||
// VCHAR = %x21-7E
|
||||
// obs-text = %x80-FF
|
||||
|
@ -103,7 +103,7 @@ WebIDL::ExceptionOr<void> Response::initialize_response(ResponseInit const& init
|
|||
if (init.status < 200 || init.status > 599)
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::RangeError, "Status must be in range 200-599"sv };
|
||||
|
||||
// 2. If init["statusText"] does not match the reason-phrase token production, then throw a TypeError.
|
||||
// 2. If init["statusText"] is not the empty string and does not match the reason-phrase token production, then throw a TypeError.
|
||||
if (!is_valid_status_text(init.status_text))
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid statusText: does not match the reason-phrase token production"sv };
|
||||
|
||||
|
|
Loading…
Reference in a new issue