mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
Handle Runtime.evaluate (no-op)
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -10,6 +10,7 @@ const stringify = cdp.stringify;
|
||||
const RuntimeMethods = enum {
|
||||
enable,
|
||||
runIfWaitingForDebugger,
|
||||
evaluate,
|
||||
};
|
||||
|
||||
pub fn runtime(
|
||||
@@ -24,6 +25,7 @@ pub fn runtime(
|
||||
return switch (method) {
|
||||
.enable => enable(alloc, id, scanner, ctx),
|
||||
.runIfWaitingForDebugger => runIfWaitingForDebugger(alloc, id, scanner, ctx),
|
||||
.evaluate => evaluate(alloc, id, scanner, ctx),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -103,3 +105,25 @@ fn runIfWaitingForDebugger(
|
||||
const sessionID = try cdp.getSessionID(scanner);
|
||||
return result(alloc, id, null, null, sessionID);
|
||||
}
|
||||
|
||||
fn evaluate(
|
||||
alloc: std.mem.Allocator,
|
||||
_: u64,
|
||||
scanner: *std.json.Scanner,
|
||||
_: *Ctx,
|
||||
) ![]const u8 {
|
||||
|
||||
// input
|
||||
const Params = struct {
|
||||
expression: []const u8,
|
||||
contextId: ?u8,
|
||||
};
|
||||
|
||||
const input = try cdp.getContent(alloc, Params, scanner);
|
||||
const sessionID = input.sessionID;
|
||||
std.debug.assert(sessionID != null);
|
||||
|
||||
std.log.debug("expr: len {d}", .{input.params.expression.len});
|
||||
|
||||
return error.CDPNormal;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const Error = IOError || std.fmt.ParseIntError || cdp.Error || NoError;
|
||||
// I/O Recv
|
||||
// --------
|
||||
|
||||
const BufReadSize = 1024;
|
||||
const BufReadSize = 1024; // 1KB
|
||||
|
||||
pub const Cmd = struct {
|
||||
|
||||
@@ -332,7 +332,7 @@ pub fn listen(browser: *Browser, socket: std.os.socket_t) anyerror!void {
|
||||
const loop = browser.currentSession().loop;
|
||||
|
||||
// MsgBuffer
|
||||
var msg_buf = try MsgBuffer.init(loop.alloc, BufReadSize);
|
||||
var msg_buf = try MsgBuffer.init(loop.alloc, BufReadSize * 256); // 256KB
|
||||
defer msg_buf.deinit(loop.alloc);
|
||||
|
||||
// create I/O contexts and callbacks
|
||||
|
||||
Reference in New Issue
Block a user