79912[TASK] Render JavaScript modules as script tag if possible
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Andreas Kienast +1
- Benni Mack +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Andreas Kienast +1
- Benni Mack +1
- core-ci +1 CI
Issues 2
Files 5
- typo3/sysext/core/Classes/Page/JavaScriptItems.php2+16 −0
- typo3/sysext/core/Classes/Page/JavaScriptRenderer.php13+103 −14
- typo3/sysext/core/Classes/Page/PageRenderer.php4+5 −7
- typo3/sysext/core/Tests/Functional/Page/JavaScriptRendererTest.php+22 −5
- typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php+4 −4
Review log 5379
Show 3454 earlier messages
-
Benjamin Franzke uploaded patch set 1 07/10/23, 04:56
-
core-ci voted on patch set 1 V -1 07/10/23, 05:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43962
-
Benjamin Franzke uploaded patch set 2
V -107/10/23, 07:03 -
core-ci voted on patch set 2 V -1 07/10/23, 07:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43969
-
Benjamin Franzke uploaded patch set 3
V -107/10/23, 08:01 -
core-ci voted on patch set 3 V +1 07/10/23, 08:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43971
-
Benjamin Franzke marked it work in progress 07/10/23, 08:10
-
Benjamin Franzke uploaded patch set 4
V +107/26/23, 10:35 -
core-ci voted on patch set 4 V -1 07/26/23, 10:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44573
-
Benjamin Franzke uploaded patch set 5
V -107/26/23, 11:24 -
core-ci voted on patch set 5 V +1 07/26/23, 11:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44577
-
Benjamin Franzke rebased onto patch set 6
V +107/28/23, 07:29 -
core-ci voted on patch set 6 V +1 07/28/23, 07:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44650
-
Oliver Hader commented on patch set 6 07/28/23, 18:37
`window.litNonce` might be used in frontend as well (or might have been "misused", for other JavaScript components other than lit-elements)... -
Benjamin Franzke commented on patch set 6 07/28/23, 19:16
Reply
yes, which is why is now automagically added, whenever EXT:core importmap is loaded. The idea was: If lit is used in frontend, then the litNonce will be automatically emitted, without having to call `applyNonceHint` (although I noticed – after writing this patch – that we could actually get rid of litNonce, as lit itself doesn't need litNonce any longer for modern browsers, since firefox 101 supports constructable stylesheets. but that requires more work on our side, since we began to use litNonce ourselves for other cases). -
Benjamin Franzke uploaded patch set 7
V +107/28/23, 19:52 -
Benjamin Franzke commented on patch set 7 07/28/23, 19:54
Reply
Dropped the automagic and kept it in PageRenderer, but swapped the order to fix firefox false positive errors. I'm actually quite happy if litNonce is not applied in frontend, given that I recognized, that one wouldn't want it to be defined, if only modern browsers are targeted. -
core-ci voted on patch set 7 V +1 07/28/23, 20:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44699
-
Oliver Hader commented on patch set 7 CR +1 07/28/23, 20:35
JavaScriptRenderer.php:94Might this signature change probably be breaking? -
Benjamin Franzke uploaded patch set 8
CR +1V +107/29/23, 06:39 -
Benjamin Franzke commented on patch set 8 07/29/23, 06:40
JavaScriptRenderer.php:94ReplyAck, didn't take into account that JavaScriptRenderer isn't internal. Adapted the signature to be non-breaking. -
core-ci voted on patch set 8 V -1 07/29/23, 06:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44708
-
Benjamin Franzke uploaded patch set 9
V -107/29/23, 15:44 -
core-ci voted on patch set 9 V +1 07/29/23, 15:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44737
-
Benjamin Franzke uploaded patch set 10
V +107/29/23, 17:53 -
core-ci voted on patch set 10 V +1 07/29/23, 18:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44738
-
Christian Kuhn commented on patch set 10 07/31/23, 09:46
PageRenderer.php:1497and ? -
Benjamin Franzke uploaded patch set 11
V +108/02/23, 06:41 -
Benjamin Franzke commented on patch set 11 08/02/23, 06:41
PageRenderer.php:1497ReplyRight, thx. Has been copied 1:1 from below – but I removed the stray "and" now. -
core-ci voted on patch set 11 V +1 08/02/23, 06:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44865
-
Benni Mack commented on patch set 11 08/02/23, 09:03
JavaScriptRenderer.php:165do we need the comment about the comment? :) -
Benjamin Franzke uploaded patch set 12
V +108/02/23, 10:16 -
Benjamin Franzke commented on patch set 12 08/02/23, 10:16
JavaScriptRenderer.php:165ReplyThank you very much, good catch. I really suck at updating comments (did I mention I hate code that needs comments? 😊) This one needed to be moved to createItemHandlerElement. (And yes, in this case a comment is needed, but I expanded it a bit) -
core-ci voted on patch set 12 V +1 08/02/23, 10:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44871
-
Benni Mack updated the commit message in patch set 13
V +108/07/23, 11:49 -
core-ci voted on patch set 13 V +1 08/07/23, 11:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45188
-
Benjamin Franzke uploaded patch set 14
V +111/29/23, 16:07 -
core-ci voted on patch set 14 V -1 11/29/23, 16:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50128
-
Benjamin Franzke uploaded patch set 15
V -111/30/23, 06:30 -
core-ci voted on patch set 15 V +1 11/30/23, 06:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50147
-
Benjamin Franzke uploaded patch set 16 11/30/23, 15:02
Copied Votes: * Verified+1 (copy condition: "**changekind:NO_CHANGE**") -
core-ci voted on patch set 16 V +1 11/30/23, 15:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50172
-
Benjamin Franzke rebased onto patch set 17
V +112/01/23, 16:06 -
core-ci voted on patch set 17 V +1 12/01/23, 16:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50212
-
Benjamin Franzke uploaded patch set 18
V +105/31/24, 10:57 -
core-ci voted on patch set 18 V -1 05/31/24, 11:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58530
-
Benjamin Franzke uploaded patch set 19
V -105/31/24, 11:19 -
core-ci voted on patch set 19 V +1 05/31/24, 11:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58531
-
Benni Mack voted on patch set 19 CR +1 06/01/24, 21:27
-
Andreas Kienast commented on patch set 19 06/06/24, 13:25
JavaScriptItems.php:113I assume the foreach() is here to be in line with the `toArray()` method. Otherwise, I'd suggest an `array_map()` invocation: ``` return array_map(static fn (array $item) => [ 'type' => 'globalAssignment', 'payload' => $item, ], $this->globalAssignments); ```JavaScriptRenderer.php:108The condition is superfluous. If the array is empty, the inner foreach becomes a no-op.JavaScriptRenderer.php:150The null check can be removed as `->createScriptElement()` uses `GU::implodeAttributes()` which drops the empty elements. This would be in line with the foreach() in line 109. -
Benjamin Franzke uploaded patch set 20
CR +1V +106/08/24, 07:17 -
Benjamin Franzke commented on patch set 20 06/08/24, 07:17
JavaScriptItems.php:113Replyack, it was copied from `toArray()`, but `array_map` is better in this case 👍. Done.JavaScriptRenderer.php:108ReplyDoneJavaScriptRenderer.php:150ReplyDone -
core-ci voted on patch set 20 V -1 06/08/24, 07:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58907
-
Benjamin Franzke uploaded patch set 21
V -106/10/24, 08:32
-
core-ci voted on patch set 21 V +1 06/10/24, 08:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58982
-
Andreas Kienast voted on patch set 21 CR +1 06/10/24, 12:35
-
Andreas Kienast voted on patch set 21 V +1 06/11/24, 13:35
-
Oliver Hader commented on patch set 21 CR -1 06/13/24, 10:13
Feedback via Slack... -
Oliver Hader commented on patch set 21 06/13/24, 10:29
JavaScriptRenderer.php:111... -
Benjamin Franzke marked it work in progress 10/07/24, 09:45
-
Benjamin Franzke uploaded patch set 22
CR +1V +102/09/25, 01:53 -
core-ci voted on patch set 22 V -1 02/09/25, 01:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73815
-
Benjamin Franzke rebased onto patch set 23
V -102/09/25, 02:26 -
core-ci voted on patch set 23 V +1 02/09/25, 02:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73817
-
Benjamin Franzke uploaded patch set 24
V +103/05/25, 09:48 -
Benjamin Franzke commented on patch set 24 03/05/25, 09:48
JavaScriptRenderer.php:111ReplyI initially left out any prototype pollution filter as we're using `Object.assign()` which is not affected by prototype polluting object copies when not combined with JSON.parse. Anyway it's still "ok" for me to add this layer of protection which is now implemented. -
core-ci voted on patch set 24 V +1 03/05/25, 09:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75151
-
Benjamin Franzke rebased onto patch set 25
V +103/24/25, 12:22 -
core-ci voted on patch set 25 V +1 03/24/25, 12:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76148
-
Andreas Kienast commented on patch set 25 V +1 03/24/25, 15:14
JavaScriptRenderer.php:199Pardon my ignorance – why do we need this and why is it `window` only, compared to the unsets below?PageRenderer.php:1430Nice, `GeneralUtility::wrapJS()` can get deprecated then. -
Andreas Kienast commented on patch set 25 03/24/25, 15:14
PageRenderer.php:1430ReplyDone -
Benjamin Franzke commented on patch set 25 03/24/25, 16:31
JavaScriptRenderer.php:199Replybecause we assign to window (via `globalThis` in line 130 which is `window`) and want to allow e.g. `['window' => [ 'name' => 'typo3-backend' ] ]` (because our own code uses that and for BC reasons – we could of course refactor BackendController to avoid the unneded `window` prefix). Therefore we merge that one level up, as we – in general forbid any "too" global assignments (not for security reasons, but for reducing the chance of hard-to-debug side-effects) later on. Therefore `window.window.foo` is disallowed, but `window.foo` is allowed. I guess this deserves comments, although I'd love I could just make the code more self-explanatory. -
Benjamin Franzke uploaded patch set 26
V +103/25/25, 07:24 -
Benjamin Franzke commented on patch set 26 03/25/25, 07:24
JavaScriptRenderer.php:199ReplyDone -
core-ci voted on patch set 26 V +1 03/25/25, 07:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76211
-
Andreas Kienast voted on patch set 26 CR +1 V +1 03/25/25, 08:20
-
Benni Mack commented on patch set 26 CR +1 V +1 03/26/25, 14:09
behaves just like before. Code is almost clear what it does to me. -
Benjamin Franzke voted on patch set 26 CR +2 V +2 03/26/25, 17:41
-
Benjamin Franzke merged patch set 27 03/26/25, 17:52