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

Browser+LibWeb+WebContent: Allow Browser to load local files

To achieve this goal:
 - The Browser unveils "/tmp/portal/filesystemaccess"
 - Pass the page through LoadRequest => ResourceLoader
 - ResourceLoader requests a file to the FileSystemAccessServer via IPC
 - OutOfProcessWebView handles it and sends a file descriptor back to
 the Page.
This commit is contained in:
Lucas CHOLLET 2022-02-26 17:50:31 +01:00 committed by Linus Groh
parent 1ba9c821fb
commit 662711fa26
21 changed files with 165 additions and 14 deletions

View file

@ -13,6 +13,7 @@
#include <LibWeb/CSS/PreferredColorScheme.h>
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Loader/FileRequest.h>
#include <WebContent/Forward.h>
#include <WebContent/WebContentClientEndpoint.h>
#include <WebContent/WebContentConsoleClient.h>
@ -31,6 +32,8 @@ public:
void initialize_js_console(Badge<PageHost>);
void request_file(NonnullRefPtr<Web::FileRequest>&);
private:
explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>);
@ -64,6 +67,7 @@ private:
virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override;
virtual void set_has_focus(bool) override;
virtual void set_is_scripting_enabled(bool) override;
virtual void handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id) override;
virtual void js_console_input(String const&) override;
virtual void run_javascript(String const&) override;
@ -91,6 +95,9 @@ private:
WeakPtr<JS::Interpreter> m_interpreter;
OwnPtr<WebContentConsoleClient> m_console_client;
JS::Handle<JS::GlobalObject> m_console_global_object;
HashMap<int, NonnullRefPtr<Web::FileRequest>> m_requested_files {};
int last_id { 0 };
};
}