https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 9e1f53182b80d8c890257a03fe9086b5530e7f04 authored by James Graham on 09 April 2014, 11:59:00 UTC
fixup! Poll for resource loading on the client side rather than the server side.
Tip revision: 9e1f531
send-response-upload-event-loadend.htm
<!DOCTYPE html>
<html>
<head>
    <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#handler-xhr-onloadend" data-tested-assertations="../.." />
    <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#event-xhr-loadend" data-tested-assertations="../.." />
    <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::a[contains(@href,'#make-upload-progress-notifications')]/.. following::ol[1]/li[8]" />
    <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#make-upload-progress-notifications" data-tested-assertations="following::ul[1]/li[2]/ol[1]/li[4]" />

    <script src="/resources/testharness.js"></script>
    <title>XMLHttpRequest: The send() method: Fire a progress event named loadend on the XMLHttpRequestUpload (synchronous flag is unset)</title>
</head>

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

    <script type="text/javascript">
        var test = async_test();

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

            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");
        });
    </script>
</body>
</html>
back to top