-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
replace innerHTML in showErrorMarker #5574
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5574 +/- ##
=======================================
Coverage 86.79% 86.79%
=======================================
Files 594 594
Lines 43126 43129 +3
Branches 7148 7149 +1
=======================================
+ Hits 37431 37434 +3
Misses 5695 5695
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Looks like this will escape the html twice, because it is escaped in Line 78 in a3277ea
and the tooltip uses innerHTML as well ace/src/mouse/default_gutter_handler.js Line 227 in a3277ea
|
I guess this PR can be merged after #5575 is resolved then. Or do you have any proposals how to avoid this issue? |
src/ext/error_marker.js
Outdated
@@ -122,7 +122,12 @@ exports.showErrorMarker = function(editor, dir) { | |||
|
|||
w.el.className = "error_widget_wrapper"; | |||
el.className = "error_widget " + gutterAnno.className; | |||
el.innerHTML = gutterAnno.text.join("<br>"); | |||
gutterAnno.text.forEach(function (annoTextLine, i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that #5602 has been merged you should be able to use gutterAnno.displayText
here to avoid issues with the text being escaped twice and being rendered incorrectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I also adapted line 101.
Make
showErrorMarker
CSP compliant.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Pull Request Checklist:
ace.d.ts
) and its references: