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

WebContent+WebDriver: Move WebDriver socket to the standard runtime path

This will allow Ladybird to use local socket files rather than passing
around a bunch of socket FDs.
This commit is contained in:
Timothy Flynn 2022-12-15 07:36:17 -05:00 committed by Linus Groh
parent 701e77019c
commit 366f24a73b
3 changed files with 12 additions and 5 deletions

View file

@ -8,6 +8,7 @@
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
#include <LibCore/LocalServer.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibIPC/SingleServer.h>
@ -27,8 +28,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath"));
// This must be first; we can't check if /tmp/webdriver exists once we've unveiled other paths.
if (Core::File::exists("/tmp/webdriver"sv))
TRY(Core::System::unveil("/tmp/webdriver", "rw"));
auto webdriver_socket_path = DeprecatedString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
if (Core::File::exists(webdriver_socket_path))
TRY(Core::System::unveil(webdriver_socket_path, "rw"sv));
TRY(Core::System::unveil("/sys/kernel/processes", "r"));
TRY(Core::System::unveil("/res", "r"));