Quick-check sameness in Node.isEqualNode

Exclusively use the not_implemented log filter.
This commit is contained in:
Karl Seguin
2025-12-26 09:57:33 +08:00
parent 0fff379ee0
commit 05cb5221d4
9 changed files with 18 additions and 20 deletions

View File

@@ -2451,16 +2451,12 @@ pub fn handleClick(self: *Page, target: *Node) !void {
// Check target attribute - don't navigate if opening in new window/tab // Check target attribute - don't navigate if opening in new window/tab
const target_val = anchor.getTarget(); const target_val = anchor.getTarget();
if (target_val.len > 0 and !std.mem.eql(u8, target_val, "_self")) { if (target_val.len > 0 and !std.mem.eql(u8, target_val, "_self")) {
log.warn(.browser, "not implemented", .{ log.warn(.not_implemented, "a.target", .{});
.feature = "anchor with target attribute click",
});
return; return;
} }
if (try element.hasAttribute("download", self)) { if (try element.hasAttribute("download", self)) {
log.warn(.browser, "not implemented", .{ log.warn(.browser, "a.download", .{});
.feature = "anchor with download attribute click",
});
return; return;
} }

View File

@@ -321,6 +321,10 @@ pub fn getNodeType(self: *const Node) u8 {
} }
pub fn isEqualNode(self: *Node, other: *Node) bool { pub fn isEqualNode(self: *Node, other: *Node) bool {
if (self == other) {
return true;
}
// Make sure types match. // Make sure types match.
if (self.getNodeType() != other.getNodeType()) { if (self.getNodeType() != other.getNodeType()) {
return false; return false;
@@ -335,9 +339,8 @@ pub fn isEqualNode(self: *Node, other: *Node) bool {
.document_type => self.as(DocumentType).isEqualNode(other.as(DocumentType)), .document_type => self.as(DocumentType).isEqualNode(other.as(DocumentType)),
.document => { .document => {
// Document comparison is complex and rarely used in practice // Document comparison is complex and rarely used in practice
log.warn(.browser, "not implemented", .{ log.warn(.not_implemented, "Node.isEqualNode", .{
.type = self._type, .type = "document",
.feature = "Node.isEqualNode",
}); });
return false; return false;
}, },

View File

@@ -376,7 +376,7 @@ pub const TraverseToOptions = struct {
pub fn traverseTo(self: *Navigation, key: []const u8, _opts: ?TraverseToOptions, page: *Page) !NavigationReturn { pub fn traverseTo(self: *Navigation, key: []const u8, _opts: ?TraverseToOptions, page: *Page) !NavigationReturn {
if (_opts != null) { if (_opts != null) {
log.debug(.browser, "not implemented", .{ .options = _opts }); log.warn(.not_implemented, "Navigation.traverseTo", .{ .has_options = true });
} }
for (self._entries.items, 0..) |entry, i| { for (self._entries.items, 0..) |entry, i| {

View File

@@ -96,8 +96,7 @@ pub fn write(self: *const FormData, encoding_: ?[]const u8, writer: *std.Io.Writ
return self._list.urlEncode(.form, writer); return self._list.urlEncode(.form, writer);
} }
log.debug(.not_implemented, "not implemented", .{ log.warn(.not_implemented, "FormData.encoding", .{
.feature = "form data encoding",
.encoding = encoding, .encoding = encoding,
}); });
} }

View File

@@ -76,7 +76,7 @@ fn getDocument(cmd: anytype) !void {
const params = try cmd.params(Params) orelse Params{}; const params = try cmd.params(Params) orelse Params{};
if (params.pierce) { if (params.pierce) {
log.warn(.cdp, "not implemented", .{ .feature = "DOM.getDocument: Not implemented pierce parameter" }); log.warn(.not_implemented, "DOM.getDocument", .{ .param = "pierce" });
} }
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded; const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
@@ -315,7 +315,7 @@ fn describeNode(cmd: anytype) !void {
})) orelse return error.InvalidParams; })) orelse return error.InvalidParams;
if (params.pierce) { if (params.pierce) {
log.warn(.cdp, "not implemented", .{ .feature = "DOM.describeNode: Not implemented pierce parameter" }); log.warn(.not_implemented, "DOM.describeNode", .{ .param = "pierce" });
} }
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded; const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
@@ -497,7 +497,7 @@ fn getOuterHTML(cmd: anytype) !void {
})) orelse return error.InvalidParams; })) orelse return error.InvalidParams;
if (params.includeShadowDOM) { if (params.includeShadowDOM) {
log.warn(.cdp, "not implemented", .{ .feature = "DOM.getOuterHTML: Not implemented includeShadowDOM parameter" }); log.warn(.not_implemented, "DOM.getOuterHTML", .{ .param = "includeShadowDOM" });
} }
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded; const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
const page = bc.session.currentPage() orelse return error.PageNotLoaded; const page = bc.session.currentPage() orelse return error.PageNotLoaded;

