LibDevTools: Implement enough of the protocol to inspect tabs

There is a lot needed all at once to actually inspect a tab's DOM tree.
It begins with requesting a "watcher" from a TabActor. It seems there
can be many types of watchers, but here we implement the "frame" watcher
only. The watcher creates an "inspector", which in turn creates a
"walker", which is the actor ultimately responsible for serializing and
inspecting the DOM tree.

In between all that, the DevTools client will send a handful of other
informational requests. If we do not reply to these, the client will not
move forward with the walker. For example, the CSSPropertiesActor will
be asked for a list of all known CSS properties.
This commit is contained in:
Timothy Flynn 2025-02-15 07:57:36 -05:00 committed by Tim Flynn
commit 5ed91dc915
Notes: github-actions[bot] 2025-02-19 13:47:12 +00:00
25 changed files with 1278 additions and 0 deletions

View file

@ -6,7 +6,11 @@
#pragma once
#include <AK/Error.h>
#include <AK/Function.h>
#include <AK/JsonValue.h>
#include <AK/Vector.h>
#include <LibDevTools/Actors/CSSPropertiesActor.h>
#include <LibDevTools/Actors/TabActor.h>
#include <LibDevTools/Forward.h>
@ -17,6 +21,10 @@ public:
virtual ~DevToolsDelegate() = default;
virtual Vector<TabDescription> tab_list() const { return {}; }
virtual Vector<CSSProperty> css_property_list() const { return {}; }
using OnTabInspectionComplete = Function<void(ErrorOr<JsonValue>)>;
virtual void inspect_tab(TabDescription const&, OnTabInspectionComplete) const { }
};
}