diff --git a/Package.swift b/Package.swift index a08eb1e2e24..4395f88d963 100644 --- a/Package.swift +++ b/Package.swift @@ -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"] diff --git a/Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift b/Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift index d14012d2012..d1b8bde2d0e 100644 --- a/Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift +++ b/Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift @@ -79,7 +79,10 @@ class TabLocationView: UIView { var title = AttributedString(Strings.tabToolbarNotSecureTitle) title.font = .preferredFont(forTextStyle: .subheadline, compatibleWith: clampedTraitCollection) - let isTitleVisible = !traitCollection.preferredContentSizeCategory.isAccessibilityCategory && bounds.width > 200 + // Hide the title with mixed content due to a WebKit bug (https://bugs.webkit.org/show_bug.cgi?id=258711) + // which fails to update `hasOnlySecureContent` even when promoting all http content. + let isTitleVisible = !traitCollection.preferredContentSizeCategory.isAccessibilityCategory && + bounds.width > 200 && secureContentState != .mixedContent switch secureContentState { case .localhost, .secure: diff --git a/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift b/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift index c47e2a38259..d8af074b38f 100644 --- a/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift +++ b/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift @@ -51,6 +51,7 @@ actor ContentBlockerManager { case blockAds case blockCookies case blockTrackers + case upgradeMixedContent func mode(isAggressiveMode: Bool) -> BlockingMode { switch self { @@ -60,7 +61,7 @@ actor ContentBlockerManager { } else { return .standard } - case .blockCookies, .blockTrackers: + case .blockCookies, .blockTrackers, .upgradeMixedContent: return .general } } @@ -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" } } } @@ -356,6 +358,9 @@ actor ContentBlockerManager { results.insert(.blockCookies) } + // Always upgrade mixed content + results.insert(.upgradeMixedContent) + return results } diff --git a/Sources/Brave/WebFilters/ContentBlocker/Lists/mixed-content-upgrade.json b/Sources/Brave/WebFilters/ContentBlocker/Lists/mixed-content-upgrade.json new file mode 100644 index 00000000000..c5fc1dd9ee5 --- /dev/null +++ b/Sources/Brave/WebFilters/ContentBlocker/Lists/mixed-content-upgrade.json @@ -0,0 +1,12 @@ +[ + { + "trigger": { + "url-filter": "http://.*", + "if-top-url": ["https://.*"], + "resource-type": ["image", "media"] + }, + "action": { + "type": "make-https" + } + } +]