Add Safari 26 content blocker triggers#113
Add Safari 26 content blocker triggers#113hyeonjongyang wants to merge 2 commits intoAdguardTeam:masterfrom
Conversation
Sources/ContentBlockerConverter/Compiler/BlockerEntryFactory.swift
Outdated
Show resolved
Hide resolved
|
/windsurf-review |
| public var isCheckThirdParty = false | ||
| public var isThirdParty = false | ||
| public var isMatchCase = false | ||
| public var requestMethods: [String] = [] |
There was a problem hiding this comment.
Consider using Set<String> instead of [String] for the requestMethods property. This would provide more efficient membership checking and eliminate the need for the manual duplicate check on line 219.
| for domain in domains { | ||
| if domain.utf8.last == Chars.WILDCARD { | ||
| let prefix = String(domain.dropLast(2)) | ||
| let escaped = NSRegularExpression.escapedPattern(for: prefix) | ||
| result.append(#"^[^:]+://+([^:/]+\.)?\#(escaped)\.[^/:]+[/:]?"#) | ||
| } else { | ||
| result.append(try SimpleRegex.createRegexText(pattern: "||\(domain)^")) | ||
| } | ||
| } |
There was a problem hiding this comment.
There's inconsistent indentation in this method. The for loop has an extra level of indentation that doesn't match the surrounding code style.
| private static let supportedRequestMethods: Set<String> = [ | ||
| "get", | ||
| "head", | ||
| "options", | ||
| "trace", | ||
| "put", | ||
| "delete", | ||
| "post", | ||
| "patch", | ||
| "connect", | ||
| ] |
There was a problem hiding this comment.
Consider moving the supportedRequestMethods set inside the setRequestMethods method since it's only used there, or at least mark it as private static to better encapsulate it.
|
Hi, thank you for the contribution! Could you please split the PR in two parts - one for While In theory, |
|
Also, for every pull request please add a changelog entry. Relevant issues that are addressed:
|
Add Safari 26 trigger support to the content blocker compiler, including request method matching and the new frame URL domain scoping fields.
Changes
BlockerEntry.Triggerfields and encoding support:request-methodif-frame-urlunless-frame-url$method=parsing/validation for network rules (Safari 26+), normalizing method names and supporting|-separated lists.$methodvalue (Safari trigger supports a singlerequest-methodper entry).$domainscoping intoif-frame-url/unless-frame-urlpatterns (includingexample.*TLD wildcard support).Reference
Notes
$methodis rejected and domain scoping continues to useif-domain/unless-domain.