blob: dc22e1a84139b6e51f3249120f01a94ccf564ca0 [file] [log] [blame]
ronkorving5a4ba022013-06-08 07:34:561<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
Hallvord Reiar M. Steenee396df2013-06-10 13:27:405 <title>XMLHttpRequest: the LOADING state change should only happen once</title>
ronkorving5a4ba022013-06-08 07:34:566 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
Hallvord Reiar M. Steenc136f2b2013-06-10 13:51:458 <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::ol[1]/li[10]/dt[1]">
9 <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[7] following::a[contains(@href,'#switch-loading')]/..">
10 <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#switch-loading" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[2]">
ronkorving5a4ba022013-06-08 07:34:5611</head>
12
13<div id="log"></div>
14
15<script>
16
17var test = async_test();
18
19test.step(function() {
20 var client = new XMLHttpRequest();
21 var countedLoading = 0;
22
23 client.onreadystatechange = test.step_func(function() {
24 if (client.readyState === 3) {
25 countedLoading += 1;
26 }
27
28 if (client.readyState === 4) {
ronkorving05650d82013-06-08 07:36:4729 assert_equals(countedLoading, 1, "LOADING state change may only be emitted once");
ronkorving5a4ba022013-06-08 07:34:5630
31 test.done();
32 }
33 });
34
James Graham234a6722013-09-17 17:54:3835 client.open("GET", "resources/trickle.py?count=1000");
ronkorving5a4ba022013-06-08 07:34:5636 client.send(null);
37});
38</script>