Skip to content

Commit 6261c43

Browse files
ayeteadoeADKaster
authored andcommitted
LibWebView: Implement stubbed out BrowserProcess methods on Windows
1 parent 231336f commit 6261c43

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Libraries/LibWebView/BrowserProcess.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ ErrorOr<BrowserProcess::ProcessDisposition> BrowserProcess::connect(Vector<ByteS
4545
return ProcessDisposition::ContinueMainProcess;
4646
}
4747

48-
ErrorOr<void> BrowserProcess::connect_as_client([[maybe_unused]] ByteString const& socket_path, [[maybe_unused]] Vector<ByteString> const& raw_urls, [[maybe_unused]] NewWindow new_window)
48+
ErrorOr<void> BrowserProcess::connect_as_client(ByteString const& socket_path, Vector<ByteString> const& raw_urls, NewWindow new_window)
4949
{
50-
#if !defined(AK_OS_WINDOWS)
5150
// TODO: Mach IPC
5251
auto socket = TRY(Core::LocalSocket::connect(socket_path));
5352
auto client = UIProcessClient::construct(make<IPC::Transport>(move(socket)));
@@ -61,14 +60,10 @@ ErrorOr<void> BrowserProcess::connect_as_client([[maybe_unused]] ByteString cons
6160
}
6261

6362
return {};
64-
#else
65-
return Error::from_string_literal("BrowserProcess::connect_as_client() is not implemented on Windows");
66-
#endif
6763
}
6864

69-
ErrorOr<void> BrowserProcess::connect_as_server([[maybe_unused]] ByteString const& socket_path)
65+
ErrorOr<void> BrowserProcess::connect_as_server(ByteString const& socket_path)
7066
{
71-
#if !defined(AK_OS_WINDOWS)
7267
// TODO: Mach IPC
7368
auto socket_fd = TRY(Process::create_ipc_socket(socket_path));
7469
m_socket_path = socket_path;
@@ -90,15 +85,18 @@ ErrorOr<void> BrowserProcess::connect_as_server([[maybe_unused]] ByteString cons
9085
};
9186

9287
return {};
93-
#else
94-
return Error::from_string_literal("BrowserProcess::connect_as_server() is not implemented on Windows");
95-
#endif
9688
}
9789

9890
BrowserProcess::~BrowserProcess()
9991
{
10092
if (m_pid_file) {
10193
MUST(m_pid_file->truncate(0));
94+
#if defined(AK_OS_WINDOWS)
95+
// NOTE: On Windows, System::open() duplicates the underlying OS file handle,
96+
// so we need to explicitly close said handle, otherwise the unlink() call fails due
97+
// to permission errors and we crash on shutdown.
98+
m_pid_file->close();
99+
#endif
102100
MUST(Core::System::unlink(m_pid_path));
103101
}
104102

0 commit comments

Comments
 (0)