Title: [248578] branches/safari-608-branch/Source
Revision
248578
Author
[email protected]
Date
2019-08-12 16:42:52 -0700 (Mon, 12 Aug 2019)

Log Message

Cherry-pick r248501. rdar://problem/54130614

    [iOS] Add a quirk for gmail.com messages on iPhone iOS13
    https://bugs.webkit.org/show_bug.cgi?id=200605

    Patch by Said Abou-Hallawa <[email protected]> on 2019-08-10
    Reviewed by Maciej Stachowiak.

    Source/WebCore:

    Add a quirk which sets the user agent for gmail.com messages on iPhone
    OS 13 to be iPhone OS 12. This is a workaround for a gmail.com bug till
    it is fixed.

    * page/Quirks.cpp:
    (WebCore::Quirks::shouldAvoidUsingIOS13ForGmail const):
    * page/Quirks.h:
    * platform/UserAgent.h:
    * platform/ios/UserAgentIOS.mm:
    (WebCore::osNameForUserAgent):
    (WebCore::standardUserAgentWithApplicationName):
    * platform/mac/UserAgentMac.mm:
    (WebCore::standardUserAgentWithApplicationName):

    Source/WebKit:

    Use WebPage::platformUserAgent() to add the gmail.com quirk.

    * UIProcess/ios/WebPageProxyIOS.mm:
    (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
    * WebProcess/WebPage/ios/WebPageIOS.mm:
    (WebKit::WebPage::platformUserAgent const):

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (248577 => 248578)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-08-12 23:42:52 UTC (rev 248578)
@@ -1,5 +1,63 @@
 2019-08-12  Alan Coon  <[email protected]>
 
+        Cherry-pick r248501. rdar://problem/54130614
+
+    [iOS] Add a quirk for gmail.com messages on iPhone iOS13
+    https://bugs.webkit.org/show_bug.cgi?id=200605
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2019-08-10
+    Reviewed by Maciej Stachowiak.
+    
+    Source/WebCore:
+    
+    Add a quirk which sets the user agent for gmail.com messages on iPhone
+    OS 13 to be iPhone OS 12. This is a workaround for a gmail.com bug till
+    it is fixed.
+    
+    * page/Quirks.cpp:
+    (WebCore::Quirks::shouldAvoidUsingIOS13ForGmail const):
+    * page/Quirks.h:
+    * platform/UserAgent.h:
+    * platform/ios/UserAgentIOS.mm:
+    (WebCore::osNameForUserAgent):
+    (WebCore::standardUserAgentWithApplicationName):
+    * platform/mac/UserAgentMac.mm:
+    (WebCore::standardUserAgentWithApplicationName):
+    
+    Source/WebKit:
+    
+    Use WebPage::platformUserAgent() to add the gmail.com quirk.
+    
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::WebPage::platformUserAgent const):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-10  Said Abou-Hallawa  <[email protected]>
+
+            [iOS] Add a quirk for gmail.com messages on iPhone iOS13
+            https://bugs.webkit.org/show_bug.cgi?id=200605
+
+            Reviewed by Maciej Stachowiak.
+
+            Add a quirk which sets the user agent for gmail.com messages on iPhone
+            OS 13 to be iPhone OS 12. This is a workaround for a gmail.com bug till
+            it is fixed.
+
+            * page/Quirks.cpp:
+            (WebCore::Quirks::shouldAvoidUsingIOS13ForGmail const):
+            * page/Quirks.h:
+            * platform/UserAgent.h:
+            * platform/ios/UserAgentIOS.mm:
+            (WebCore::osNameForUserAgent):
+            (WebCore::standardUserAgentWithApplicationName):
+            * platform/mac/UserAgentMac.mm:
+            (WebCore::standardUserAgentWithApplicationName):
+
+2019-08-12  Alan Coon  <[email protected]>
+
         Cherry-pick r248494. rdar://problem/54171876
 
     Universal XSS in JSObject::putInlineSlow and JSValue::putToPrimitive

Modified: branches/safari-608-branch/Source/WebCore/page/Quirks.cpp (248577 => 248578)


--- branches/safari-608-branch/Source/WebCore/page/Quirks.cpp	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebCore/page/Quirks.cpp	2019-08-12 23:42:52 UTC (rev 248578)
@@ -35,6 +35,7 @@
 #include "HTMLObjectElement.h"
 #include "LayoutUnit.h"
 #include "Settings.h"
