summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/abort-upload-event-loadend.any.js
blob: 91c5dc5c72e24a5eca62480a1a0d755791717ccc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
        var test = async_test("XMLHttpRequest: The abort() method: Fire a progress event named loadend on the XMLHttpRequestUpload object");

        test.step(function()
        {
            var xhr = new XMLHttpRequest();

            xhr.onloadstart = function()
            {
                test.step(function ()
                {
                    if (xhr.readyState == 1)
                    {
                        xhr.abort();
                    }
                });
            };

            xhr.upload.onloadend = function(e)
            {
                test.step(function()
                {
                    assert_true(e instanceof ProgressEvent);
                    assert_equals(e.type, "loadend");
                    assert_equals(e.target, xhr.upload);
                    test.done();
                });
            };

            xhr.open("POST", "./resources/content.py", true);
            xhr.send("Test Message");
        });