[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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user