Title: [270942] trunk/Source
Revision
270942
Author
[email protected]
Date
2020-12-17 13:22:25 -0800 (Thu, 17 Dec 2020)

Log Message

Followup patch: Still can't login to my.playstation.com
https://bugs.webkit.org/show_bug.cgi?id=219900
<rdar://problem/72062985>

Reviewed by Darin Adler.

Source/WebCore:

* en.lproj/Localizable.strings:

Source/WebKit:

Using curly quotes when constructing the Storage Access prompt message
may create issues with localizable strings. We should make a separate
localizable string for this quirk case and remove it when Sony
migrates away from third party cookies in their login flow.

* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
(WebKit::buildListForStorageAccessPrompt): Deleted.
* UIProcess/Cocoa/WKStorageAccessAlert.h:
* UIProcess/Cocoa/WKStorageAccessAlert.mm:
(WebKit::presentStorageAccessAlert):
(WebKit::presentStorageAccessAlertQuirk):
(WebKit::displayStorageAccessAlert):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270941 => 270942)


--- trunk/Source/WebCore/ChangeLog	2020-12-17 20:30:51 UTC (rev 270941)
+++ trunk/Source/WebCore/ChangeLog	2020-12-17 21:22:25 UTC (rev 270942)
@@ -1,3 +1,13 @@
+2020-12-17  Kate Cheney  <[email protected]>
+
+        Followup patch: Still can't login to my.playstation.com
+        https://bugs.webkit.org/show_bug.cgi?id=219900
+        <rdar://problem/72062985>
+
+        Reviewed by Darin Adler.
+
+        * en.lproj/Localizable.strings:
+
 2020-12-17  Fujii Hironori  <[email protected]>
 
         [CMake] Unify WebGL source files into the common WebCore/CMakeLists.txt

Modified: trunk/Source/WebCore/en.lproj/Localizable.strings (270941 => 270942)


--- trunk/Source/WebCore/en.lproj/Localizable.strings	2020-12-17 20:30:51 UTC (rev 270941)
+++ trunk/Source/WebCore/en.lproj/Localizable.strings	2020-12-17 21:22:25 UTC (rev 270942)
@@ -127,6 +127,9 @@
 /* Message for requesting cross-site cookie and website data access. */
 "Allow “%@” to use cookies and website data while browsing “%@”?" = "Allow “%@” to use cookies and website data while browsing “%@”?";
 
+/* Message for requesting cross-site cookie and website data access for multiple third party domains. */
+"Allow “%@” and “%@” to use cookies and website data while browsing “%@”?" = "Allow “%@” and “%@” to use cookies and website data while browsing “%@”?";
+
 /* Message for user media prompt */
 "Allow “%@” to use your camera and microphone?" = "Allow “%@” to use your camera and microphone?";
 
@@ -319,6 +322,9 @@
 /* Message for requesting cross-site cookie and website data access. */
 "Do you want to allow “%@” to use cookies and website data while browsing “%@”?" = "Do you want to allow “%@” to use cookies and website data while browsing “%@”?";
 
+/* Message for requesting cross-site cookie and website data access for multiple third party domains. */
+"Do you want to allow “%@” and “%@” to use cookies and website data while browsing “%@”?" = "Do you want to allow “%@” and “%@” to use cookies and website data while browsing “%@”?";
+
 /* Button title in Storage Access API prompt */
 "Don't Allow (cross-site cookie and website data access)" = "Don't Allow";
 
@@ -919,6 +925,9 @@
 /* Informative text for requesting cross-site cookie and website data access. */
 "This will allow “%@” to track your activity." = "This will allow “%@” to track your activity.";
 
+/* Informative text for requesting cross-site cookie and website data access. */
+"This will allow “%@” and “%@” to track your activity." = "This will allow “%@” and “%@” to track your activity.";
+
 /* Undo action name */
 "Tighten Kerning (Undo action name)" = "Tighten Kerning";
 

Modified: trunk/Source/WebKit/ChangeLog (270941 => 270942)


