Skip to content

Commit

Permalink
Fix closing full-screen videos with the X button
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed May 9, 2024
1 parent 88a7504 commit fd13d64
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions DuckDuckGo/Tab/View/WebViewContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import AppKit
import Combine

final class WebViewContainerView: NSView {
@objc
let webView: WebView
weak var tab: Tab?

Expand Down Expand Up @@ -51,7 +50,6 @@ final class WebViewContainerView: NSView {
}

private var blurViewIsHiddenCancellable: AnyCancellable?
private var fullScreenWindowWillCloseCancellable: AnyCancellable?
private var cancellables = Set<AnyCancellable>()

override func didAddSubview(_ subview: NSView) {
Expand Down Expand Up @@ -140,23 +138,6 @@ final class WebViewContainerView: NSView {
}
}
.store(in: &cancellables)

fullScreenWindowWillCloseCancellable = NotificationCenter.default.publisher(for: NSWindow.willCloseNotification, object: fullScreenWindow)
.sink { [weak self] notification in
self?.fullScreenWindowWillCloseCancellable = nil
let fullScreenWindowController = (notification.object as? NSWindow)?.windowController
DispatchQueue.main.async { [weak fullScreenWindowController] in
guard let fullScreenWindowController else { return }
// just in case.
// if WKFullScreenWindowController receives `close()` the next time it‘s open it will crash because its _webView is nil
// https://errors.duckduckgo.com/organizations/ddg/issues/3411/?project=6&referrer=release-issue-stream
NSException.try {
fullScreenWindowController.setValue(NSView(), forKeyPath: #keyPath(webView))
}

}
}

}

override func removeFromSuperview() {
Expand Down

0 comments on commit fd13d64

Please sign in to comment.