+#include "UserAgent.h"
 
 namespace WebCore {
 
@@ -230,6 +231,19 @@
 #endif
 }
 
+bool Quirks::shouldAvoidUsingIOS13ForGmail() const
+{
+#if PLATFORM(IOS_FAMILY)
+    if (!needsQuirks())
+        return false;
+
+    auto& url = ""
+    return equalLettersIgnoringASCIICase(url.host(), "mail.google.com");
+#else
+    return false;
+#endif
+}
+
 bool Quirks::shouldSuppressAutocorrectionAndAutocaptializationInHiddenEditableAreas() const
 {
     if (!needsQuirks())

Modified: branches/safari-608-branch/Source/WebCore/page/Quirks.h (248577 => 248578)


--- branches/safari-608-branch/Source/WebCore/page/Quirks.h	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebCore/page/Quirks.h	2019-08-12 23:42:52 UTC (rev 248578)
@@ -69,6 +69,8 @@
     WEBCORE_EXPORT bool shouldAvoidScrollingWhenFocusedContentIsVisible() const;
 
     WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
+    
+    WEBCORE_EXPORT bool shouldAvoidUsingIOS13ForGmail() const;
 
     bool needsGMailOverflowScrollQuirk() const;
     bool needsYouTubeOverflowScrollQuirk() const;

Modified: branches/safari-608-branch/Source/WebCore/platform/UserAgent.h (248577 => 248578)


--- branches/safari-608-branch/Source/WebCore/platform/UserAgent.h	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebCore/platform/UserAgent.h	2019-08-12 23:42:52 UTC (rev 248578)
@@ -32,9 +32,10 @@
 
 #if PLATFORM(COCOA)
 enum class UserAgentType { Default, Desktop };
-WEBCORE_EXPORT String standardUserAgentWithApplicationName(const String& applicationName, UserAgentType = UserAgentType::Default);
+WEBCORE_EXPORT String standardUserAgentWithApplicationName(const String& applicationName, const String& userAgentOSVersion = emptyString(), UserAgentType = UserAgentType::Default);
 
-String systemMarketingVersionForUserAgentString();
+WEBCORE_EXPORT String osNameForUserAgent();
+WEBCORE_EXPORT String systemMarketingVersionForUserAgentString();
 #else
 
 WEBCORE_EXPORT String standardUserAgent(const String& applicationName = emptyString(), const String& applicationVersion = emptyString());

Modified: branches/safari-608-branch/Source/WebCore/platform/ios/UserAgentIOS.mm (248577 => 248578)


--- branches/safari-608-branch/Source/WebCore/platform/ios/UserAgentIOS.mm	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebCore/platform/ios/UserAgentIOS.mm	2019-08-12 23:42:52 UTC (rev 248578)
@@ -52,7 +52,7 @@
     return isClassic() && [PAL::getUIApplicationClass() _classicMode] != UIApplicationSceneClassicModeOriginalPad;
 }
 
-static inline String osNameForUserAgent()
+String osNameForUserAgent()
 {
     if (deviceHasIPadCapability() && !isClassicPhone())
         return "OS";
@@ -79,7 +79,7 @@
     return name;
 }
 
