ladybird/Libraries/LibDevTools/Actors/WatcherActor.h
Sam Atkins ddb4bdadd7 LibDevTools: Populate DevTools Web Storage
Firefox exposes localStorage and sessionStorage through the same
storage actor protocol used by cookies. Add matching resources for the
current tab so the Storage panel can list key/value pairs.

Read the values through WebContent rather than directly from the
browser process. Session storage lives in LibWeb, and using the same
path for both stores keeps the actor independent of the backing store.
2026-06-11 16:08:33 +01:00

54 lines
1.7 KiB
C++

/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <LibDevTools/Actor.h>
#include <LibDevTools/Forward.h>
namespace DevTools {
class DEVTOOLS_API WatcherActor final : public Actor {
public:
static constexpr auto base_name = "watcher"sv;
static NonnullRefPtr<WatcherActor> create(DevToolsServer&, String name, WeakPtr<TabActor>);
virtual ~WatcherActor() override;
JsonObject serialize_description() const;
void send_frame_target_available_message();
void switch_frame_target(FrameActor&, String const& url, String const& title);
private:
WatcherActor(DevToolsServer&, String name, WeakPtr<TabActor>);
virtual void handle_message(Message const&) override;
FrameActor& create_frame_target();
void send_frame_target_available_message(FrameActor&);
void send_frame_target_destroyed_message(FrameActor&);
CookiesActor& cookies_actor();
void send_cookies_resource_available_message();
StorageActor& local_storage_actor();
StorageActor& session_storage_actor();
void send_storage_resource_available_message(StorageActor&);
WeakPtr<TabActor> m_tab;
WeakPtr<FrameActor> m_target;
WeakPtr<CookiesActor> m_cookies;
WeakPtr<StorageActor> m_local_storage;
WeakPtr<StorageActor> m_session_storage;
WeakPtr<TargetConfigurationActor> m_target_configuration;
WeakPtr<ThreadConfigurationActor> m_thread_configuration;
WeakPtr<NetworkParentActor> m_network_parent;
bool m_is_watching_frame_targets { false };
bool m_is_watching_cookie_resources { false };
bool m_is_watching_local_storage_resources { false };
bool m_is_watching_session_storage_resources { false };
};
}