RESOLVED FIXED Bug 208969
REGRESSION(r254389): Cordova throws an exception because it expects a hyphen inside navigator.locale
https://bugs.webkit.org/show_bug.cgi?id=208969
Summary REGRESSION(r254389): Cordova throws an exception because it expects a hyphen ...
Myles C. Maxfield
Reported 2020-03-11 19:27:33 PDT
REGRESSION(r254389): Cordova throws an exception because it expects a hyphen inside navigator.locale
Attachments
Patch (1.85 KB, patch)
2020-03-11 19:29 PDT, Myles C. Maxfield
no flags
WIP (2.18 KB, patch)
2020-03-13 16:49 PDT, Myles C. Maxfield
no flags
Patch (1.95 KB, patch)
2020-03-13 18:07 PDT, Myles C. Maxfield
darin: review+
Patch for committing (1.98 KB, patch)
2020-03-17 19:17 PDT, Myles C. Maxfield
no flags
Myles C. Maxfield
Comment 1 2020-03-11 19:29:15 PDT
Myles C. Maxfield
Comment 2 2020-03-11 19:29:18 PDT
Keith Rollin
Comment 3 2020-03-11 20:52:42 PDT
Comment on attachment 393329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393329&action=review > Source/WTF/wtf/cocoa/LanguageCocoa.mm:40 > +#elif PLATFORM(IOS_FAMILY) > + static bool applicationVersionCheck = dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_13_4; I want to make sure this platform and version checking is correct. The PLATFORM(IOS_FAMILY) check will be True for tvOS and watchOS, as well as iOS. But that DYLD_IOS_VERSION_13_4 seems to be iOS-only. So should the pre-processor conditional actually be just PLATFORM(IOS)? And what should happen with macCatalyst? PLATFORM(IOS) will return False for macCatalyst, so if we want to support that platform, we'd also need a PLATFORM(MACCATALYST) check (I assume the iOS version number would be appropriate for that platform?).
Chris Dumez
Comment 4 2020-03-12 07:41:54 PDT
Comment on attachment 393329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393329&action=review > Source/WTF/wtf/cocoa/LanguageCocoa.mm:38 > + static bool applicationVersionCheck = dyld_get_program_sdk_version() >= DYLD_MACOSX_VERSION_10_15_4; I don't think calling dyld_get_program_sdk_version() in the WebKit2 WebContent process will do what you want. AFAIK, dyld_get_program_sdk_version() will only do what you want in the wK2 UIProcess or WK1.
Myles C. Maxfield
Comment 5 2020-03-12 18:04:27 PDT
Comment on attachment 393329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393329&action=review >> Source/WTF/wtf/cocoa/LanguageCocoa.mm:38 >> + static bool applicationVersionCheck = dyld_get_program_sdk_version() >= DYLD_MACOSX_VERSION_10_15_4; > > I don't think calling dyld_get_program_sdk_version() in the WebKit2 WebContent process will do what you want. AFAIK, dyld_get_program_sdk_version() will only do what you want in the wK2 UIProcess or WK1. Good catch! I'm pursuing this in https://bugs.webkit.org/show_bug.cgi?id=209030.
Myles C. Maxfield
Comment 6 2020-03-13 13:52:21 PDT
Comment on attachment 393329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393329&action=review >> Source/WTF/wtf/cocoa/LanguageCocoa.mm:40 >> + static bool applicationVersionCheck = dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_13_4; > > I want to make sure this platform and version checking is correct. The PLATFORM(IOS_FAMILY) check will be True for tvOS and watchOS, as well as iOS. But that DYLD_IOS_VERSION_13_4 seems to be iOS-only. So should the pre-processor conditional actually be just PLATFORM(IOS)? And what should happen with macCatalyst? PLATFORM(IOS) will return False for macCatalyst, so if we want to support that platform, we'd also need a PLATFORM(MACCATALYST) check (I assume the iOS version number would be appropriate for that platform?). From my testing: tvOS: 0xD0400 watchOS: 0xD0200 macOS: 0xA0F04 iOS: 0xD0400
Myles C. Maxfield
Comment 7 2020-03-13 16:49:00 PDT
Myles C. Maxfield
Comment 8 2020-03-13 18:07:35 PDT
Darin Adler
Comment 9 2020-03-15 17:31:24 PDT
Comment on attachment 393565 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393565&action=review > Source/WTF/wtf/cocoa/LanguageCocoa.mm:44 > +#if PLATFORM(MAC) > + static bool applicationVersionCheck = applicationSDKVersion() >= DYLD_MACOSX_VERSION_10_15_4; > +#elif PLATFORM(IOS) > + static bool applicationVersionCheck = applicationSDKVersion() >= DYLD_IOS_VERSION_13_4; > +#elif > + static bool applicationVersionCheck = true; > +#endif > + static bool result = applicationVersionCheck && [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)]; I suggest static const bool or static constexpr for all of these. But also, not elegant to have two globals since the first is only used to compute the second. So write it like this: static const bool result = [] { #if PLATFORM(MAC) if (applicationSDKVersion() < DYLD_MACOSX_VERSION_10_15_4) return false; #endif #if PLATFORM(IOS) if (applicationSDKVersion() < DYLD_IOS_VERSION_13_4) return false; #elif return [NSLocale respondsToSelector:@selector(minimizedLanguagesFromLanguages:)]; }();
Myles C. Maxfield
Comment 10 2020-03-17 19:17:08 PDT
Created attachment 393810 [details] Patch for committing
EWS
Comment 11 2020-03-18 12:28:44 PDT
Committed r258658: <https://trac.webkit.org/changeset/258658> All reviewed patches have been landed. Closing bug and clearing flags on attachment 393810 [details].
Note You need to log in before you can comment on or make changes to this bug.