Bug 216484 - Date/time inputs should not use user-specified formats
Summary: Date/time inputs should not use user-specified formats
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Aditya Keerthi
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-14 10:54 PDT by Aditya Keerthi
Modified: 2020-09-18 14:18 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.07 KB, patch)
2020-09-14 11:02 PDT, Aditya Keerthi
no flags Details | Formatted Diff | Diff
Patch (12.40 KB, patch)
2020-09-18 10:09 PDT, Aditya Keerthi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aditya Keerthi 2020-09-14 10:54:15 PDT
...
Comment 1 Aditya Keerthi 2020-09-14 10:54:40 PDT
<rdar://problem/68864815>
Comment 2 Aditya Keerthi 2020-09-14 11:02:34 PDT
Created attachment 408726 [details]
Patch
Comment 3 Alexey Proskuryakov 2020-09-14 16:17:43 PDT
Comment on attachment 408726 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=408726&action=review

> Source/WebCore/ChangeLog:19
> +        No new tests due to an inability to change system settings.

We have a number of ways to change user defaults just for DRT/WKTR. I'm not sure if we have exactly what's needed here, but it's far from impossible.
Comment 4 Aditya Keerthi 2020-09-18 10:09:02 PDT
Created attachment 409138 [details]
Patch
Comment 5 Aditya Keerthi 2020-09-18 10:09:28 PDT
Added a test.
Comment 6 Wenson Hsieh 2020-09-18 12:48:45 PDT
Comment on attachment 409138 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=409138&action=review

> Tools/TestWebKitAPI/Tests/mac/DateInputTests.mm:59
> +    system([NSString stringWithFormat:@"defaults write %@ %@ -dict-add %@ %@", domain, preferencesKey, @"1", customDateFormat].UTF8String);

Nit - is there a more elegant way to do this using NSUserDefaults?

> Tools/TestWebKitAPI/Tests/mac/DateInputTests.mm:67
> +    system([NSString stringWithFormat:@"defaults delete %@ %@", domain, preferencesKey].UTF8String);

(Ditto)
Comment 7 Aditya Keerthi 2020-09-18 14:14:50 PDT
(In reply to Wenson Hsieh from comment #6)
> Comment on attachment 409138 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=409138&action=review
> 
> > Tools/TestWebKitAPI/Tests/mac/DateInputTests.mm:59
> > +    system([NSString stringWithFormat:@"defaults write %@ %@ -dict-add %@ %@", domain, preferencesKey, @"1", customDateFormat].UTF8String);
> 
> Nit - is there a more elegant way to do this using NSUserDefaults?

The only way to do this using NSUserDefaults is through `[NSUserDefaults setPersistentDomain:forName:]` using `NSGlobalDomain`. Unfortunately, that approach will result in all other global preferences being cleared.
Comment 8 EWS 2020-09-18 14:18:18 PDT
Committed r267283: <https://trac.webkit.org/changeset/267283>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409138 [details].