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

Commit

Permalink
Fix 2952: Show about:blank for empty window.open
Browse files Browse the repository at this point in the history
  • Loading branch information
jumde committed Oct 19, 2020
1 parent 8afd177 commit a566464
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,12 @@ class BrowserViewController: UIViewController {
case .URL:
guard let tab = tabManager[webView] else { break }

// Special case for "about:blank" popups, if the webView.url is nil, keep the tab url as "about:blank"
if tab.url?.absoluteString == "about:blank" && webView.url == nil {
print(webView.url?.origin)
break
}

// To prevent spoofing, only change the URL immediately if the new URL is on
// the same origin as the current URL. Otherwise, do nothing and wait for
// didCommitNavigation to confirm the page load.
Expand Down Expand Up @@ -2546,6 +2552,8 @@ extension BrowserViewController: WKUIDelegate {
// IMPORTANT!!: WebKit will perform the `URLRequest` automatically!! Attempting to do
// the request here manually leads to incorrect results!!
let newTab = tabManager.addPopupForParentTab(parentTab, configuration: configuration)

newTab.url = URL(string: "about:blank")

return newTab.webView
}
Expand Down

0 comments on commit a566464

Please sign in to comment.