Sync web-platform-tests up to revision a5b95cb31914507088a4eda16f7674bbc6f3313f
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / XMLHttpRequest / event-loadend.htm
1 <!doctype html>
2 <html>
3   <head>
4     <title>XMLHttpRequest: loadend event</title>
5     <script src="/resources/testharness.js"></script>
6     <script src="/resources/testharnessreport.js"></script>
7     <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onloadend" data-tested-assertations="/../.." />
8     <link rel="help" href="https://xhr.spec.whatwg.org/#event-xhr-loadend" data-tested-assertations="/../.." />
9   </head>
10   <body>
11     <div id="log"></div>
12     <script>
13       var test = async_test();
14       test.step(function() {
15         var client = new XMLHttpRequest();
16         client.onloadend = test.step_func(function(e) {
17          assert_true(e instanceof ProgressEvent);
18          assert_equals(e.type, "loadend");
19          test.done();
20         });
21         client.onreadystatechange = function() {
22           if (client.readyState !== 4) return;
23           test.step_timeout(() => {
24             assert_unreached("onloadend not called after 100 ms");
25           }, 100);
26         };
27         client.open("GET", "resources/well-formed.xml");
28         client.send(null);
29       });
30     </script>
31   </body>
32 </html>