The WKUIDelegate has a method that is called when a new WKWebView is created when the web application calls window.open(). This is great to support things like OAuth flows that typically open up in external (popup) windows.
However, there is no way to correctly deal with web applications then calling window.close() on those windows.
This is a request for a new WKUIDelegate method that is called when the web application closes a window. Its signature could be something like this:
- (void) webView: (WKWebView * nonnull) webView wantsToCloseWebView: (WKWebView * nonnull) webViewToClose;
The application can then take appropriate action. Like updating the UI and releasing the WKWebView that is closing.
*** This bug has been marked as a duplicate of bug 145957 ***