Переглянути джерело

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.
Linus Groh 3 роки тому
батько
коміт
fad69fcacd

+ 1 - 1
Userland/Libraries/LibWeb/CMakeLists.txt

@@ -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

+ 0 - 20
Userland/Libraries/LibWeb/Fetch/AbstractOperations.h

@@ -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);
-
-}

+ 1 - 1
Userland/Libraries/LibWeb/Fetch/AbstractOperations.cpp → Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.cpp

@@ -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 {
 

+ 8 - 0
Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP.h

@@ -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);
+
 }

+ 1 - 2
Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp

@@ -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 ';'.

+ 0 - 1
Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

@@ -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>