Skip to content

Truly independent web browser

LibURL: Remove unused Parser::percent_encode_after_encoding()

Shannon Booth95c4ec8fbe79
diff --git a/Libraries/LibURL/CMakeLists.txt b/Libraries/LibURL/CMakeLists.txt
index ee04d1f5bfc..e5fcff64f77 100644
--- a/Libraries/LibURL/CMakeLists.txt
+++ b/Libraries/LibURL/CMakeLists.txt
@@ -9,7 +9,7 @@ set(SOURCES
)
ladybird_lib(LibURL url)
-target_link_libraries(LibURL PRIVATE liburl_rust LibUnicode LibTextCodec LibRegex PkgConfig::LIBPSL)
+target_link_libraries(LibURL PRIVATE liburl_rust LibUnicode LibRegex PkgConfig::LIBPSL)
import_rust_crate(MANIFEST_PATH Rust/Cargo.toml CRATE_NAME liburl_rust FEATURES allocator FFI_HEADER RustFFI.h)
target_link_libraries(liburl_rust INTERFACE LibUnicode LibRegex)
diff --git a/Libraries/LibURL/Parser.cpp b/Libraries/LibURL/Parser.cpp
index a363e2cbdb7..46acd0f442a 100644
--- a/Libraries/LibURL/Parser.cpp
+++ b/Libraries/LibURL/Parser.cpp
@@ -5,10 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <AK/StringBuilder.h>
-#include <AK/StringUtils.h>
-#include <AK/Utf8View.h>
-#include <LibTextCodec/Encoder.h>
#include <LibURL/Parser.h>
#include <LibURL/RustIntegration.h>
@@ -25,55 +21,6 @@ Optional<Host> Parser::parse_host(Utf16View input, bool is_opaque)
return RustIntegration::parse_host(input, is_opaque);
}
-// https://url.spec.whatwg.org/#string-percent-encode-after-encoding
-String Parser::percent_encode_after_encoding(TextCodec::Encoder const& encoder, StringView input, PercentEncodeSet percent_encode_set, bool space_as_plus)
-{
- // 1. Let encodeOutput be an empty I/O queue.
- StringBuilder output;
-
- // 2. Set potentialError to the result of running encode or fail with inputQueue, encoder, and encodeOutput.
- MUST(encoder.process(
- Utf8View(input),
-
- // 3. For each byte of encodeOutput converted to a byte sequence:
- [&](ReadonlyBytes bytes) -> ErrorOr<void> {
- for (auto byte : bytes) {
- // 1. If spaceAsPlus is true and byte is 0x20 (SP), then append U+002B (+) to output and continue.
- if (space_as_plus && byte == ' ') {
- output.append('+');
- continue;
- }
-
- // 2. Let isomorph be a code point whose value is byte’s value.
- u32 isomorph = byte;
-
- // 3. Assert: percentEncodeSet includes all non-ASCII code points.
-
- // 4. If isomorphic is not in percentEncodeSet, then append isomorph to output.
- if (!code_point_is_in_percent_encode_set(isomorph, percent_encode_set)) {
- output.append_code_point(isomorph);
- }
-
- // 5. Otherwise, percent-encode byte and append the result to output.
- else {
- output.appendff("%{:02X}", byte);
- }
- }
-
- return {};
- },
-
- // 4. If potentialError is non-null, then append "%26%23", followed by the shortest sequence of ASCII digits
- // representing potentialError in base ten, followed by "%3B", to output.
- [&](u32 error) -> ErrorOr<void> {
- output.appendff("%26%23{}%3B", error);
- return {};
- }));
-
- // 6. Return output.
- return MUST(output.to_string());
-}
-
static FFI::RustUrlByteSlice rust_encoding(Optional<StringView> encoding)
{
if (!encoding.has_value())
diff --git a/Libraries/LibURL/Parser.h b/Libraries/LibURL/Parser.h
index 9358dd44c00..f7f6da4eb3d 100644
--- a/Libraries/LibURL/Parser.h
+++ b/Libraries/LibURL/Parser.h
@@ -10,7 +10,6 @@
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <AK/Utf16View.h>
-#include <LibTextCodec/Forward.h>
#include <LibURL/URL.h>
namespace URL {
@@ -47,9 +46,6 @@ public:
static bool basic_parse(StringView input, URL& url, State state_override, Optional<StringView> encoding = {});
static bool basic_parse(Utf16View input, URL& url, State state_override, Optional<StringView> encoding = {});
- // https://url.spec.whatwg.org/#string-percent-encode-after-encoding
- static String percent_encode_after_encoding(TextCodec::Encoder const&, StringView input, PercentEncodeSet percent_encode_set, bool space_as_plus = false);
-
static Optional<Host> parse_host(StringView input, bool is_opaque = false);
static Optional<Host> parse_host(Utf16View input, bool is_opaque = false);
};