blob: 452efafae9f733b1e78ca6a73c65e017be2655fc [file] [log] [blame]
youenn.fablet@crf.canon.fr9663e662015-10-25 07:39:22 +00001<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
commit-queue@webkit.org82830d42016-12-15 13:47:57 +00005 <title>XMLHttpRequest: the LOADING state change may be emitted multiple times</title>
youenn.fablet@crf.canon.fr9663e662015-10-25 07:39:22 +00006 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
8 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[10]/dt[1]">
youenn.fablet@crf.canon.fr9663e662015-10-25 07:39:22 +00009</head>
10
11<div id="log"></div>
12
13<script>
14
15var test = async_test();
16
17test.step(function() {
18 var client = new XMLHttpRequest();
19 var countedLoading = 0;
20
21 client.onreadystatechange = test.step_func(function() {
22 if (client.readyState === 3) {
23 countedLoading += 1;
24 }
25
26 if (client.readyState === 4) {
commit-queue@webkit.org87169dc2017-04-09 18:49:22 +000027 assert_greater_than(countedLoading, 1, "LOADING state change may be emitted multiple times");
youenn.fablet@crf.canon.fr9663e662015-10-25 07:39:22 +000028
29 test.done();
30 }
31 });
32
33 client.open("GET", "resources/trickle.py?count=10"); // default timeout in trickle.py is 1/2 sec, so this request will take 5 seconds to complete
34 client.send(null);
35});
36</script>