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

Commit

Permalink
Fix #456: Popup windows now work properly in private mode. (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Reis authored Mar 27, 2019
1 parent db29abd commit 829037e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion Client/Frontend/Browser/BraveWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class BraveWebView: WKWebView {

init(frame: CGRect, configuration: WKWebViewConfiguration = WKWebViewConfiguration(), privacyProtection: PrivacyProtectionProtocol = PrivacyProtection()) {
if privacyProtection.nonPersistent {
configuration.processPool = WKProcessPool()
configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent()
}

Expand Down
7 changes: 1 addition & 6 deletions Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2105,12 +2105,7 @@ private let schemesAllowedToBeOpenedAsPopups = ["http", "https", "javascript", "

extension BrowserViewController: WKUIDelegate {
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
/* Fix for #446, when in private mode the WKProcessPool of the configuration is changed,
this leads to a crash for popups ie window.open where the configuration is created by parent wkwebview.
To handle this for now we are stopping popup when in private mode.
The fix is done in guard statement below.
*/
guard let parentTab = tabManager[webView], !parentTab.isPrivate else { return nil }
guard let parentTab = tabManager[webView] else { return nil }

guard navigationAction.isAllowed, shouldRequestBeOpenedAsPopup(navigationAction.request) else {
print("Denying popup from request: \(navigationAction.request)")
Expand Down

0 comments on commit 829037e

Please sign in to comment.