blob: 1bd9f26edae657b5cbbda9b04ac9746ac090a9d7 [file] [log] [blame]
#!/usr/bin/env python3
import os
import sys
referer = os.environ.get('HTTP_REFERER', '')
sys.stdout.write(
'Content-Type: text/html\r\n\r\n'
'<p>Referrer: {referer}</p>\n'
'<script>\n'
'console.log("Referrer: " + ("{referer}" == "" ? "PASS" : "FAIL"));\n'
'\n'
'var result = "window.opener: " + (window.opener ? "FAIL" : "PASS");\n'
'document.write(result);\n'
'console.log(result);\n'
'if (window.testRunner)\n'
' testRunner.notifyDone();\n'
'</script>\n'.format(referer=referer)
)