View File

@@ -142,7 +142,7 @@ fn disable(cmd: anytype) !void {
fn enable(cmd: anytype) !void { fn enable(cmd: anytype) !void {
const params = (try cmd.params(EnableParam)) orelse EnableParam{}; const params = (try cmd.params(EnableParam)) orelse EnableParam{};
if (!arePatternsSupported(params.patterns)) { if (!arePatternsSupported(params.patterns)) {
log.warn(.cdp, "not implemented", .{ .feature = "Fetch.enable advanced patterns are not" }); log.warn(.not_implemented, "Fetch.enable", .{ .params = "pattern" });
return cmd.sendResult(null, .{}); return cmd.sendResult(null, .{});
} }
@@ -331,7 +331,7 @@ fn fulfillRequest(cmd: anytype) !void {
})) orelse return error.InvalidParams; })) orelse return error.InvalidParams;
if (params.binaryResponseHeaders != null) { if (params.binaryResponseHeaders != null) {
log.warn(.cdp, "not implemented", .{ .feature = "Fetch.fulfillRequest binaryResponseHeade" }); log.warn(.not_implemented, "Fetch.fulfillRequest", .{ .param = "binaryResponseHeaders" });
return error.NotImplemented; return error.NotImplemented;
} }

View File

@@ -178,7 +178,7 @@ fn createIsolatedWorld(cmd: anytype) !void {
grantUniveralAccess: bool = false, grantUniveralAccess: bool = false,
})) orelse return error.InvalidParams; })) orelse return error.InvalidParams;
if (!params.grantUniveralAccess) { if (!params.grantUniveralAccess) {
log.warn(.cdp, "not implemented", .{ .feature = "grantUniveralAccess == false is not yet implemented" }); log.warn(.not_implemented, "Page.createIsolatedWorld", .{ .param = "grantUniveralAccess" });
// When grantUniveralAccess == false and the client attempts to resolve // When grantUniveralAccess == false and the client attempts to resolve
// or otherwise access a DOM or other JS Object from another context that should fail. // or otherwise access a DOM or other JS Object from another context that should fail.
} }

View File

@@ -101,7 +101,7 @@ fn createBrowserContext(cmd: anytype) !void {
}); });
if (params) |p| { if (params) |p| {
if (p.disposeOnDetach or p.proxyBypassList != null or p.originsWithUniversalNetworkAccess != null) { if (p.disposeOnDetach or p.proxyBypassList != null or p.originsWithUniversalNetworkAccess != null) {
log.warn(.cdp, "not implemented", .{ .feature = "Target.createBrowserContext: Not implemented param set" }); log.warn(.not_implemented, "Target.createBrowserContext", .{ .disposeOnDetach = p.disposeOnDetach, .has_proxyBypassList = p.proxyBypassList != null, .has_originsWithUniversalNetworkAccess = p.originsWithUniversalNetworkAccess != null });
} }
} }