mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
Compare commits
10 Commits
c9dc4ef57a
...
cdp-browse
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d91d24b12 | ||
|
|
07e603ecda | ||
|
|
52fc2c365f | ||
|
|
8f3620adf0 | ||
|
|
f7abf0956f | ||
|
|
73217f7832 | ||
|
|
52fb2010fc | ||
|
|
03ffcdb604 | ||
|
|
20314fccec | ||
|
|
018e95bea7 |
@@ -228,9 +228,9 @@ pub fn addFromElement(self: *ScriptManager, element: *parser.Element, comptime c
|
|||||||
if (source == .@"inline") {
|
if (source == .@"inline") {
|
||||||
// if we're here, it means that we have pending scripts (i.e. self.scripts
|
// if we're here, it means that we have pending scripts (i.e. self.scripts
|
||||||
// is not empty). Because the script is inline, it's complete/ready, but
|
// is not empty). Because the script is inline, it's complete/ready, but
|
||||||
// we need to process them in order
|
// we need to process them in order.
|
||||||
pending_script.complete = true;
|
pending_script.complete = true;
|
||||||
self.scripts.append(&pending_script.node);
|
pending_script.getList().append(&pending_script.node);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
log.debug(.http, "script queue", .{
|
log.debug(.http, "script queue", .{
|
||||||
@@ -651,6 +651,12 @@ pub const PendingScript = struct {
|
|||||||
return &self.manager.deferreds;
|
return &self.manager.deferreds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Module scripts are deferred by default.
|
||||||
|
// https://v8.dev/features/modules#defer
|
||||||
|
if (script.kind == .module) {
|
||||||
|
return &self.manager.deferreds;
|
||||||
|
}
|
||||||
|
|
||||||
return &self.manager.scripts;
|
return &self.manager.scripts;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const ErrorEvent = @import("../html/error_event.zig").ErrorEvent;
|
|||||||
const MessageEvent = @import("../dom/MessageChannel.zig").MessageEvent;
|
const MessageEvent = @import("../dom/MessageChannel.zig").MessageEvent;
|
||||||
const PopStateEvent = @import("../html/History.zig").PopStateEvent;
|
const PopStateEvent = @import("../html/History.zig").PopStateEvent;
|
||||||
const CompositionEvent = @import("composition_event.zig").CompositionEvent;
|
const CompositionEvent = @import("composition_event.zig").CompositionEvent;
|
||||||
const NavigationCurrentEntryChangeEvent = @import("../navigation/navigation.zig").NavigationCurrentEntryChangeEvent;
|
const NavigationCurrentEntryChangeEvent = @import("../navigation/root.zig").NavigationCurrentEntryChangeEvent;
|
||||||
|
|
||||||
// Event interfaces
|
// Event interfaces
|
||||||
pub const Interfaces = .{
|
pub const Interfaces = .{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const Interfaces = generate.Tuple(.{
|
|||||||
@import("../storage/storage.zig").Interfaces,
|
@import("../storage/storage.zig").Interfaces,
|
||||||
@import("../url/url.zig").Interfaces,
|
@import("../url/url.zig").Interfaces,
|
||||||
@import("../xhr/xhr.zig").Interfaces,
|
@import("../xhr/xhr.zig").Interfaces,
|
||||||
@import("../navigation/navigation.zig").Interfaces,
|
@import("../navigation/root.zig").Interfaces,
|
||||||
@import("../xhr/form_data.zig").Interfaces,
|
@import("../xhr/form_data.zig").Interfaces,
|
||||||
@import("../xhr/File.zig"),
|
@import("../xhr/File.zig"),
|
||||||
@import("../xmlserializer/xmlserializer.zig").Interfaces,
|
@import("../xmlserializer/xmlserializer.zig").Interfaces,
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ const parser = @import("../netsurf.zig");
|
|||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Navigation
|
// https://developer.mozilla.org/en-US/docs/Web/API/Navigation
|
||||||
const Navigation = @This();
|
const Navigation = @This();
|
||||||
|
|
||||||
const NavigationKind = @import("navigation.zig").NavigationKind;
|
const NavigationKind = @import("root.zig").NavigationKind;
|
||||||
const NavigationHistoryEntry = @import("navigation.zig").NavigationHistoryEntry;
|
const NavigationHistoryEntry = @import("root.zig").NavigationHistoryEntry;
|
||||||
const NavigationTransition = @import("navigation.zig").NavigationTransition;
|
const NavigationTransition = @import("root.zig").NavigationTransition;
|
||||||
const NavigationEventTarget = @import("NavigationEventTarget.zig");
|
const NavigationCurrentEntryChangeEvent = @import("root.zig").NavigationCurrentEntryChangeEvent;
|
||||||
|
|
||||||
const NavigationCurrentEntryChangeEvent = @import("navigation.zig").NavigationCurrentEntryChangeEvent;
|
const NavigationEventTarget = @import("NavigationEventTarget.zig");
|
||||||
|
|
||||||
pub const prototype = *NavigationEventTarget;
|
pub const prototype = *NavigationEventTarget;
|
||||||
proto: NavigationEventTarget = NavigationEventTarget{},
|
proto: NavigationEventTarget = NavigationEventTarget{},
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ const ScriptManager = @import("ScriptManager.zig");
|
|||||||
const SlotChangeMonitor = @import("SlotChangeMonitor.zig");
|
const SlotChangeMonitor = @import("SlotChangeMonitor.zig");
|
||||||
const HTMLDocument = @import("html/document.zig").HTMLDocument;
|
const HTMLDocument = @import("html/document.zig").HTMLDocument;
|
||||||
|
|
||||||
const NavigationKind = @import("navigation/navigation.zig").NavigationKind;
|
const NavigationKind = @import("navigation/root.zig").NavigationKind;
|
||||||
const NavigationCurrentEntryChangeEvent = @import("navigation/navigation.zig").NavigationCurrentEntryChangeEvent;
|
const NavigationCurrentEntryChangeEvent = @import("navigation/root.zig").NavigationCurrentEntryChangeEvent;
|
||||||
|
|
||||||
const js = @import("js/js.zig");
|
const js = @import("js/js.zig");
|
||||||
const URL = @import("../url.zig").URL;
|
const URL = @import("../url.zig").URL;
|
||||||
@@ -488,16 +488,16 @@ pub const Page = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std.debug.print("\nprimary schedule: {d}\n", .{self.scheduler.primary.count()});
|
std.debug.print("\nhigh_priority schedule: {d}\n", .{self.scheduler.high_priority.count()});
|
||||||
var it = self.scheduler.primary.iterator();
|
var it = self.scheduler.high_priority.iterator();
|
||||||
while (it.next()) |task| {
|
while (it.next()) |task| {
|
||||||
std.debug.print(" - {s} schedule: {d}ms\n", .{ task.name, task.ms - now });
|
std.debug.print(" - {s} schedule: {d}ms\n", .{ task.name, task.ms - now });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std.debug.print("\nsecondary schedule: {d}\n", .{self.scheduler.secondary.count()});
|
std.debug.print("\nlow_priority schedule: {d}\n", .{self.scheduler.low_priority.count()});
|
||||||
var it = self.scheduler.secondary.iterator();
|
var it = self.scheduler.low_priority.iterator();
|
||||||
while (it.next()) |task| {
|
while (it.next()) |task| {
|
||||||
std.debug.print(" - {s} schedule: {d}ms\n", .{ task.name, task.ms - now });
|
std.debug.print(" - {s} schedule: {d}ms\n", .{ task.name, task.ms - now });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const Allocator = std.mem.Allocator;
|
|||||||
|
|
||||||
const js = @import("js/js.zig");
|
const js = @import("js/js.zig");
|
||||||
const Page = @import("page.zig").Page;
|
const Page = @import("page.zig").Page;
|
||||||
const NavigationKind = @import("navigation/navigation.zig").NavigationKind;
|
const NavigationKind = @import("navigation/root.zig").NavigationKind;
|
||||||
const Browser = @import("browser.zig").Browser;
|
const Browser = @import("browser.zig").Browser;
|
||||||
const NavigateOpts = @import("page.zig").NavigateOpts;
|
const NavigateOpts = @import("page.zig").NavigateOpts;
|
||||||
const History = @import("html/History.zig");
|
const History = @import("html/History.zig");
|
||||||
|
|||||||
@@ -38,16 +38,22 @@ const DEV_TOOLS_WINDOW_ID = 1923710101;
|
|||||||
pub fn processMessage(cmd: anytype) !void {
|
pub fn processMessage(cmd: anytype) !void {
|
||||||
const action = std.meta.stringToEnum(enum {
|
const action = std.meta.stringToEnum(enum {
|
||||||
getVersion,
|
getVersion,
|
||||||
setDownloadBehavior,
|
setPermission,
|
||||||
getWindowForTarget,
|
|
||||||
setWindowBounds,
|
setWindowBounds,
|
||||||
|
resetPermissions,
|
||||||
|
grantPermissions,
|
||||||
|
getWindowForTarget,
|
||||||
|
setDownloadBehavior,
|
||||||
}, cmd.input.action) orelse return error.UnknownMethod;
|
}, cmd.input.action) orelse return error.UnknownMethod;
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
.getVersion => return getVersion(cmd),
|
.getVersion => return getVersion(cmd),
|
||||||
.setDownloadBehavior => return setDownloadBehavior(cmd),
|
.setPermission => return setPermission(cmd),
|
||||||
.getWindowForTarget => return getWindowForTarget(cmd),
|
|
||||||
.setWindowBounds => return setWindowBounds(cmd),
|
.setWindowBounds => return setWindowBounds(cmd),
|
||||||
|
.resetPermissions => return resetPermissions(cmd),
|
||||||
|
.grantPermissions => return grantPermissions(cmd),
|
||||||
|
.getWindowForTarget => return getWindowForTarget(cmd),
|
||||||
|
.setDownloadBehavior => return setDownloadBehavior(cmd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +95,21 @@ fn setWindowBounds(cmd: anytype) !void {
|
|||||||
return cmd.sendResult(null, .{});
|
return cmd.sendResult(null, .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: noop method
|
||||||
|
fn grantPermissions(cmd: anytype) !void {
|
||||||
|
return cmd.sendResult(null, .{});
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: noop method
|
||||||
|
fn setPermission(cmd: anytype) !void {
|
||||||
|
return cmd.sendResult(null, .{});
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: noop method
|
||||||
|
fn resetPermissions(cmd: anytype) !void {
|
||||||
|
return cmd.sendResult(null, .{});
|
||||||
|
}
|
||||||
|
|
||||||
const testing = @import("../testing.zig");
|
const testing = @import("../testing.zig");
|
||||||
test "cdp.browser: getVersion" {
|
test "cdp.browser: getVersion" {
|
||||||
var ctx = testing.context();
|
var ctx = testing.context();
|
||||||
|
|||||||
@@ -373,7 +373,11 @@ const Command = struct {
|
|||||||
\\ Defaults to
|
\\ Defaults to
|
||||||
++ (if (builtin.mode == .Debug) " pretty." else " logfmt.") ++
|
++ (if (builtin.mode == .Debug) " pretty." else " logfmt.") ++
|
||||||
\\
|
\\
|
||||||
\\ --user_agent_suffix
|
\\--log_filter_scopes
|
||||||
|
\\ Filter out too verbose logs per scope:
|
||||||
|
\\ http, unknown_prop, script_event, ...
|
||||||
|
\\
|
||||||
|
\\--user_agent_suffix
|
||||||
\\ Suffix to append to the Lightpanda/X.Y User-Agent
|
\\ Suffix to append to the Lightpanda/X.Y User-Agent
|
||||||
\\
|
\\
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user