Review main Merged

63263[TASK] Initialize datepicker JS in external file

Christian Eßl CR +2 V +2 Normal +73 −35 updated 04/02/23, 08:51

Commit message

Before this patch, the DatePickerViewHelper of EXT:form would
always render its datepicker JavaScript inline.

The DatePickerViewHelper now includes an external JS file for the
initialization which is not utilizing any dynamically generated
parts anymore.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Björn Jacob +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Björn Jacob +1
    • core-ci +1 CI

Issues 1

Files 5

Review log 5273

Show 3448 earlier messages
  1. Christian Eßl uploaded patch set 1 02/15/20, 18:39

  2. TYPO3com voted on patch set 1 V -1 02/15/20, 18:41 Completed build in 22s on Sat, 15 Feb, 06:41 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-135

  3. Christian Eßl uploaded patch set 2 02/15/20, 18:44

  4. Georg Ringer commented on patch set 2 02/15/20, 18:45

    is there a reason why not always having that as external file?
  5. Christian Eßl commented on patch set 2 02/15/20, 18:50

    > Patch Set 2: > > is there a reason why not always having that as external file? Wanted to make it behave like the TSFE rendered frontend. By default, if removeDefaultJS is not set, in current TYPO3 it would default to "external". However if config.removeDefaultJS is set to "0", some of the js automatically rendered, would still be included inline. Or am I wrong here? (I haven't been using inline js for a long time)
  6. TYPO3com voted on patch set 2 V +1 02/15/20, 18:58 Completed build in 13m 37s on Sat, 15 Feb, 06:58 PM Test Summary: 71295 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-136

  7. Oliver Hader commented on patch set 2 CR -1 02/16/20, 10:42

    Actually it just hides potential security issues. CSP will be fine for unsafe-inline. However potential XSS is then directly written to a file. We should add dynamic parameters as data-attributes and let them process by a real external file which is just static and not dynamically generated.
  8. Christian Eßl uploaded patch set 3 02/16/20, 15:25

  9. TYPO3com voted on patch set 3 V -1 02/16/20, 15:43 Completed build in 18m 15s on Sun, 16 Feb, 03:43 PM Test Summary: 1 of 71751 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-175

  10. TYPO3com voted on patch set 3 V +1 02/16/20, 17:14 Completed build in 17m 20s on Sun, 16 Feb, 05:14 PM Test Summary: 71295 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-180

  11. Björn Jacob commented on patch set 3 02/27/20, 22:03

    I like the new solution based on Ollys feedback. I've got another question. Would the new asset controller be of any help (https://github.com/TYPO3/TYPO3.CMS/commit/7e342e74de1b207032b1eaa494357a2cec0d4a11)? In my understanding we could use it to load the static JS file. This would slim down the PHP part. The solution would be different for v9. Or would it be valid to get this one in for master and v9 and improve the situation (as TASK) for v10?
  12. Christian Eßl commented on patch set 3 03/09/20, 11:55

    Good idea. Will rewrite it later to use the new AssetCollector.
  13. Christian Eßl marked it work in progress 03/09/20, 11:55

  14. Christian Eßl uploaded patch set 4 03/27/20, 11:48

  15. Christian Eßl commented on patch set 4 03/27/20, 11:49

    This change is ready for review.
  16. TYPO3com voted on patch set 4 V -1 03/27/20, 11:49 Completed build in 36s on Fri, 27 Mar, 11:49 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1825

  17. TYPO3com commented on patch set 4 03/27/20, 17:25 Completed build in 25s on Fri, 27 Mar, 05:25 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1871

  18. Christian Eßl uploaded patch set 5 03/27/20, 17:28

  19. TYPO3com voted on patch set 5 V +1 03/27/20, 17:39 Completed build in 10m 45s on Fri, 27 Mar, 05:39 PM Test Summary: 73044 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1872

  20. Björn Jacob voted on patch set 5 CR +1 03/27/20, 19:07

  21. Guido Schmechel commented on patch set 5 03/27/20, 21:20

    Short question: AssetCollector just works for v10, right?
  22. Christian Eßl commented on patch set 5 03/27/20, 21:37

    > Patch Set 5: > > Short question: AssetCollector just works for v10, right? Right. Backporting this to 9.5 would require the already prepared solution in patchset #3.
  23. Jonas Eberle commented on patch set 5 03/30/20, 20:51

    DatePickerViewHelper.php:176 Unresolved

    the $attributes parameter has become optional recently
  24. Georg Ringer commented on patch set 5 CR -1 03/31/20, 02:09

    This will break for every site using basic Auth to protect the backend, this needs to be master only and configurable
  25. Jonas Eberle commented on patch set 5 CR +1 04/12/20, 23:52

    TBH I don't see how putting a <script> into HTML would lead to problems with HTTP Auth. If authed for a domain, the browser will auth further requests, too. The exception is XHR where the server would have to send the "Access-Control-Allow-Credentials" header and JavaScript needs to specifically send the credentials but that is not the case here, is it? Also, every code less being inlined is good towards achieving CSP-confirmity (without unsafe-inline) for the backend.
  26. Oliver Hader commented on patch set 5 04/13/20, 08:12

    > Patch Set 5: Code-Review-1 > > This will break for every site using basic Auth to protect the backend, this needs to be master only and configurable You're talking about requesting HTTP Auth for `https://secure.org/typo3/`? Probably then rules just be adjusted for those public resources - I'd be fine with "master only", not sure about the "must be configurable" part... Personally I would not add new feature flags or config options for these things - compiling inline JavaScript is and was a hack... ;-)

    DatePickerViewHelper.php:103 Unresolved

    I did not test it (yet)... is the `$datePickerDateFormat` probably missing now?
  27. Björn Jacob commented on patch set 5 CR 0 04/13/20, 08:16

    After reading your comments, I am also for not backporting this one to older versions. In the former days, we had an agreement to not backport patches with template changes. This caused a lot of trouble and confusion for integrators. Anyway, during the next days, we will work on some form patches and discuss (and merge) this one.
  28. Björn Jacob updated the commit message in patch set 6 04/13/20, 11:17

  29. Björn Jacob commented on patch set 6 04/13/20, 11:20

    Changed to master only. Wrote stupdid stuff about template changes. Sry, no templates are involved here. But still valid to not have it in v9 since priority bugfix phase lies ahead.
  30. TYPO3com voted on patch set 6 V +1 04/13/20, 11:29 Completed build in 12m 31s on Mon, 13 Apr, 11:29 AM Test Summary: 73409 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2438

  31. Christian Eßl uploaded patch set 7 04/18/20, 06:39

  32. TYPO3com voted on patch set 7 V -1 04/18/20, 06:40 Completed build in 43s on Sat, 18 Apr, 06:40 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2773

  33. Christian Eßl uploaded patch set 8 04/18/20, 06:56

  34. TYPO3com voted on patch set 8 V -1 04/18/20, 07:24 Completed build in 27m 57s on Sat, 18 Apr, 07:24 AM Test Summary: 13 of 72521 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2774

  35. TYPO3com commented on patch set 8 04/18/20, 08:34 Completed build in 16m 48s on Sat, 18 Apr, 08:34 AM Test Summary: 73627 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2776

  36. Jonas Eberle commented on patch set 8 V +1 CR +1 04/18/20, 10:39

    This keeps the functionality as it was before. Anyways: Setting [SYS][ddmmyy] or [SYS][USdateformat] any different from the standard really breaks JS in FormEngine and date output in web_layout in v9 and master. >> https://forge.typo3.org/issues/91105
  37. Jonas Eberle commented on patch set 8 04/18/20, 11:08

    DatePickerViewHelper.php:158

    this seems unused and could be removed
  38. TYPO3com voted on patch set 8 V +1 06/05/20, 11:55 Completed build in 13m 18s on Fri, 5 Jun, 11:55 AM Test Summary: 72830 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3854

  39. Daniel Haupt uploaded patch set 9 11/27/20, 18:38

  40. Daniel Haupt commented on patch set 9 11/27/20, 18:39

    DatePickerViewHelper.php:158 Reply

    I think we still need the format conversion, so I've re-added it to the latest patch set.
  41. TYPO3com voted on patch set 9 V +1 11/27/20, 18:49 Completed build in 11m 35s on Fri, 27 Nov, 06:49 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7656

  42. Jonas Eberle updated the commit message in patch set 10 06/09/21, 19:37

  43. Jonas Eberle commented on patch set 10 V +1 CR +1 06/09/21, 20:00

    I've removed the reference to config.removeDefaultJS form the commitmessage because that won't have any effect with AssetCollector. Apart from that I would rather deprecate dependencies on jQ + jQueryUI (even if only optional and only frontend), this works as advertised! 😊
  44. Christian Kuhn rebased onto patch set 11 06/09/21, 22:23

  45. core-ci voted on patch set 11 V +1 06/09/21, 22:31 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12253

  46. Jonas Eberle voted on patch set 11 V +1 CR +1 06/10/21, 07:21

  47. Oli Bartsch commented on patch set 11 06/10/21, 10:06

    Works for me. However, not sure about the "request public resource from /typo3/" part. As already said in above comments, this directory may be protected in some installations.
  48. Jonas Eberle commented on patch set 11 06/10/21, 11:36

    Reply Unresolved

    When restricting /typo3/, excluding /typo3/sysext/*/Resources/Public/ is necessary anyways IMHO. There is at least already sysext/seo/Resources/Public/CSS/Sitemap.xsl which is meant for the frontend.
  1. Björn Jacob voted on patch set 11 V +1 CR +1 08/11/21, 07:15

  2. waldhacker uploaded patch set 12 08/11/21, 11:26

  3. core-ci voted on patch set 12 V +1 08/11/21, 11:40 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14575

  4. Björn Jacob commented on patch set 12 08/11/21, 11:57

    Two minor nitpicks.

    DatePickerViewHelper.php:75

    Would write "JavaScript". Nitpick, I know.

    DatePicker.yaml:135

    "an http basic auth"
  5. waldhacker commented on patch set 13 08/11/21, 12:00

    Published edit on patch set 12.
  6. waldhacker commented on patch set 13 08/11/21, 12:00

    DatePickerViewHelper.php:75 Reply

    Done

    DatePicker.yaml:135 Reply

    Done
  7. Björn Jacob updated the commit message in patch set 14 08/11/21, 12:07

  8. core-ci voted on patch set 13 V +1 08/11/21, 12:15 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14582

  9. core-ci voted on patch set 14 V +1 08/11/21, 12:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14583

  10. waldhacker uploaded patch set 15 08/11/21, 14:38

  11. core-ci voted on patch set 15 V +1 08/11/21, 14:52 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14605

  12. Björn Jacob commented on patch set 16 08/11/21, 15:11

    Published edit on patch set 15.
  13. Björn Jacob commented on patch set 16 V +1 CR +1 08/11/21, 15:13

    Renamed .rst (my fault). Ready now.
  14. core-ci voted on patch set 16 V +1 08/11/21, 15:23 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14608

  15. Christian Kuhn uploaded patch set 17 08/12/21, 12:55

  16. Christian Kuhn commented on patch set 16 08/12/21, 12:55

    Important-90264-InitializeDatepickerJSInExternalFile.rst:14

    #Some ?
  17. Björn Jacob commented on patch set 17 08/12/21, 13:00

    Important-90264-InitializeDatepickerJSInExternalFile.rst:14 Reply

    So "some" is not fine? Do you prefer a different wording? > If an installation restricts requesting public resources from `/typo3/`, there is a new YAML configuration to override the default path. Something like that? If this is the problem, I can come up with a better text.
  18. Björn Jacob voted on patch set 17 V +1 CR +1 08/12/21, 13:07

  19. Christian Kuhn commented on patch set 17 08/12/21, 13:07

    Important-90264-InitializeDatepickerJSInExternalFile.rst:14 Reply

    All good. just removed the # ;)
  20. core-ci voted on patch set 17 V -1 08/12/21, 13:15 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14725

  21. core-ci voted on patch set 17 V +1 08/12/21, 13:23 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/14725

  22. Christian Kuhn voted on patch set 17 V +2 CR +2 08/12/21, 13:26

  23. Christian Kuhn merged patch set 18 08/12/21, 13:26

  24. Jonas Eberle commented on patch set 18 08/12/21, 13:38

    Important-90264-InitializeDatepickerJSInExternalFile.rst:17

    while it is still fresh and before Blog posts and docs have been written, could we add a 't' to the 'JavaScrip'? datePickerInitializationJavaScriptFile
  25. Björn Jacob commented on patch set 18 08/12/21, 13:40

    Important-90264-InitializeDatepickerJSInExternalFile.rst:17 Reply Unresolved

    I will take care. Thanks for this finding.