Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8664: Add content blocker to upgrade passive mixed content
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Jan 19, 2024
1 parent bd215d9 commit a2665fb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ var braveTarget: PackageDescription.Target = .target(
.copy("WebFilters/ContentBlocker/Lists/block-ads.json"),
.copy("WebFilters/ContentBlocker/Lists/block-cookies.json"),
.copy("WebFilters/ContentBlocker/Lists/block-trackers.json"),
.copy("WebFilters/ContentBlocker/Lists/mixed-content-upgrade.json"),
.copy("WebFilters/ShieldStats/Adblock/Resources/ABPFilterParserData.dat"),
],
plugins: ["LoggerPlugin"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ actor ContentBlockerManager {
case blockAds
case blockCookies
case blockTrackers
case upgradeMixedContent

func mode(isAggressiveMode: Bool) -> BlockingMode {
switch self {
Expand All @@ -60,7 +61,7 @@ actor ContentBlockerManager {
} else {
return .standard
}
case .blockCookies, .blockTrackers:
case .blockCookies, .blockTrackers, .upgradeMixedContent:
return .general
}
}
Expand All @@ -70,6 +71,7 @@ actor ContentBlockerManager {
case .blockAds: return "block-ads"
case .blockCookies: return "block-cookies"
case .blockTrackers: return "block-trackers"
case .upgradeMixedContent: return "mixed-content-upgrade"
}
}
}
Expand Down Expand Up @@ -356,6 +358,9 @@ actor ContentBlockerManager {
results.insert(.blockCookies)
}

// Always upgrade mixed content
results.insert(.upgradeMixedContent)

return results
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"trigger": {
"url-filter": "http://.*",
"if-top-url": ["https://.*"],
"resource-type": ["image", "media"]
},
"action": {
"type": "make-https"
}
}
]

0 comments on commit a2665fb

Please sign in to comment.