--- trunk/Source/WebKit/ChangeLog	2020-12-17 20:30:51 UTC (rev 270941)
+++ trunk/Source/WebKit/ChangeLog	2020-12-17 21:22:25 UTC (rev 270942)
@@ -1,3 +1,25 @@
+2020-12-17  Kate Cheney  <[email protected]>
+
+        Followup patch: Still can't login to my.playstation.com
+        https://bugs.webkit.org/show_bug.cgi?id=219900
+        <rdar://problem/72062985>
+
+        Reviewed by Darin Adler.
+
+        Using curly quotes when constructing the Storage Access prompt message
+        may create issues with localizable strings. We should make a separate
+        localizable string for this quirk case and remove it when Sony
+        migrates away from third party cookies in their login flow.
+
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
+        (WebKit::buildListForStorageAccessPrompt): Deleted.
+        * UIProcess/Cocoa/WKStorageAccessAlert.h:
+        * UIProcess/Cocoa/WKStorageAccessAlert.mm:
+        (WebKit::presentStorageAccessAlert):
+        (WebKit::presentStorageAccessAlertQuirk):
+        (WebKit::displayStorageAccessAlert):
+
 2020-12-17  Eric Carlson  <[email protected]>
 
         [Cocoa] WebM format reader doesn't work with a url in a <source> element

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (270941 => 270942)


--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2020-12-17 20:30:51 UTC (rev 270941)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2020-12-17 21:22:25 UTC (rev 270942)
@@ -345,15 +345,6 @@
     }).get()];
 }
 
-static String buildListForStorageAccessPrompt(const WebCore::RegistrableDomain subDomainOne, const WebCore::RegistrableDomain subDomainTwo)
-{
-    StringBuilder builder;
-    builder.append(subDomainOne.string());
-    builder.append(String([NSString stringWithFormat:@"“ and “"]));
-    builder.append(subDomainTwo.string());
-    return builder.toString();
-}
-
 void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy& webPageProxy, WebFrameProxy*, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&& completionHandler)
 {
     auto delegate = m_uiDelegate.m_delegate.get();
@@ -361,23 +352,24 @@
         completionHandler(false);
         return;
     }
-    
-    String requestingString;
+
     // Some sites have quirks where multiple login domains require storage access.
-    if (auto additionalLoginDomain = WebCore::NetworkStorageSession::findAdditionalLoginDomain(currentDomain, requestingDomain))
-        requestingString = buildListForStorageAccessPrompt(requestingDomain, *additionalLoginDomain);
-    else
-        requestingString = requestingDomain.string();
+    if (auto additionalLoginDomain = WebCore::NetworkStorageSession::findAdditionalLoginDomain(currentDomain, requestingDomain)) {
+#if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
+        presentStorageAccessAlertQuirk(m_uiDelegate.m_webView, requestingDomain, *additionalLoginDomain, currentDomain, WTFMove(completionHandler));
+#endif
+        return;
+    }
 
     if (!m_uiDelegate.m_delegateMethods.webViewRequestStorageAccessPanelUnderFirstPartyCompletionHandler) {
 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
-        presentStorageAccessAlert(m_uiDelegate.m_webView, requestingString, currentDomain, WTFMove(completionHandler));
+        presentStorageAccessAlert(m_uiDelegate.m_webView, requestingDomain, currentDomain, WTFMove(completionHandler));
 #endif
         return;
     }
 
     auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:));
