SOAuthorizationSession::presentViewController should check WebPageProxy::isClosed()
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jul 2019 00:53:30 +0000 (00:53 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jul 2019 00:53:30 +0000 (00:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199755
<rdar://problem/52323585>

Reviewed by Chris Dumez.

WebPageProxy::pageClient() is not guaranteed to be non null all the time. Therefore, we should check
WebPageProxy::isClosed() before using it.

* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::presentViewController):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm

index cf8de6c..4959945 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-12  Jiewen Tan  <jiewen_tan@apple.com>
+
+        SOAuthorizationSession::presentViewController should check WebPageProxy::isClosed()
+        https://bugs.webkit.org/show_bug.cgi?id=199755
+        <rdar://problem/52323585>
+
+        Reviewed by Chris Dumez.
+
+        WebPageProxy::pageClient() is not guaranteed to be non null all the time. Therefore, we should check
+        WebPageProxy::isClosed() before using it.
+
+        * UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
+        (WebKit::SOAuthorizationSession::presentViewController):
+
 2019-07-12  Chris Dumez  <cdumez@apple.com>
 
         Regression(macOS Catalina): Cannot quick look html documents in Mail
index c9892dd..bcdb0c2 100644 (file)
@@ -183,7 +183,7 @@ void SOAuthorizationSession::presentViewController(SOAuthorizationViewController
 {
     ASSERT(m_state == State::Active);
     // Only expect at most one UI session for the whole authorization session.
-    if (!m_page || m_viewController) {
+    if (!m_page || m_page->isClosed() || m_viewController) {
         uiCallback(NO, adoptNS([[NSError alloc] initWithDomain:SOErrorDomain code:kSOErrorAuthorizationPresentationFailed userInfo:nil]).get());
         return;
     }