blob: 5c9cc41d9d30e6752b78d55b9a37500ebafdf347 [file] [log] [blame]
#!/usr/bin/env python3
import os
import sys
import time
from report_file_path import report_filepath
while not os.path.isfile(report_filepath):
time.sleep(0.01)
sys.stdout.write(
'Content-Type: text/html\r\n\r\n'
'<html><body>\n'
'CSP report received:'
)
report_file = open(report_filepath, 'r')
for line in report_file.readlines():
sys.stdout.write('<br>{}'.format(line.strip()))
report_file.close()
if os.path.isfile(report_filepath):
os.remove(report_filepath)
sys.stdout.write(
'<script>'
'if (window.testRunner)'
' testRunner.notifyDone();'
'</script>'
'</body></html>'
)