Revision 65e0628ee53f311f25f50990f4e7b35ba67b06a0 authored by Henrik Skupin on 28 April 2018, 19:36:03 UTC, committed by moz-wptsync-bot on 28 April 2018, 19:48:02 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1457089
gecko-commit: 9d124f189e612ef45f466456934ccc1b1a4ff824
gecko-integration-branch: central
gecko-reviewers: jgraham
1 parent 0027df2
Raw File
abort-event-loadend.htm
<!DOCTYPE html>
<html>
<head>
    <link rel="help" href="https://xhr.spec.whatwg.org/#the-abort()-method" data-tested-assertations="following-sibling::ol/li[4]/ol/li[6]"/>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <title>XMLHttpRequest: The abort() method: Fire a progress event named loadend</title>
</head>

<body>
    <div id="log"></div>

    <script type="text/javascript">
        var test = async_test(function(test)
        {
            var xhr = new XMLHttpRequest();

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

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

            xhr.open("GET", "resources/content.py", true);
            xhr.send();
        });
    </script>
</body>
</html>
back to top