tor-browser

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

iso-latin1-header-iframe.html (657B)


      1 <script>
      2 function xhr_send(method, data) {
      3  return new Promise(function(resolve, reject) {
      4      var xhr = new XMLHttpRequest();
      5      xhr.onload = function() {
      6        resolve();
      7      };
      8      xhr.onerror = function() {
      9        reject('XHR must succeed.');
     10      };
     11      xhr.responseType = 'text';
     12      xhr.open(method, './sample?test', true);
     13      xhr.send(data);
     14    });
     15 }
     16 
     17 window.addEventListener('message', function(evt) {
     18    var port = evt.ports[0];
     19    xhr_send('POST', 'test string')
     20      .then(function() { port.postMessage({results: 'finish'}); })
     21      .catch(function(e) { port.postMessage({results: 'failure:' + e}); });
     22  });
     23 </script>