diff --git a/src/cdp/domains/runtime.zig b/src/cdp/domains/runtime.zig index 0942594b0..7e8774aa9 100644 --- a/src/cdp/domains/runtime.zig +++ b/src/cdp/domains/runtime.zig @@ -35,12 +35,28 @@ pub fn processMessage(cmd: *CDP.Command) !void { callFunctionOn, releaseObject, getProperties, + releaseObjectGroup, + awaitPromise, + compileScript, + runScript, + queryObjects, + globalLexicalScopeNames, + removeBinding, + terminateExecution, + getExceptionDetails, + discardConsoleEntries, + getHeapUsage, + getIsolateId, + setCustomObjectFormatterEnabled, + setMaxCallStackSizeToCapture, }, cmd.input.action) orelse return error.UnknownMethod; switch (action) { .runIfWaitingForDebugger => return cmd.sendResult(null, .{}), .enable => return enable(cmd), .disable => return disable(cmd), + // Bookkeeping that can neither observe nor change the page's global. + .releaseObjectGroup, .discardConsoleEntries, .getHeapUsage, .getIsolateId, .setCustomObjectFormatterEnabled, .setMaxCallStackSizeToCapture => return sendInspector(cmd, action), else => { const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded; bc.main_world_touched = true; @@ -171,6 +187,20 @@ pub fn consoleMessage(arena: Allocator, bc: *CDP.BrowserContext, event: *const N const testing = @import("../testing.zig"); +test "cdp.runtime: inspector-handled methods pass through" { + var ctx = try testing.context(); + defer ctx.deinit(); + + _ = try ctx.loadBrowserContext(.{ .id = "BID-RT", .url = "hi.html", .target_id = "FID-0000000RTP".* }); + try ctx.processMessage(.{ .id = 50, .method = "Runtime.enable" }); + + try ctx.processMessage(.{ .id = 51, .method = "Runtime.releaseObjectGroup", .params = .{ .objectGroup = "handles" } }); + try ctx.expectSentResult(null, .{ .id = 51 }); + + try ctx.processMessage(.{ .id = 52, .method = "Runtime.discardConsoleEntries" }); + try ctx.expectSentResult(null, .{ .id = 52 }); +} + test "cdp.runtime: consoleAPICalled type matches the console method" { testing.silenceLog(&.{.js});