Changeset 248501 in webkit


Ignore:
Timestamp:
Aug 10, 2019 3:25:48 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

[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 <sabouhallawa@apple.com> 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):

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248500 r248501  
     12019-08-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        [iOS] Add a quirk for gmail.com messages on iPhone iOS13
     4        https://bugs.webkit.org/show_bug.cgi?id=200605
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        Add a quirk which sets the user agent for gmail.com messages on iPhone
     9        OS 13 to be iPhone OS 12. This is a workaround for a gmail.com bug till
     10        it is fixed.
     11
     12        * page/Quirks.cpp:
     13        (WebCore::Quirks::shouldAvoidUsingIOS13ForGmail const):
     14        * page/Quirks.h:
     15        * platform/UserAgent.h:
     16        * platform/ios/UserAgentIOS.mm:
     17        (WebCore::osNameForUserAgent):
     18        (WebCore::standardUserAgentWithApplicationName):
     19        * platform/mac/UserAgentMac.mm:
     20        (WebCore::standardUserAgentWithApplicationName):
     21
    1222019-08-10  Thibault Saunier  <tsaunier@igalia.com>
    223
  • trunk/Source/WebCore/page/Quirks.cpp

    r248499 r248501  
    3737#include "RuntimeEnabledFeatures.h"
    3838#include "Settings.h"
     39#include "UserAgent.h"
    3940
    4041namespace WebCore {
     
    227228
    228229    return equalLettersIgnoringASCIICase(m_document->url().host(), "www.youtube.com");
     230#else
     231    return false;
     232#endif
     233}
     234
     235bool Quirks::shouldAvoidUsingIOS13ForGmail() const
     236{
     237#if PLATFORM(IOS_FAMILY)
     238    if (!needsQuirks())
     239        return false;
     240
     241    auto& url = m_document->topDocument().url();
     242    return equalLettersIgnoringASCIICase(url.host(), "mail.google.com");
    229243#else
    230244    return false;
  • trunk/Source/WebCore/page/Quirks.h

    r248499 r248501  
    7171
    7272    WEBCORE_EXPORT bool needsYouTubeMouseOutQuirk() const;
     73   
     74    WEBCORE_EXPORT bool shouldAvoidUsingIOS13ForGmail() const;
    7375
    7476    bool needsGMailOverflowScrollQuirk() const;
  • trunk/Source/WebCore/platform/UserAgent.h

    r243525 r248501  
    3333#if PLATFORM(COCOA)
    3434enum class UserAgentType { Default, Desktop };
    35 WEBCORE_EXPORT String standardUserAgentWithApplicationName(const String& applicationName, UserAgentType = UserAgentType::Default);
     35WEBCORE_EXPORT String standardUserAgentWithApplicationName(const String& applicationName, const String& userAgentOSVersion = emptyString(), UserAgentType = UserAgentType::Default);
    3636
    37 String systemMarketingVersionForUserAgentString();
     37WEBCORE_EXPORT String osNameForUserAgent();
     38WEBCORE_EXPORT String systemMarketingVersionForUserAgentString();
    3839#else
    3940
  • trunk/Source/WebCore/platform/ios/UserAgentIOS.mm

    r245472 r248501  
    5353}
    5454
    55 static inline String osNameForUserAgent()
     55String osNameForUserAgent()
    5656{
    5757    if (deviceHasIPadCapability() && !isClassicPhone())
     
    8080}
    8181
    82 String standardUserAgentWithApplicationName(const String& applicationName, UserAgentType type)
     82String standardUserAgentWithApplicationName(const String& applicationName, const String& userAgentOSVersion, UserAgentType type)
    8383{
    8484    if (type == UserAgentType::Desktop) {
     
    9696    }
    9797
    98     String osVersion = systemMarketingVersionForUserAgentString();
     98    String osVersion = userAgentOSVersion.isEmpty()  ? systemMarketingVersionForUserAgentString() : userAgentOSVersion;
    9999    String appNameSuffix = applicationName.isEmpty() ? "" : makeString(" ", applicationName);
    100100
  • trunk/Source/WebCore/platform/mac/UserAgentMac.mm

    r243525 r248501  
    3333namespace WebCore {
    3434
    35 String standardUserAgentWithApplicationName(const String& applicationName, UserAgentType)
     35String standardUserAgentWithApplicationName(const String& applicationName, const String&, UserAgentType)
    3636{
    3737    String osVersion = systemMarketingVersionForUserAgentString();
  • trunk/Source/WebKit/ChangeLog

    r248498 r248501  
     12019-08-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        [iOS] Add a quirk for gmail.com messages on iPhone iOS13
     4        https://bugs.webkit.org/show_bug.cgi?id=200605
     5
     6        Reviewed by Maciej Stachowiak.
     7
     8        Use WebPage::platformUserAgent() to add the gmail.com quirk.
     9
     10        * UIProcess/ios/WebPageProxyIOS.mm:
     11        (WebKit::WebPageProxy::effectiveContentModeAfterAdjustingPolicies):
     12        * WebProcess/WebPage/ios/WebPageIOS.mm:
     13        (WebKit::WebPage::platformUserAgent const):
     14
    1152019-08-10  Tim Horton  <timothy_horton@apple.com>
    216
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r248338 r248501  
    14281428        if (applicationName.isEmpty())
    14291429            applicationName = applicationNameForDesktopUserAgent();
    1430         policies.setCustomUserAgent(standardUserAgentWithApplicationName(applicationName, UserAgentType::Desktop));
     1430        policies.setCustomUserAgent(standardUserAgentWithApplicationName(applicationName, emptyString(), UserAgentType::Desktop));
    14311431    }
    14321432
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r248447 r248501  
    124124#import <WebCore/TextIndicator.h>
    125125#import <WebCore/TextIterator.h>
     126#import <WebCore/UserAgent.h>
    126127#import <WebCore/VisibleUnits.h>
    127128#import <WebCore/WebEvent.h>
     
    37833784String WebPage::platformUserAgent(const URL&) const
    37843785{
     3786    if (!m_page->settings().needsSiteSpecificQuirks())
     3787        return String();
     3788
     3789    auto document = m_mainFrame->coreFrame()->document();
     3790    if (!document)
     3791        return String();
     3792
     3793    if (document->quirks().shouldAvoidUsingIOS13ForGmail() && osNameForUserAgent() == "iPhone OS" && systemMarketingVersionForUserAgentString() == "13_1")
     3794        return standardUserAgentWithApplicationName({ }, "12_1_3");
     3795
    37853796    return String();
    37863797}
Note: See TracChangeset for help on using the changeset viewer.