tor-browser

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

test-network-request.html (1664B)


      1 <!-- This Source Code Form is subject to the terms of the Mozilla Public
      2   - License, v. 2.0. If a copy of the MPL was not distributed with this
      3   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
      4 <!DOCTYPE HTML>
      5 <html dir="ltr" xml:lang="en-US" lang="en-US">
      6  <head>
      7    <meta charset="utf-8">
      8    <title>Console HTTP test page</title>
      9    <script type="text/javascript">
     10      /* exported testXhrGet, testXhrWarn, testXhrPost, testXhrPostSlowResponse */
     11      "use strict";
     12 
     13      function makeXhr(method, url, requestBody, callback) {
     14        const xmlhttp = new XMLHttpRequest();
     15        xmlhttp.open(method, url, true);
     16        xmlhttp.onreadystatechange = function() {
     17          if (callback && xmlhttp.readyState == 4) {
     18            callback();
     19          }
     20        };
     21        xmlhttp.send(requestBody);
     22      }
     23 
     24      function testXhrGet(callback) {
     25        makeXhr("get", "test-data.json", null, callback);
     26      }
     27 
     28      function testXhrWarn(callback) {
     29        makeXhr("get", "sjs_cors-test-server.sjs", null, callback);
     30      }
     31 
     32      function testXhrPost(callback) {
     33        makeXhr("post", "test-data.json", "Hello world!", callback);
     34      }
     35 
     36      function testXhrPostSlowResponse(callback) {
     37        makeXhr("post", "sjs_slow-response-test-server.sjs", "Hello world!", callback);
     38      }
     39    </script>
     40  </head>
     41  <body>
     42    <h1>Heads Up Display HTTP Logging Testpage</h1>
     43    <h2>This page is used to test the HTTP logging.</h2>
     44 
     45    <form action="test-network-request.html" method="post">
     46      <input name="name" type="text" value="foo bar"><br>
     47      <input name="age" type="text" value="144"><br>
     48    </form>
     49  </body>
     50 </html>