summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/xhr/abort-upload-event-abort.any.js
blob: 3c85a5554bdb67b714ce9765712eac617e54ed8c (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 abort 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.onabort = function(e)
            {
                test.step(function()
                {
                    assert_true(e instanceof ProgressEvent);
                    assert_equals(e.type, "abort");
                    assert_equals(e.target, xhr.upload);
                    test.done();
                });
            };

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