mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
Add Page.createIsolatedWorld
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -12,6 +12,7 @@ const PageMethods = enum {
|
||||
getFrameTree,
|
||||
setLifecycleEventsEnabled,
|
||||
addScriptToEvaluateOnNewDocument,
|
||||
createIsolatedWorld,
|
||||
};
|
||||
|
||||
pub fn page(
|
||||
@@ -28,6 +29,7 @@ pub fn page(
|
||||
.getFrameTree => getFrameTree(alloc, id, scanner, ctx),
|
||||
.setLifecycleEventsEnabled => setLifecycleEventsEnabled(alloc, id, scanner, ctx),
|
||||
.addScriptToEvaluateOnNewDocument => addScriptToEvaluateOnNewDocument(alloc, id, scanner, ctx),
|
||||
.createIsolatedWorld => createIsolatedWorld(alloc, id, scanner, ctx),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -123,3 +125,21 @@ fn addScriptToEvaluateOnNewDocument(
|
||||
};
|
||||
return result(alloc, id, Res, Res{}, sessionID);
|
||||
}
|
||||
|
||||
fn createIsolatedWorld(
|
||||
alloc: std.mem.Allocator,
|
||||
id: u64,
|
||||
scanner: *std.json.Scanner,
|
||||
_: *Ctx,
|
||||
) ![]const u8 {
|
||||
|
||||
// input
|
||||
const content = try cdp.getContent(alloc, void, scanner);
|
||||
|
||||
// output
|
||||
const Resp = struct {
|
||||
executionContextId: u8 = 2,
|
||||
};
|
||||
|
||||
return result(alloc, id, Resp, .{}, content.sessionID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user