mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
Add CDP Node Registry
This expands on the existing CDP node work used in DOM.search. It introduces a node registry to track all nodes returned to the client and give lookups to get a node from a Id or a *parser.node. Eventually, the goal is to have the Registry emit the DOM.setChildNodes event whenever necessary, as well as support many of the missing DOM actions. Added tests to existing search handlers. Reworked search a little bit to avoid some unnecessary allocations and to hook it into the registry. The generated Node is currently incomplete. The parentId is missing, the children are missing. Also, we still need to associate the v8 ObjectId to the node. Finally, I moved all action handlers into a nested "domain" folder.
This commit is contained in:
29
src/cdp/domains/log.zig
Normal file
29
src/cdp/domains/log.zig
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2023-2024 Lightpanda (Selecy SAS)
|
||||
//
|
||||
// Francis Bouvier <francis@lightpanda.io>
|
||||
// Pierre Tachoire <pierre@lightpanda.io>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
pub fn processMessage(cmd: anytype) !void {
|
||||
const action = std.meta.stringToEnum(enum {
|
||||
enable,
|
||||
}, cmd.input.action) orelse return error.UnknownMethod;
|
||||
|
||||
switch (action) {
|
||||
.enable => return cmd.sendResult(null, .{}),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user