From dbba6c0df948b616ee313baaa2d5fe57169fe6cc Mon Sep 17 00:00:00 2001 From: ayeteadoe Date: Fri, 27 Jun 2025 22:14:03 -0700 Subject: [PATCH] LibWeb: Enable in Windows CI --- Libraries/CMakeLists.txt | 3 ++- Libraries/LibIPC/TransportSocketWindows.cpp | 5 +++++ Libraries/LibIPC/TransportSocketWindows.h | 1 + Libraries/LibMedia/Audio/PlaybackStream.cpp | 4 ++++ Libraries/LibWeb/HTML/MessagePort.cpp | 2 +- .../LibWeb/GenerateNamedCharacterReferences.cpp | 8 ++++++-- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Libraries/CMakeLists.txt b/Libraries/CMakeLists.txt index 66ea29b4969..73653913de4 100644 --- a/Libraries/CMakeLists.txt +++ b/Libraries/CMakeLists.txt @@ -23,6 +23,7 @@ add_subdirectory(LibXML) if (ENABLE_GUI_TARGETS) add_subdirectory(LibGfx) add_subdirectory(LibMedia) + add_subdirectory(LibWeb) endif() # FIXME: Increase support for building targets on Windows @@ -33,8 +34,8 @@ endif() add_subdirectory(LibLine) if (ENABLE_GUI_TARGETS) + # FIXME: TCPServer still needs to be implemented on Windows add_subdirectory(LibDevTools) add_subdirectory(LibImageDecoderClient) - add_subdirectory(LibWeb) add_subdirectory(LibWebView) endif() diff --git a/Libraries/LibIPC/TransportSocketWindows.cpp b/Libraries/LibIPC/TransportSocketWindows.cpp index d840dff08d6..3d799f6552d 100644 --- a/Libraries/LibIPC/TransportSocketWindows.cpp +++ b/Libraries/LibIPC/TransportSocketWindows.cpp @@ -39,6 +39,11 @@ void TransportSocketWindows::close() m_socket->close(); } +void TransportSocketWindows::close_after_sending_all_pending_messages() +{ + close(); +} + void TransportSocketWindows::wait_until_readable() { auto readable = MUST(m_socket->can_read_without_blocking(-1)); diff --git a/Libraries/LibIPC/TransportSocketWindows.h b/Libraries/LibIPC/TransportSocketWindows.h index dcac37f02fd..586d3a23cb2 100644 --- a/Libraries/LibIPC/TransportSocketWindows.h +++ b/Libraries/LibIPC/TransportSocketWindows.h @@ -24,6 +24,7 @@ public: void set_up_read_hook(Function); bool is_open() const; void close(); + void close_after_sending_all_pending_messages(); void wait_until_readable(); diff --git a/Libraries/LibMedia/Audio/PlaybackStream.cpp b/Libraries/LibMedia/Audio/PlaybackStream.cpp index 0db0557f3bb..16635fae87d 100644 --- a/Libraries/LibMedia/Audio/PlaybackStream.cpp +++ b/Libraries/LibMedia/Audio/PlaybackStream.cpp @@ -8,7 +8,11 @@ namespace Audio { +#if !defined(AK_OS_WINDOWS) ErrorOr> __attribute__((weak)) PlaybackStream::create(OutputState, u32, u8, u32, AudioDataRequestCallback&&) +#else +ErrorOr> PlaybackStream::create(OutputState, u32, u8, u32, AudioDataRequestCallback&&) +#endif { return Error::from_string_literal("Audio output is not available for this platform"); } diff --git a/Libraries/LibWeb/HTML/MessagePort.cpp b/Libraries/LibWeb/HTML/MessagePort.cpp index 05a5a39b49b..9824a8dfcf7 100644 --- a/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Libraries/LibWeb/HTML/MessagePort.cpp @@ -313,7 +313,7 @@ void MessagePort::read_from_transport() })); }); - if (schedule_shutdown == IPC::TransportSocket::ShouldShutdown::Yes) { + if (schedule_shutdown == IPC::Transport::ShouldShutdown::Yes) { queue_global_task(Task::Source::PostedMessage, relevant_global_object(*this), GC::create_function(heap(), [this] { this->close(); })); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateNamedCharacterReferences.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateNamedCharacterReferences.cpp index 3dad5aaea73..6157a24ea9b 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateNamedCharacterReferences.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateNamedCharacterReferences.cpp @@ -414,7 +414,7 @@ static NamedCharacterReferenceCodepoints g_named_character_reference_codepoints_ generator.append(R"~~~(}; -struct DafsaNode { +struct __attribute__((packed)) DafsaNode { // The actual alphabet of characters used in the list of named character references only // includes 61 unique characters ('1'...'8', ';', 'a'...'z', 'A'...'Z'), but we have // bits to spare and encoding this as a `u8` allows us to avoid the need for converting @@ -441,7 +441,11 @@ struct DafsaNode { // There are 3872 nodes in our DAFSA, so all indexes could fit in a u12. u16 child_index : 14; }; -static_assert(sizeof(DafsaNode) == 4); +#if !defined(AK_OS_WINDOWS) + static_assert(sizeof(DafsaNode) == 4); +#else + static_assert(sizeof(DafsaNode) == 5); +#endif static DafsaNode g_named_character_reference_dafsa[] = { { 0, 0, false, true, 1 },