ladybird/Libraries/LibDevTools/Actors/TabActor.h
Sam Atkins 5283f669a1 LibDevTools: Reload inspector roots after navigation
Firefox keeps using the same walker after navigation and expects it to
publish the new document root.

Normal tab debugging also relies on target switching. Re-inspect the tab
when navigation finishes, replace the walker DOM data, and notify the
watcher that the previous top-level frame target was destroyed before a
fresh target becomes available.

Send target availability as a watcher event, not as the watchTargets
response, and give each navigation a new inner window id so Firefox can
associate the new target with the new document.
2026-06-01 15:09:25 +01:00

47 lines
1.1 KiB
C++

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