-String standardUserAgentWithApplicationName(const String& applicationName, UserAgentType type)
+String standardUserAgentWithApplicationName(const String& applicationName, const String& userAgentOSVersion, UserAgentType type)
 {
     if (type == UserAgentType::Desktop) {
         String appNameSuffix = applicationName.isEmpty() ? "" : makeString(" ", applicationName);
@@ -95,7 +95,7 @@
         CFRelease(override);
     }
 
-    String osVersion = systemMarketingVersionForUserAgentString();
+    String osVersion = userAgentOSVersion.isEmpty()  ? systemMarketingVersionForUserAgentString() : userAgentOSVersion;
     String appNameSuffix = applicationName.isEmpty() ? "" : makeString(" ", applicationName);
 
     return makeString("Mozilla/5.0 (", deviceNameForUserAgent(), "; CPU ", osNameForUserAgent(), " ", osVersion, " like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko)", appNameSuffix);

Modified: branches/safari-608-branch/Source/WebCore/platform/mac/UserAgentMac.mm (248577 => 248578)


--- branches/safari-608-branch/Source/WebCore/platform/mac/UserAgentMac.mm	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebCore/platform/mac/UserAgentMac.mm	2019-08-12 23:42:52 UTC (rev 248578)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-String standardUserAgentWithApplicationName(const String& applicationName, UserAgentType)
+String standardUserAgentWithApplicationName(const String& applicationName, const String&, UserAgentType)
 {
     String osVersion = systemMarketingVersionForUserAgentString();
     String appNameSuffix = applicationName.isEmpty() ? "" : makeString(" ", applicationName);

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (248577 => 248578)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-08-12 23:42:52 UTC (rev 248578)
@@ -1,5 +1,56 @@
 2019-08-12  Alan Coon  <[email protected]>
 
+        Cherry-pick r248501. rdar://problem/54130614
+
+    [iOS] Add a quirk for gmail.com messages on iPhone iOS13
+    https://bugs.webkit.org/show_bug.cgi?id=200605
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2019-08-10
+    Reviewed by Maciej Stachowiak.
+    
+    Source/WebCore:
+    
+    Add a quirk which sets the user agent for gmail.com messages on iPhone
+    OS 13 to be iPhone OS 12. This is a workaround for a gmail.com bug till
+    it is fixed.
+    
+    * page/Quirks.cpp:
+    (WebCore::Quirks::shouldAvoidUsingIOS13ForGmail const):
+    * page/Quirks.h:
+    * platform/UserAgent.h:
+    * platform/ios/UserAgentIOS.mm:
+    (WebCore::osNameForUserAgent):
+    (WebCore::standardUserAgentWithApplicationName):
+    * platform/mac/UserAgentMac.mm:
+    (WebCore::standardUserAgentWithApplicationName):
+    
+    Source/WebKit:
+    
+    Use WebPage::platformUserAgent() to add the gmail.com quirk.
+    
+    * UIProcess/ios/WebPageProxyIOS.mm:
+    (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::WebPage::platformUserAgent const):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-10  Said Abou-Hallawa  <[email protected]>
+
+            [iOS] Add a quirk for gmail.com messages on iPhone iOS13
+            https://bugs.webkit.org/show_bug.cgi?id=200605
+
+            Reviewed by Maciej Stachowiak.
+
+            Use WebPage::platformUserAgent() to add the gmail.com quirk.
+
+            * UIProcess/ios/WebPageProxyIOS.mm:
+            (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
+            * WebProcess/WebPage/ios/WebPageIOS.mm:
+            (WebKit::WebPage::platformUserAgent const):
+
+2019-08-12  Alan Coon  <[email protected]>
+
         Cherry-pick r248481. rdar://problem/54130658
 
     [iOS WK2] Remove context menu hints on navigation

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (248577 => 248578)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-08-12 23:42:52 UTC (rev 248578)
@@ -1409,7 +1409,7 @@
         auto applicationName = policies.applicationNameForDesktopUserAgent();
         if (applicationName.isEmpty())
             applicationName = applicationNameForDesktopUserAgent();
-        policies.setCustomUserAgent(standardUserAgentWithApplicationName(applicationName, UserAgentType::Desktop));
+        policies.setCustomUserAgent(standardUserAgentWithApplicationName(applicationName, emptyString(), UserAgentType::Desktop));
     }
 
     if (policies.customNavigatorPlatform().isEmpty()) {

Modified: branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (248577 => 248578)


--- branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-08-12 23:42:48 UTC (rev 248577)
+++ branches/safari-608-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-08-12 23:42:52 UTC (rev 248578)
@@ -123,6 +123,7 @@
 #import <WebCore/StyleProperties.h>
 #import <WebCore/TextIndicator.h>
 #import <WebCore/TextIterator.h>
+#import <WebCore/UserAgent.h>
 #import <WebCore/VisibleUnits.h>
 #import <WebCore/WebEvent.h>
 #import <wtf/MathExtras.h>
@@ -3783,6 +3784,16 @@
 
 String WebPage::platformUserAgent(const URL&) const
 {
+    if (!m_page->settings().needsSiteSpecificQuirks())
+        return String();
+
+    auto document = m_mainFrame->coreFrame()->document();
+    if (!document)
+        return String();
+
+    if (document->quirks().shouldAvoidUsingIOS13ForGmail() && osNameForUserAgent() == "iPhone OS" && systemMarketingVersionForUserAgentString() == "13_1")
+        return standardUserAgentWithApplicationName({ }, "12_1_3");
+
     return String();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to