Title: [203741] trunk/Source/WebKit2
Revision
203741
Author
ander...@apple.com
Date
2016-07-26 15:03:01 -0700 (Tue, 26 Jul 2016)

Log Message

Payment session does not end if user closes all Safari windows
https://bugs.webkit.org/show_bug.cgi?id=160213
rdar://problem/27480873

Reviewed by Tim Horton.

Listen for the NSWindowWillCloseNotification of the sheet window and hide the payment UI when
the sheet window is going to be closed.

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
* UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
(WebKit::WebPaymentCoordinatorProxy::hidePaymentUI):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (203740 => 203741)


--- trunk/Source/WebKit2/ChangeLog	2016-07-26 22:00:20 UTC (rev 203740)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-26 22:03:01 UTC (rev 203741)
@@ -1,3 +1,19 @@
+2016-07-26  Anders Carlsson  <ander...@apple.com>
+
+        Payment session does not end if user closes all Safari windows
+        https://bugs.webkit.org/show_bug.cgi?id=160213
+        rdar://problem/27480873
+
+        Reviewed by Tim Horton.
+
+        Listen for the NSWindowWillCloseNotification of the sheet window and hide the payment UI when
+        the sheet window is going to be closed.
+
+        * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
+        * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
+        (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
+        (WebKit::WebPaymentCoordinatorProxy::hidePaymentUI):
+
 2016-07-26  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [Threaded Compositor] ASSERTION FAILED: canAccessThreadLocalDataForThread(m_thread) after r203718

Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (203740 => 203741)


--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h	2016-07-26 22:00:20 UTC (rev 203740)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h	2016-07-26 22:03:01 UTC (rev 203741)
@@ -46,6 +46,7 @@
 class URL;
 }
 
+OBJC_CLASS NSObject;
 OBJC_CLASS NSWindow;
 OBJC_CLASS PKPaymentAuthorizationViewController;
 OBJC_CLASS WKPaymentAuthorizationViewControllerDelegate;
@@ -143,6 +144,7 @@
 #if PLATFORM(MAC)
     uint64_t m_showPaymentUIRequestSeed { 0 };
     RetainPtr<NSWindow> m_sheetWindow;
+    RetainPtr<NSObject *> m_sheetWindowWillCloseObserver;
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm (203740 => 203741)


--- trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm	2016-07-26 22:00:20 UTC (rev 203740)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm	2016-07-26 22:03:01 UTC (rev 203741)
@@ -74,6 +74,12 @@
 
         ASSERT(!paymentCoordinatorProxy->m_sheetWindow);
         paymentCoordinatorProxy->m_sheetWindow = [NSWindow windowWithContentViewController:viewController];
+
+        paymentCoordinatorProxy->m_sheetWindowWillCloseObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSWindowWillCloseNotification object:paymentCoordinatorProxy->m_sheetWindow.get() queue:nil usingBlock:[paymentCoordinatorProxy](NSNotification *) {
+            paymentCoordinatorProxy->hidePaymentUI();
+            paymentCoordinatorProxy->didReachFinalState();
+        }];
+
         [paymentCoordinatorProxy->m_webPageProxy.platformWindow() beginSheet:paymentCoordinatorProxy->m_sheetWindow.get() completionHandler:nullptr];
 
         completionHandler(true);
@@ -95,6 +101,9 @@
     ASSERT(m_paymentAuthorizationViewControllerDelegate);
     ASSERT(m_sheetWindow);
 
+    [[NSNotificationCenter defaultCenter] removeObserver:m_sheetWindowWillCloseObserver.get()];
+    m_sheetWindowWillCloseObserver = nullptr;
+
     [[m_sheetWindow sheetParent] endSheet:m_sheetWindow.get()];
     [m_paymentAuthorizationViewController setDelegate:nil];
     [m_paymentAuthorizationViewController setPrivateDelegate:nil];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to