Changeset 258658 in webkit


Ignore:
Timestamp:
Mar 18, 2020 12:28:39 PM (4 years ago)
Author:
mmaxfield@apple.com
Message:

REGRESSION(r254389): Cordova throws an exception because it expects a hyphen inside navigator.locale
https://bugs.webkit.org/show_bug.cgi?id=208969
<rdar://problem/59845517>

Reviewed by Darin Adler.

We want to thwart fingerprinting by minimizing the list of locales, but we also don't want to break existing apps.
We can achieve both by a linked-on-or-after check.

  • wtf/cocoa/LanguageCocoa.mm:

(WTF::canMinimizeLanguages):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r258564 r258658  
     12020-03-18  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        REGRESSION(r254389): Cordova throws an exception because it expects a hyphen inside navigator.locale
     4        https://bugs.webkit.org/show_bug.cgi?id=208969
     5        <rdar://problem/59845517>
     6
     7        Reviewed by Darin Adler.
     8
     9        We want to thwart fingerprinting by minimizing the list of locales, but we also don't want to break existing apps.
     10        We can achieve both by a linked-on-or-after check.
     11
     12        * wtf/cocoa/LanguageCocoa.mm:
     13        (WTF::canMinimizeLanguages):
     14
    1152020-03-17  Alex Christensen  <achristensen@webkit.org>
    216
  • trunk/Source/WTF/wtf/cocoa/LanguageCocoa.mm

    r254413 r258658  
    2828
    2929#import <wtf/NeverDestroyed.h>
     30#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
    3031#import <wtf/spi/cocoa/NSLocaleSPI.h>
    3132
     
    3435bool canMinimizeLanguages()
    3536{
    36     static bool result = [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
     37    static const bool result = []() -> bool {
     38#if PLATFORM(MAC)
     39        if (applicationSDKVersion() < DYLD_MACOSX_VERSION_10_15_4)
     40            return false;
     41#endif
     42#if PLATFORM(IOS)
     43        if (applicationSDKVersion() < DYLD_IOS_VERSION_13_4)
     44            return false;
     45#endif
     46        return [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)];
     47    }();
    3748    return result;
    3849}
Note: See TracChangeset for help on using the changeset viewer.