From fcaae2f4408bcd9dad6b573dfa917329ee83ef2b Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Mon, 29 Sep 2025 15:09:59 -0400 Subject: [PATCH] [iOS] Ensure content blocker compilation is initiated on the main thread (#31483) WebKit APIs are main actor isolated by default and should be called from there. The Swift compiler should have executed this code anyways on main because of the `await` + `WK_SWIFT_UI_ACTOR` used but doesn't seem to be doing it correctly for WebKit async generated APIs. --- .../ContentBlocker/ContentBlockerManager.swift | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ios/brave-ios/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift b/ios/brave-ios/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift index 06f803d03e8..a1d3a04669c 100644 --- a/ios/brave-ios/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift +++ b/ios/brave-ios/Sources/Brave/WebFilters/ContentBlocker/ContentBlockerManager.swift @@ -430,12 +430,10 @@ import os.log ) do { - let ruleList = try await Task.detached { - return try await self.ruleStore.compileContentRuleList( - forIdentifier: identifier, - encodedContentRuleList: encodedContentRuleList - ) - }.value + let ruleList = try await self.ruleStore.compileContentRuleList( + forIdentifier: identifier, + encodedContentRuleList: encodedContentRuleList + ) guard let ruleList = ruleList else { throw CompileError.noRuleListReturned } Self.signpost.endInterval("compileRuleList", state) return ruleList