about-blank-replacement-frame.py (836B)
1 def main(request, response): 2 if b'nested' in request.GET: 3 return ( 4 [(b'Content-Type', b'text/html')], 5 b'failed: nested frame was not intercepted by the service worker' 6 ) 7 8 return ([(b'Content-Type', b'text/html')], b""" 9 <!doctype html> 10 <html> 11 <body> 12 <script> 13 function nestedLoaded() { 14 parent.postMessage({ type: 'NESTED_LOADED' }, '*'); 15 } 16 </script> 17 <iframe src="?nested=true" id="nested" onload="nestedLoaded()"></iframe> 18 <script> 19 // Helper routine to make it slightly easier for our parent to find 20 // the nested frame. 21 function nested() { 22 return document.getElementById('nested').contentWindow; 23 } 24 25 // NOTE: Make sure not to touch the iframe directly here. We want to 26 // test the case where the initial about:blank document is not 27 // directly accessed before load. 28 </script> 29 </body> 30 </html> 31 """)