do-not-expect-received.py (662B)
1 def main(request, response): 2 """ 3 Check that headers sent to navigate here *do not* contain the device-memory client 4 hint, and report success/failure in a way compatible with 5 verify_{subresource|iframe}_state() in accept-ch-test.js 6 """ 7 8 if b"device-memory" in request.headers or b"sec-ch-device-memory" in request.headers: 9 result = u"FAIL" 10 else: 11 result = u"PASS" 12 13 content = u''' 14 <script> 15 let messagee = window.opener || window.parent; 16 messagee.postMessage("%s" , "*"); 17 </script> 18 ''' % (result) 19 headers = [(b"Content-Type", b"text/html"), (b"Access-Control-Allow-Origin", b"*")] 20 return 200, headers, content