mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
cdp: runtime, replace "awaitPromise":true only if present
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -119,13 +119,16 @@ fn sendInspector(
|
|||||||
// remove awaitPromise true params
|
// remove awaitPromise true params
|
||||||
// TODO: delete when Promise are correctly handled by zig-js-runtime
|
// TODO: delete when Promise are correctly handled by zig-js-runtime
|
||||||
if (method == .callFunctionOn or method == .evaluate) {
|
if (method == .callFunctionOn or method == .evaluate) {
|
||||||
|
if (std.mem.indexOf(u8, msg.json, "\"awaitPromise\":true")) |_| {
|
||||||
const buf = try alloc.alloc(u8, msg.json.len + 1);
|
const buf = try alloc.alloc(u8, msg.json.len + 1);
|
||||||
defer alloc.free(buf);
|
defer alloc.free(buf);
|
||||||
_ = std.mem.replace(u8, msg.json, "\"awaitPromise\":true", "\"awaitPromise\":false", buf);
|
_ = std.mem.replace(u8, msg.json, "\"awaitPromise\":true", "\"awaitPromise\":false", buf);
|
||||||
ctx.sendInspector(buf);
|
ctx.sendInspector(buf);
|
||||||
} else {
|
return "";
|
||||||
ctx.sendInspector(msg.json);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.sendInspector(msg.json);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user