mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
describeNode feedback
This commit is contained in:
@@ -170,15 +170,11 @@ fn describeNode(cmd: anytype) !void {
|
||||
if (params.nodeId != null) {
|
||||
const node = bc.node_registry.lookup_by_id.get(params.nodeId.?) orelse return error.NodeNotFound;
|
||||
return cmd.sendResult(.{ .node = bc.nodeWriter(node, .{}) }, .{});
|
||||
} else if (params.objectId != null) {
|
||||
|
||||
}
|
||||
if (params.objectId != null) {
|
||||
// Retrieve the object from which ever context it is in.
|
||||
const js_value = try bc.session.inspector.getValueByObjectId(cmd.arena, bc.session.executor, params.objectId.?);
|
||||
const entry = js_value.taggedAnyOpaque() orelse return error.ObjectIdIsNotANode;
|
||||
const subtype = entry.subtype orelse return error.ObjectIdIsNotANode;
|
||||
if (subtype != .node) return error.ObjectIdIsNotANode;
|
||||
|
||||
const node = try bc.node_registry.register(@ptrCast(entry.ptr));
|
||||
const parser_node = try bc.session.inspector.getNodePtr(cmd.arena, params.objectId.?);
|
||||
const node = try bc.node_registry.register(@ptrCast(parser_node));
|
||||
return cmd.sendResult(.{ .node = bc.nodeWriter(node, .{}) }, .{});
|
||||
}
|
||||
return error.MissingParams;
|
||||
|
||||
@@ -122,28 +122,12 @@ const Inspector = struct {
|
||||
_ = value;
|
||||
return RemoteObject{};
|
||||
}
|
||||
pub fn getValueByObjectId(self: Inspector, alloc: std.mem.Allocator, executor: *const Executor, object_id: []const u8) !Value {
|
||||
pub fn getNodePtr(self: Inspector, alloc: std.mem.Allocator, object_id: []const u8) !?*anyopaque {
|
||||
_ = self;
|
||||
_ = alloc;
|
||||
_ = executor;
|
||||
_ = object_id;
|
||||
return .{};
|
||||
return try alloc.create(i32);
|
||||
}
|
||||
};
|
||||
const Value = struct {
|
||||
pub fn taggedAnyOpaque(self: Value) ?*TaggedAnyOpaque {
|
||||
_ = self;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const TaggedAnyOpaque = struct {
|
||||
ptr: *anyopaque,
|
||||
subtype: ?SubType = .node,
|
||||
};
|
||||
|
||||
const SubType = enum {
|
||||
node,
|
||||
};
|
||||
|
||||
const RemoteObject = struct {
|
||||
pub fn deinit(self: RemoteObject) void {
|
||||
|
||||
Reference in New Issue
Block a user