Title: [249061] trunk/Tools
- Revision
- 249061
- Author
- [email protected]
- Date
- 2019-08-23 12:25:31 -0700 (Fri, 23 Aug 2019)
Log Message
results.webkit.org: Escape html in changelog
https://bugs.webkit.org/show_bug.cgi?id=201025
<rdar://problem/54564837>
Reviewed by Darin Adler.
* resultsdbpy/resultsdbpy/view/commit_view.py:
(CommitView.commit): Output a dictionary instead of a JSON encoded string.
* resultsdbpy/resultsdbpy/view/templates/commit.html: Unpack commits dictionary
directly into a _javascript_ dictionary.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (249060 => 249061)
--- trunk/Tools/ChangeLog 2019-08-23 19:21:32 UTC (rev 249060)
+++ trunk/Tools/ChangeLog 2019-08-23 19:25:31 UTC (rev 249061)
@@ -1,3 +1,16 @@
+2019-08-23 Jonathan Bedard <[email protected]>
+
+ results.webkit.org: Escape html in changelog
+ https://bugs.webkit.org/show_bug.cgi?id=201025
+ <rdar://problem/54564837>
+
+ Reviewed by Darin Adler.
+
+ * resultsdbpy/resultsdbpy/view/commit_view.py:
+ (CommitView.commit): Output a dictionary instead of a JSON encoded string.
+ * resultsdbpy/resultsdbpy/view/templates/commit.html: Unpack commits dictionary
+ directly into a _javascript_ dictionary.
+
2019-08-20 Jiewen Tan <[email protected]>
[WebAuthn] Support NFC authenticators for iOS
Modified: trunk/Tools/resultsdbpy/resultsdbpy/view/commit_view.py (249060 => 249061)
--- trunk/Tools/resultsdbpy/resultsdbpy/view/commit_view.py 2019-08-23 19:21:32 UTC (rev 249060)
+++ trunk/Tools/resultsdbpy/resultsdbpy/view/commit_view.py 2019-08-23 19:25:31 UTC (rev 249061)
@@ -59,7 +59,7 @@
title=self.site_menu.title + ': ' + str(commit.id),
commit=commit,
repository_ids=repositories,
- commits=Commit.Encoder().encode([commit] + [item for lst in siblings.values() for item in lst]),
+ commits=Commit.Encoder().default([commit] + [item for lst in siblings.values() for item in lst]),
**kwargs)
def info(self):
Modified: trunk/Tools/resultsdbpy/resultsdbpy/view/templates/commit.html (249060 => 249061)
--- trunk/Tools/resultsdbpy/resultsdbpy/view/templates/commit.html 2019-08-23 19:21:32 UTC (rev 249060)
+++ trunk/Tools/resultsdbpy/resultsdbpy/view/templates/commit.html 2019-08-23 19:25:31 UTC (rev 249061)
@@ -47,6 +47,38 @@
<script type="module">
import {CommitTable} from '/assets/js/commit.js';
-document.getElementById("commitTable").innerHTML = CommitTable({{ commits|safe }}, {{ repository_ids|safe }});
+
+function unescapeJinjaText(text) {
+ return text.replace(/&([^;]+);/g, function(match, encoded) {
+ switch (encoded) {
+ case 'amp':
+ return '&';
+ case 'gt':
+ return '>';
+ case 'lt':
+ return '<';
+ case 'quot':
+ return '"';
+ default:
+ if (encoded[0] != '#')
+ return encoded;
+ return String.fromCharCode(encoded.substr(1));
+ }
+ });
+}
+
+let commits = [
+{% for commit in commits %} {
+ {% for key, value in commit.items() %}
+ {{ key }}:
+ {% if 'str' in value.__class__.__name__ %}
+ unescapeJinjaText('{{ value | replace("\\", "\\\\") | replace("\n", "\\n") }}')
+ {% else %}
+ {{ value }}
+ {% endif %},
+ {% endfor %}},
+{% endfor %}];
+
+document.getElementById('commitTable').innerHTML = CommitTable(commits, {{ repository|safe }});
</script>
{% endblock %}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes