Escape special HTML characters in warning messages.
Bug: 111699078 Test: run warn.py with a build.log file Change-Id: I553dad57a6d81ea6cc89289741d9963f49cc3b47
This commit is contained in:
parent
f6658018f6
commit
b2afb63ac9
1 changed files with 14 additions and 5 deletions
|
@ -75,6 +75,7 @@ Use option --gencsv to output warning counts in CSV format.
|
|||
# emit_js_data():
|
||||
|
||||
import argparse
|
||||
import cgi
|
||||
import csv
|
||||
import multiprocessing
|
||||
import os
|
||||
|
@ -3149,6 +3150,14 @@ def emit_const_string_array(name, array):
|
|||
print '];'
|
||||
|
||||
|
||||
# Emit a JavaScript const string array for HTML.
|
||||
def emit_const_html_string_array(name, array):
|
||||
print 'const ' + name + ' = ['
|
||||
for s in array:
|
||||
print '"' + cgi.escape(strip_escape_string(s)) + '",'
|
||||
print '];'
|
||||
|
||||
|
||||
# Emit a JavaScript const object array.
|
||||
def emit_const_object_array(name, array):
|
||||
print 'const ' + name + ' = ['
|
||||
|
@ -3167,11 +3176,11 @@ def emit_js_data():
|
|||
emit_const_string_array('ProjectNames', project_names)
|
||||
emit_const_int_array('WarnPatternsSeverity',
|
||||
[w['severity'] for w in warn_patterns])
|
||||
emit_const_string_array('WarnPatternsDescription',
|
||||
[w['description'] for w in warn_patterns])
|
||||
emit_const_string_array('WarnPatternsOption',
|
||||
[w['option'] for w in warn_patterns])
|
||||
emit_const_string_array('WarningMessages', warning_messages)
|
||||
emit_const_html_string_array('WarnPatternsDescription',
|
||||
[w['description'] for w in warn_patterns])
|
||||
emit_const_html_string_array('WarnPatternsOption',
|
||||
[w['option'] for w in warn_patterns])
|
||||
emit_const_html_string_array('WarningMessages', warning_messages)
|
||||
emit_const_object_array('Warnings', warning_records)
|
||||
|
||||
draw_table_javascript = """
|
||||
|
|
Loading…
Reference in a new issue