tor-browser

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

format-field-id-2.any.js (844B)


      1 // META: title=EventSource: Last-Event-ID (2)
      2    var test = async_test()
      3      test.step(function() {
      4        var source = new EventSource("resources/last-event-id.py"),
      5            counter = 0
      6        source.onmessage = function(e) {
      7          test.step(function() {
      8            if(e.data == "hello" && counter == 0) {
      9              counter++
     10              assert_equals(e.lastEventId, "…")
     11            } else if(counter == 1) {
     12              counter++
     13              assert_equals("…", e.data)
     14              assert_equals("…", e.lastEventId)
     15            } else if(counter == 2) {
     16              counter++
     17              assert_equals("…", e.data)
     18              assert_equals("…", e.lastEventId)
     19              source.close()
     20              test.done()
     21            } else
     22              assert_unreached()
     23          })
     24        }
     25      })