summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/event-readystate-sync-open.any.js
blob: a8a4fe7f9a196b6ab01d84bef1e9f0b9b6184d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// META: title=XMLHttpRequest: open() call fires sync readystate event

const title = "XMLHttpRequest: open() call fires sync readystate event";

test(function () {
  var client = new XMLHttpRequest()
  var eventsFired = []
  client.onreadystatechange = function () {
    eventsFired.push(client.readyState)
  }
  client.open('GET', "...", false)
  assert_array_equals(eventsFired, [1])
}, title + ' (sync)');

test(function () {
  var client = new XMLHttpRequest()
  var eventsFired = []
  client.onreadystatechange = function () {
    eventsFired.push(client.readyState)
  }
  client.open('GET', "...", true)
  assert_array_equals(eventsFired, [1])
}, title + ' (async)');