tor-browser

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

send-data-arraybuffer.any.js (677B)


      1 // META: title=XMLHttpRequest.send(arraybuffer)
      2 
      3 var test = async_test();
      4 test.step(function()
      5 {
      6    var xhr = new XMLHttpRequest();
      7    var buf = new ArrayBuffer(5);
      8    var arr = new Uint8Array(buf);
      9    arr[0] = 0x48;
     10    arr[1] = 0x65;
     11    arr[2] = 0x6c;
     12    arr[3] = 0x6c;
     13    arr[4] = 0x6f;
     14 
     15    xhr.onreadystatechange = function()
     16    {
     17        if (xhr.readyState == 4)
     18        {
     19            test.step(function()
     20            {
     21                assert_equals(xhr.status, 200);
     22                assert_equals(xhr.response, "Hello");
     23 
     24                test.done();
     25            });
     26        }
     27    };
     28 
     29    xhr.open("POST", "./resources/content.py", true);
     30    xhr.send(buf);
     31 });