tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

about-blank-replacement-popup-frame.py (675B)


      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 
     17 let popup = window.open('?nested=true');
     18 popup.onload = nestedLoaded;
     19 
     20 addEventListener('unload', evt => {
     21  popup.close();
     22 }, { once: true });
     23 
     24 // Helper routine to make it slightly easier for our parent to find
     25 // the nested popup window.
     26 function nested() {
     27  return popup;
     28 }
     29 </script>
     30 </body>
     31 </html>
     32 """)