Skip to content

Commit

Permalink
Fix brave/brave-ios#7822: Fix Block scripts to work on all frames (br…
Browse files Browse the repository at this point in the history
…ave/brave-ios#7825)

Block scripts on any frame
  • Loading branch information
Brandon-T authored Aug 3, 2023
1 parent e1c54ea commit 61d88c8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,13 @@ extension BrowserViewController: WKNavigationDelegate {
// Load rule lists
let ruleLists = await ContentBlockerManager.shared.ruleLists(for: domainForShields)
tab?.contentBlocker.set(ruleLists: ruleLists)

}

let documentTargetURL: URL? = navigationAction.request.mainDocumentURL ??
navigationAction.targetFrame?.request.mainDocumentURL ??
url // Should be the same as the sourceFrame URL
if let documentTargetURL = documentTargetURL {
let domainForShields = Domain.getOrCreate(forUrl: documentTargetURL, persistent: !isPrivateBrowsing)
let isScriptsEnabled = !domainForShields.isShieldExpected(.NoScript, considerAllShieldsOption: true)
preferences.allowsContentJavaScript = isScriptsEnabled
}
Expand Down

0 comments on commit 61d88c8

Please sign in to comment.