Needs work
Project:
Drupal core
Version:
main
Component:
javascript
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Sep 2015 at 09:38 UTC
Updated:
30 Jan 2023 at 18:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alexpottI'm not 100% certain that can or need to remove the
!placholderin javascript. The thing is we have nothing equivalent of auto escaping and safeness.Comment #3
sutharsan commentedReplacing all !placeholders in JS by @placeholder, both non-url and url. I can not oversee the consequences for URLs yet, but we need to start somewhere.
Comment #4
sutharsan commentedComment #5
sutharsan commentedComment #6
dawehnerDoes that mean that customMessage can never contain HTML in the first place at all? Not sure whether this is a right assumption, I could totally imagine that its passed through t(). Do we have a tool in JS to ensure something is not double escaped?
Comment #7
sutharsan commentedThe way Drupal.Ajax is used in core, the CustomMessage is always empty. But technically, yes it may contain HTML. As far as I know we don't have a JS tool for double escape.
Comment #8
dawehnerMaybe we should directly get http://phpjs.org/functions/htmlspecialchars/ and use that.
Comment #9
effulgentsia commentedI agree with #2. What makes it possible to remove '!' in PHP is that '@' can conditionally escape based on the safeness of the input. In JS, '@' escapes always, so we need '!' if the value already has (hopefully safe) HTML, just like in Drupal 7.
Comment #10
xjmComment #11
pwolanin commentedSo, maybe we need to close this issue if the JS api can't be the same as PHP?
Comment #12
nod_I agree with #2 and #9. Closing related issue as well.
Comment #13
nod_So there are definitely places where we should properly use @ instead of !, reopening for those. We don't have to get rid of !placeholder but we can fix some strings.
Comment #15
chernous_dn commentedUse
Create patch.
Comment #16
chernous_dn commentedUpdate patch.
Comment #19
chernous_dn commentedUpdate patch again.
Comment #20
chernous_dn commentedComment #24
kwoxer commentedJust tested the current patch and it needs a reroll. Please create a new patch. Thanks.
Comment #25
cburschkaComment #26
cburschkaThe ES6 change and some other major changes basically require doing this one from scratch.
Quick overview of the files that potentially need changing.
Comment #27
cburschkaThe above list doesn't include multi-line calls, but the converter turns those into single-lines so the compiled JS file will be matched even if the ES6 one isn't. See system.modules.js.
It looks like the whole thing basically is the same as from the old patch, with one additional one in locale_test.js.
Comment #29
cburschkaThe bad line is the !total here.
On phone now; will fix later.
Comment #30
cburschkaAt the airport; my final contribution to the DrupalCon sprint. :)
Comment #31
cburschkaForgot to rebuild the JS of course.
Comment #32
cburschka...and forgot to also look for formatPlural (one more occurrence) and formatString (nothing found).
Comment #36
cburschkaReroll for 8.5.x because of JS const codestyle.
Comment #44
catchStill valid, needs a re-roll.
Comment #45
karishmaamin commentedRe-rolled against 10.x. Please review
Comment #46
aarti zikre commentedWill provide the patch tomorrow
Comment #47
aarti zikre commentedComment #48
aarti zikre commentedComment #49
aarti zikre commentedComment #52
aarti zikre commentedComment #54
aarti zikre commentedComment #55
aarti zikre commentedComment #56
aarti zikre commentedReview require
Comment #57
ameymudras commentedThe above patch LGTM, Moving to RTBC unless we are missing any other files.
Comment #58
ameymudras commentedComment #59
ameymudras commentedComment #61
sahil.goyal commentedComment #62
xjm@sahil.goyal, this does not apply to 10.1.x, so the "Needs reroll" tag was correct.
@aarti zikre, when you supply new patches for an issue, please pay attention to the current status of the issue, and include both an issue comment explaining your intentions and an interdiff for any changes you made to the patch. For example, in #45, a new 10.0.x patch was already supplied, yet you commented saying you would create patch without making note of what, if anything, needed to be fixed with the previous patch. Thanks!
Comment #63
ankithashettyRerolled the patch against 10.1.x.
Changes in the new patch:
core/modules/locale/tests/src/Functional/LocaleJavascriptTranslationTest.phpfile. Removed that file in the new patch, as this issue focuses on only .js files (as mentioned in the issue title).Thanks!