1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -148,7 +148,7 @@ WebIDL::ExceptionOr<String> URL::href() const
auto& vm = realm().vm();
// The href getter steps and the toJSON() method steps are to return the serialization of thiss URL.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_url.serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize()));
}
// https://url.spec.whatwg.org/#dom-url-tojson
@ -157,7 +157,7 @@ WebIDL::ExceptionOr<String> URL::to_json() const
auto& vm = realm().vm();
// The href getter steps and the toJSON() method steps are to return the serialization of thiss URL.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_url.serialize()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize()));
}
// https://url.spec.whatwg.org/#ref-for-dom-url-href②
@ -193,7 +193,7 @@ WebIDL::ExceptionOr<String> URL::origin() const
auto& vm = realm().vm();
// The origin getter steps are to return the serialization of thiss URLs origin. [HTML]
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_url.serialize_origin()));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize_origin()));
}
// https://url.spec.whatwg.org/#dom-url-protocol
@ -355,7 +355,7 @@ WebIDL::ExceptionOr<String> URL::pathname() const
auto& vm = realm().vm();
// The pathname getter steps are to return the result of URL path serializing thiss URL.
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(m_url.serialize_path(AK::URL::ApplyPercentDecoding::No)));
return TRY_OR_THROW_OOM(vm, String::from_byte_string(m_url.serialize_path(AK::URL::ApplyPercentDecoding::No)));
}
// https://url.spec.whatwg.org/#ref-for-dom-url-pathname%E2%91%A0
@ -517,14 +517,14 @@ HTML::Origin url_origin(AK::URL const& url)
// -> "wss"
if (url.scheme().is_one_of("ftp"sv, "http"sv, "https"sv, "ws"sv, "wss"sv)) {
// Return the tuple origin (urls scheme, urls host, urls port, null).
return HTML::Origin(url.scheme().to_deprecated_string(), url.host(), url.port().value_or(0));
return HTML::Origin(url.scheme().to_byte_string(), url.host(), url.port().value_or(0));
}
// -> "file"
if (url.scheme() == "file"sv) {
// Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
// Note: We must return an origin with the `file://' protocol for `file://' iframes to work from `file://' pages.
return HTML::Origin(url.scheme().to_deprecated_string(), String {}, 0);
return HTML::Origin(url.scheme().to_byte_string(), String {}, 0);
}
// -> Otherwise

View file

@ -58,9 +58,9 @@ public:
Optional<String> const& fragment() const { return m_url.fragment(); }
DeprecatedString path_segment_at_index(size_t index) const { return m_url.path_segment_at_index(index); }
ByteString path_segment_at_index(size_t index) const { return m_url.path_segment_at_index(index); }
void set_paths(Vector<DeprecatedString> const& paths) { return m_url.set_paths(paths); }
void set_paths(Vector<ByteString> const& paths) { return m_url.set_paths(paths); }
// FIXME: Reimplement this to meet the definition in https://url.spec.whatwg.org/#url-opaque-path once we modernize URL to meet the spec.
bool cannot_be_a_base_url() const { return m_url.cannot_be_a_base_url(); }

View file

@ -109,8 +109,8 @@ ErrorOr<Vector<QueryParam>> url_decode(StringView input)
auto space_decoded_name = name.replace("+"sv, " "sv, ReplaceMode::All);
// 5. Let nameString and valueString be the result of running UTF-8 decode without BOM on the percent-decoding of name and value, respectively.
auto name_string = TRY(String::from_deprecated_string(AK::URL::percent_decode(space_decoded_name)));
auto value_string = TRY(String::from_deprecated_string(AK::URL::percent_decode(value)));
auto name_string = TRY(String::from_byte_string(AK::URL::percent_decode(space_decoded_name)));
auto value_string = TRY(String::from_byte_string(AK::URL::percent_decode(value)));
TRY(output.try_empend(move(name_string), move(value_string)));
}