tor-browser

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

format-field-retry-bogus.any.js (685B)


      1 // META: title=EventSource: "retry" field (bogus)
      2      var test = async_test()
      3      test.step(function() {
      4        var timeoutms = 3000,
      5            source = new EventSource("resources/message.py?message=retry%3A3000%0Aretry%3A1000x%0Adata%3Ax"),
      6            opened = 0
      7        source.onopen = function() {
      8          test.step(function() {
      9            if(opened == 0)
     10              opened = new Date().getTime()
     11            else {
     12              var diff = (new Date().getTime()) - opened
     13              assert_true(Math.abs(1 - diff / timeoutms) < 0.25) // allow 25% difference
     14              this.close();
     15              test.done()
     16            }
     17          }, this)
     18        }
     19      })