1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +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

@ -144,11 +144,11 @@ ErrorOr<void> WebSocket::establish_web_socket_connection(AK::URL& url_record, Ve
auto& window = verify_cast<HTML::Window>(client.global_object());
auto origin_string = window.associated_document().origin().serialize();
Vector<DeprecatedString> protcol_deprecated_strings;
Vector<ByteString> protcol_byte_strings;
for (auto const& protocol : protocols)
TRY(protcol_deprecated_strings.try_append(protocol.to_deprecated_string()));
TRY(protcol_byte_strings.try_append(protocol.to_byte_string()));
m_websocket = WebSocketClientManager::the().connect(url_record, origin_string, protcol_deprecated_strings);
m_websocket = WebSocketClientManager::the().connect(url_record, origin_string, protcol_byte_strings);
m_websocket->on_open = [weak_this = make_weak_ptr<WebSocket>()] {
if (!weak_this)
return;
@ -165,7 +165,7 @@ ErrorOr<void> WebSocket::establish_web_socket_connection(AK::URL& url_record, Ve
if (!weak_this)
return;
auto& websocket = const_cast<WebSocket&>(*weak_this);
websocket.on_close(code, String::from_deprecated_string(reason).release_value_but_fixme_should_propagate_errors(), was_clean);
websocket.on_close(code, String::from_byte_string(reason).release_value_but_fixme_should_propagate_errors(), was_clean);
};
m_websocket->on_error = [weak_this = make_weak_ptr<WebSocket>()](auto) {
if (!weak_this)
@ -200,7 +200,7 @@ WebIDL::ExceptionOr<String> WebSocket::protocol() const
{
if (!m_websocket)
return String {};
return TRY_OR_THROW_OOM(vm(), String::from_deprecated_string(m_websocket->subprotocol_in_use()));
return TRY_OR_THROW_OOM(vm(), String::from_byte_string(m_websocket->subprotocol_in_use()));
}
// https://websockets.spec.whatwg.org/#dom-websocket-close
@ -226,7 +226,7 @@ WebIDL::ExceptionOr<void> WebSocket::close(Optional<u16> code, Optional<String>
// -> Otherwise
// NOTE: All of these are handled by the WebSocket Protocol when calling close()
// FIXME: LibProtocol does not yet support sending empty Close messages, so we use default values for now
m_websocket->close(code.value_or(1000), reason.value_or(String {}).to_deprecated_string());
m_websocket->close(code.value_or(1000), reason.value_or(String {}).to_byte_string());
return {};
}
@ -294,7 +294,7 @@ void WebSocket::on_message(ByteBuffer message, bool is_text)
if (m_websocket->ready_state() != WebSocket::ReadyState::Open)
return;
if (is_text) {
auto text_message = DeprecatedString(ReadonlyBytes(message));
auto text_message = ByteString(ReadonlyBytes(message));
HTML::MessageEventInit event_init;
event_init.data = JS::PrimitiveString::create(vm(), text_message);
event_init.origin = url().release_value_but_fixme_should_propagate_errors();