Changeset 249061 in webkit
- Timestamp:
- Aug 23, 2019, 12:25:31 PM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
resultsdbpy/resultsdbpy/view/commit_view.py (modified) (1 diff)
-
resultsdbpy/resultsdbpy/view/templates/commit.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r249059 r249061 1 2019-08-23 Jonathan Bedard <jbedard@apple.com> 2 3 results.webkit.org: Escape html in changelog 4 https://bugs.webkit.org/show_bug.cgi?id=201025 5 <rdar://problem/54564837> 6 7 Reviewed by Darin Adler. 8 9 * resultsdbpy/resultsdbpy/view/commit_view.py: 10 (CommitView.commit): Output a dictionary instead of a JSON encoded string. 11 * resultsdbpy/resultsdbpy/view/templates/commit.html: Unpack commits dictionary 12 directly into a JavaScript dictionary. 13 1 14 2019-08-20 Jiewen Tan <jiewen_tan@apple.com> 2 15 -
trunk/Tools/resultsdbpy/resultsdbpy/view/commit_view.py
r247628 r249061 60 60 commit=commit, 61 61 repository_ids=repositories, 62 commits=Commit.Encoder(). encode([commit] + [item for lst in siblings.values() for item in lst]),62 commits=Commit.Encoder().default([commit] + [item for lst in siblings.values() for item in lst]), 63 63 **kwargs) 64 64 -
trunk/Tools/resultsdbpy/resultsdbpy/view/templates/commit.html
r247628 r249061 48 48 <script type="module"> 49 49 import {CommitTable} from '/assets/js/commit.js'; 50 document.getElementById("commitTable").innerHTML = CommitTable({{ commits|safe }}, {{ repository_ids|safe }}); 50 51 function unescapeJinjaText(text) { 52 return text.replace(/&([^;]+);/g, function(match, encoded) { 53 switch (encoded) { 54 case 'amp': 55 return '&'; 56 case 'gt': 57 return '>'; 58 case 'lt': 59 return '<'; 60 case 'quot': 61 return '"'; 62 default: 63 if (encoded[0] != '#') 64 return encoded; 65 return String.fromCharCode(encoded.substr(1)); 66 } 67 }); 68 } 69 70 let commits = [ 71 {% for commit in commits %} { 72 {% for key, value in commit.items() %} 73 {{ key }}: 74 {% if 'str' in value.__class__.__name__ %} 75 unescapeJinjaText('{{ value | replace("\\", "\\\\") | replace("\n", "\\n") }}') 76 {% else %} 77 {{ value }} 78 {% endif %}, 79 {% endfor %}}, 80 {% endfor %}]; 81 82 document.getElementById('commitTable').innerHTML = CommitTable(commits, {{ repository|safe }}); 51 83 </script> 52 84 {% endblock %}
Note:
See TracChangeset
for help on using the changeset viewer.