youenn.fablet@crf.canon.fr | 9663e66 | 2015-10-25 07:39:22 +0000 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
commit-queue@webkit.org | 82830d4 | 2016-12-15 13:47:57 +0000 | [diff] [blame] | 5 | <title>XMLHttpRequest: the LOADING state change may be emitted multiple times</title> |
youenn.fablet@crf.canon.fr | 9663e66 | 2015-10-25 07:39:22 +0000 | [diff] [blame] | 6 | <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.fr | 9663e66 | 2015-10-25 07:39:22 +0000 | [diff] [blame] | 9 | </head> |
| 10 | |
| 11 | <div id="log"></div> |
| 12 | |
| 13 | <script> |
| 14 | |
| 15 | var test = async_test(); |
| 16 | |
| 17 | test.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.org | 87169dc | 2017-04-09 18:49:22 +0000 | [diff] [blame] | 27 | assert_greater_than(countedLoading, 1, "LOADING state change may be emitted multiple times"); |
youenn.fablet@crf.canon.fr | 9663e66 | 2015-10-25 07:39:22 +0000 | [diff] [blame] | 28 | |
| 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> |