LibDevTools: Implement enough of the protocol to see a tab list

Previously, we could connect to our DevTools server from Firefox, but
could not see any information on Ladybird's opened tabs. This implements
enough of the protocol to see a tab list, but we cannot yet inspect the
tabs.
This commit is contained in:
Timothy Flynn 2025-02-15 07:53:57 -05:00 committed by Tim Flynn
commit b974e91731
Notes: github-actions[bot] 2025-02-19 13:47:18 +00:00
9 changed files with 168 additions and 2 deletions

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <LibDevTools/Actor.h>
namespace DevTools {
struct TabDescription {
u64 id { 0 };
ByteString title;
ByteString url;
};
class TabActor final : public Actor {
public:
static constexpr auto base_name = "tab"sv;
static NonnullRefPtr<TabActor> create(DevToolsServer&, ByteString name, TabDescription);
virtual ~TabActor() override;
virtual void handle_message(StringView type, JsonObject const&) override;
TabDescription const& description() const { return m_description; }
JsonObject serialize_description() const;
private:
TabActor(DevToolsServer&, ByteString name, TabDescription);
TabDescription m_description;
};
}