-    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingString underCurrentDomain:currentDomain.string() completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
+    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingDomain.string() underCurrentDomain:currentDomain.string() completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable {
         if (checker->completionHandlerHasBeenCalled())
             return;
         completionHandler(result);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.h (270941 => 270942)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.h	2020-12-17 20:30:51 UTC (rev 270941)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.h	2020-12-17 21:22:25 UTC (rev 270942)
@@ -41,7 +41,9 @@
 
 namespace WebKit {
 
-void presentStorageAccessAlert(WKWebView *, const String& requestingString, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&&);
+void presentStorageAccessAlert(WKWebView *, const WebCore::RegistrableDomain& requestingDomain, const WebCore::RegistrableDomain& currentDomain, CompletionHandler<void(bool)>&&);
+void presentStorageAccessAlertQuirk(WKWebView *, const WebCore::RegistrableDomain& firstRequestingDomain, const WebCore::RegistrableDomain& secondRequestingDomain, const WebCore::RegistrableDomain& current, CompletionHandler<void(bool)>&&);
+void displayStorageAccessAlert(WKWebView *, NSString *, NSString *, CompletionHandler<void(bool)>&&);
 
 }
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.mm (270941 => 270942)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.mm	2020-12-17 20:30:51 UTC (rev 270941)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKStorageAccessAlert.mm	2020-12-17 21:22:25 UTC (rev 270942)
@@ -36,13 +36,9 @@
 
 namespace WebKit {
 
-void presentStorageAccessAlert(WKWebView *webView, const String& requesting, const WebCore::RegistrableDomain& current, CompletionHandler<void(bool)>&& completionHandler)
+void presentStorageAccessAlert(WKWebView *webView, const WebCore::RegistrableDomain& requesting, const WebCore::RegistrableDomain& current, CompletionHandler<void(bool)>&& completionHandler)
 {
-    auto completionBlock = makeBlockPtr([completionHandler = WTFMove(completionHandler)](bool shouldAllow) mutable {
-        completionHandler(shouldAllow);
-    });
-
-    auto requestingDomain = requesting.createCFString();
+    auto requestingDomain = requesting.string().createCFString();
     auto currentDomain = current.string().createCFString();
 
 #if PLATFORM(MAC)
@@ -52,6 +48,33 @@
 #endif
 
     NSString *informativeText = [NSString stringWithFormat:WEB_UI_NSSTRING(@"This will allow “%@” to track your activity.", @"Informative text for requesting cross-site cookie and website data access."), requestingDomain.get()];
+
+    displayStorageAccessAlert(webView, alertTitle, informativeText, WTFMove(completionHandler));
+}
+
+void presentStorageAccessAlertQuirk(WKWebView *webView, const WebCore::RegistrableDomain& firstRequesting, const WebCore::RegistrableDomain& secondRequesting, const WebCore::RegistrableDomain& current, CompletionHandler<void(bool)>&& completionHandler)
+{
+    auto firstRequestingDomain = firstRequesting.string().createCFString();
+    auto secondRequestingDomain = secondRequesting.string().createCFString();
+    auto currentDomain = current.string().createCFString();
+
+#if PLATFORM(MAC)
+    NSString *alertTitle = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Do you want to allow “%@” and “%@” to use cookies and website data while browsing “%@”?", @"Message for requesting cross-site cookie and website data access."), firstRequestingDomain.get(), secondRequestingDomain.get(), currentDomain.get()];
+#else
+    NSString *alertTitle = [NSString stringWithFormat:WEB_UI_NSSTRING(@"Allow “%@” and “%@” to use cookies and website data while browsing “%@”?", @"Message for requesting cross-site cookie and website data access."), firstRequestingDomain.get(), secondRequestingDomain.get(), currentDomain.get()];
+#endif
+
+    NSString *informativeText = [NSString stringWithFormat:WEB_UI_NSSTRING(@"This will allow “%@” and “%@” to track your activity.", @"Informative text for requesting cross-site cookie and website data access."), firstRequestingDomain.get(), secondRequestingDomain.get()];
+    
+    displayStorageAccessAlert(webView, alertTitle, informativeText, WTFMove(completionHandler));
+}
+
+void displayStorageAccessAlert(WKWebView *webView, NSString *alertTitle, NSString *informativeText, CompletionHandler<void(bool)>&& completionHandler)
+{
+    auto completionBlock = makeBlockPtr([completionHandler = WTFMove(completionHandler)](bool shouldAllow) mutable {
+        completionHandler(shouldAllow);
+    });
+
     NSString *allowButtonString = WEB_UI_STRING_KEY(@"Allow", "Allow (cross-site cookie and website data access)", @"Button title in Storage Access API prompt");
     NSString *doNotAllowButtonString = WEB_UI_STRING_KEY(@"Don't Allow", "Don't Allow (cross-site cookie and website data access)", @"Button title in Storage Access API prompt");
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to