tor-browser

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

file_form_action_server.sjs (930B)


      1 // Custom *.sjs file specifically for the needs of Bug 1251043
      2 
      3 const FRAME = `
      4   <!DOCTYPE html>
      5   <html>
      6   <head>
      7     <title>Bug 1251043 - Test form-action blocks URL</title>
      8     <meta http-equiv="Content-Security-Policy" content="form-action 'none';">
      9   </head>
     10   <body>
     11     CONTROL-TEXT
     12     <form action="file_form_action_server.sjs?formsubmission" method="GET">
     13       <input type="submit" id="submitButton" value="submit">
     14     </form>
     15   </body>
     16   </html>`;
     17 
     18 function handleRequest(request, response) {
     19   // avoid confusing cache behaviors
     20   response.setHeader("Cache-Control", "no-cache", false);
     21 
     22   // PART 1: Return a frame including the FORM and the CSP
     23   if (request.queryString === "loadframe") {
     24     response.write(FRAME);
     25     return;
     26   }
     27 
     28   // PART 2: We should never get here because the form
     29   // should not be submitted. Just in case; return
     30   // something unexpected so the test fails!
     31   response.write("do'h");
     32 }