Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-introduce escaping of a closing tag when encoding javascript #1380

Merged
merged 2 commits into from
Oct 8, 2023

Conversation

jbrichau
Copy link
Member

Fixes #1379

@Rinzwind
Copy link
Member

There’s a note in section ‘4.12.1.3 Restrictions for contents of script elements’ in the HTML Living Standard which recommends escaping <!-- and <script as well. The following snippet is based on the example in the section, the page does not show ‘Test Paragraph’ as would be expected:

FileLocator imageDirectory / 'Test.html' writeStreamDo: [ :stream |
   WAHtmlCanvas builder fullDocument: true;
      render: [ :html |
         html
            script: (html logger log: '<!-- <script>');
            paragraph: 'Test Paragraph' ]
      on: stream ]

@jbrichau
Copy link
Member Author

jbrichau commented Oct 8, 2023

@Rinzwind Good point. I moved your comment to the issue tracker since it requires a bit more work than to re-introduce the default escaping of all closing tags. To fix the issue, that should suffice but I consider it a temporary fix while we work on following that advice in the link.

@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b2d5425) 48.67% compared to head (fe070af) 48.67%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1380   +/-   ##
=======================================
  Coverage   48.67%   48.67%           
=======================================
  Files        8946     8948    +2     
  Lines       80490    80512   +22     
=======================================
+ Hits        39178    39192   +14     
- Misses      41312    41320    +8     
Files Coverage Δ
...package/JQueryClassTest.class/instance/testHtml.st 100.00% <100.00%> (ø)
...ge/JQueryClassTest.class/instance/testWithBlock.st 100.00% <100.00%> (ø)
...age/JQueryInstanceTest.class/instance/testAfter.st 100.00% <100.00%> (ø)
...ge/JQueryInstanceTest.class/instance/testAppend.st 100.00% <100.00%> (ø)
...ge/JQueryInstanceTest.class/instance/testBefore.st 100.00% <100.00%> (ø)
...kage/JQueryInstanceTest.class/instance/testHtml.st 100.00% <100.00%> (ø)
...e/JQueryInstanceTest.class/instance/testPrepend.st 100.00% <100.00%> (ø)
...e/JQueryInstanceTest.class/instance/testReplace.st 100.00% <100.00%> (ø)
...kage/JQueryInstanceTest.class/instance/testWrap.st 100.00% <100.00%> (ø)
...e.package/JSStream.class/class/encodeString.on..st 100.00% <100.00%> (ø)
... and 3 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jbrichau jbrichau merged commit ff85383 into master Oct 8, 2023
17 of 26 checks passed
@jbrichau jbrichau deleted the 1379-Nested-script-tags-are-not-properly-escaped branch July 20, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested script tags are not properly escaped
3 participants