Skip to content

Commit

Permalink
Fix #6315 - disallow data URL as top-level navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
garvankeeley committed Mar 31, 2020
1 parent 96d68da commit dba6453
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,15 @@ extension BrowserViewController: WKNavigationDelegate {
return
}

if url.scheme == "data" {
decisionHandler(.cancel)
return
}

// This is the normal case, opening a http or https url, which we handle by loading them in this WKWebView. We
// always allow this. Additionally, data URIs are also handled just like normal web pages.

if ["http", "https", "data", "blob", "file"].contains(url.scheme) {
if ["http", "https", "blob", "file"].contains(url.scheme) {
if navigationAction.targetFrame?.isMainFrame ?? false {
tab.changedUserAgent = Tab.ChangeUserAgent.contains(url: url)
}
Expand Down

0 comments on commit dba6453

Please sign in to comment.