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

Commit

Permalink
Fix #7822: Fix Block scripts to work on all frames (#7825)
Browse files Browse the repository at this point in the history
Block scripts on any frame
  • Loading branch information
Brandon-T authored and iccub committed Aug 3, 2023
1 parent 876870c commit 54ae744
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 54ae744

Please sign in to comment.