Skip to content

Commit

Permalink
minor fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
garvankeeley committed Mar 31, 2020
1 parent 238d51b commit 84eb828
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,9 @@ extension BrowserViewController: WKNavigationDelegate {
return
}

// Allow plan text types
if url.hasPrefix("data:;") || url.hasPrefix("data:,") || url.hasPrefix("data:text/plain") {
// Allow plain text types.
// Note the format of data URLs is `data:[<media type>][;base64],<data>` with empty <media type> indicating plain text.
if url.hasPrefix("data:;base64,") || url.hasPrefix("data:,") || url.hasPrefix("data:text/plain,") || url.hasPrefix("data:text/plain;") {
decisionHandler(.allow)
return
}
Expand Down
2 changes: 1 addition & 1 deletion UITests/SecurityTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class SecurityTests: KIFTestCase {
beforeEach()
}

// Check data url that is no allowed
// Check data url that is not allowed
tester().tapWebViewElementWithAccessibilityLabel("data-url-html-bad")
tester().wait(forTimeInterval: 1)
let webView = tester().waitForView(withAccessibilityLabel: "Web content") as! WKWebView
Expand Down

0 comments on commit 84eb828

Please sign in to comment.