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
const target_val = anchor.getTarget();
if (target_val.len > 0 and !std.mem.eql(u8, target_val, "_self")) {
log.warn(.browser, "not implemented", .{
.feature = "anchor with target attribute click",
});
log.warn(.not_implemented, "a.target", .{});
return;
}
if (try element.hasAttribute("download", self)) {
log.warn(.browser, "not implemented", .{
.feature = "anchor with download attribute click",
});
log.warn(.browser, "a.download", .{});
return;
}

View File

@@ -151,7 +151,7 @@ pub fn createAttribute(_: *const Document, name: []const u8, page: *Page) !?*Ele
pub fn createAttributeNS(_: *const Document, namespace: []const u8, name: []const u8, page: *Page) !?*Element.Attribute {
if (std.mem.eql(u8, namespace, "http://www.w3.org/1999/xhtml") == false) {
log.warn(.not_implemented, "document.createAttributeNS", .{.namespace = namespace});
log.warn(.not_implemented, "document.createAttributeNS", .{ .namespace = namespace });
}
try Element.Attribute.validateAttributeName(name);

View File

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

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);
}
log.debug(.not_implemented, "not implemented", .{
.feature = "form data encoding",
log.warn(.not_implemented, "FormData.encoding", .{
.encoding = encoding,
});
}

View File

@@ -76,7 +76,7 @@ fn getDocument(cmd: anytype) !void {
const params = try cmd.params(Params) orelse Params{};
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;
@@ -315,7 +315,7 @@ fn describeNode(cmd: anytype) !void {
})) orelse return error.InvalidParams;
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;
@@ -497,7 +497,7 @@ fn getOuterHTML(cmd: anytype) !void {
})) orelse return error.InvalidParams;
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 page = bc.session.currentPage() orelse return error.PageNotLoaded;

View File

@@ -142,7 +142,7 @@ fn disable(cmd: anytype) !void {
fn enable(cmd: anytype) !void {
const params = (try cmd.params(EnableParam)) orelse EnableParam{};
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, .{});
}
@@ -331,7 +331,7 @@ fn fulfillRequest(cmd: anytype) !void {
})) orelse return error.InvalidParams;
if (params.binaryResponseHeaders != null) {
log.warn(.cdp, "not implemented", .{ .feature = "Fetch.fulfillRequest binaryResponseHeade" });
log.warn(.not_implemented, "Fetch.fulfillRequest", .{ .param = "binaryResponseHeaders" });
return error.NotImplemented;
}

View File

@@ -178,7 +178,7 @@ fn createIsolatedWorld(cmd: anytype) !void {
grantUniveralAccess: bool = false,
})) orelse return error.InvalidParams;
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
// 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 (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 });
}
}