LibWeb: Move Fetch::collect_an_http_quoted_string() into HTTP.{cpp,h}

The Fetch spec is too big to have a generic AbstractOperations.{cpp,h}
file, so let's keep AOs in their section-specific files.
This commit is contained in:
Linus Groh 2022-07-10 19:25:42 +02:00
parent e3798886ed
commit fad69fcacd
Notes: sideshowbarker 2024-07-17 23:00:03 +09:00
6 changed files with 11 additions and 25 deletions

View file

@ -117,7 +117,7 @@ set(SOURCES
Dump.cpp
Encoding/TextDecoder.cpp
Encoding/TextEncoder.cpp
Fetch/AbstractOperations.cpp
Fetch/Infrastructure/HTTP.cpp
Fetch/Infrastructure/URL.cpp
FontCache.cpp
Geometry/DOMRectList.cpp

View file

@ -1,20 +0,0 @@
/*
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
namespace Web::Fetch {
enum class HttpQuotedStringExtractValue {
No,
Yes,
};
String collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value);
}

View file

@ -7,7 +7,7 @@
#include <AK/GenericLexer.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibWeb/Fetch/AbstractOperations.h>
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
namespace Web::Fetch {

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -19,4 +20,11 @@ inline constexpr StringView HTTP_TAB_OR_SPACE = "\t "sv;
// HTTP whitespace is U+000A LF, U+000D CR, or an HTTP tab or space.
inline constexpr StringView HTTP_WHITESPACE = "\n\r\t "sv;
enum class HttpQuotedStringExtractValue {
No,
Yes,
};
String collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedStringExtractValue extract_value);
}

View file

@ -7,7 +7,6 @@
#include <AK/CharacterTypes.h>
#include <AK/GenericLexer.h>
#include <AK/StringBuilder.h>
#include <LibWeb/Fetch/AbstractOperations.h>
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
#include <LibWeb/MimeSniff/MimeType.h>
@ -125,7 +124,7 @@ Optional<MimeType> MimeType::from_string(StringView string)
// 8. If the code point at position within input is U+0022 ("), then:
if (lexer.peek() == '"') {
// 1. Set parameterValue to the result of collecting an HTTP quoted string from input, given position and the extract-value flag.
parameter_value = collect_an_http_quoted_string(lexer, Fetch::HttpQuotedStringExtractValue::Yes);
parameter_value = Fetch::collect_an_http_quoted_string(lexer, Fetch::HttpQuotedStringExtractValue::Yes);
// 2. Collect a sequence of code points that are not U+003B (;) from input, given position.
// NOTE: This uses the predicate version as the ignore_until(char) version will also ignore the ';'.

View file

@ -23,7 +23,6 @@
#include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/Fetch/AbstractOperations.h>
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
#include <LibWeb/HTML/EventHandler.h>
#include <LibWeb/HTML/EventNames.h>