chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/workers/resources/upload-onprogress-worker.js

importScripts("worker-pre.js");

function log(message)
{
    postMessage("log " + message);
}

function onLoad()
{
    postMessage("DONE");
}

function onProgress(e)
{
    postMessage("tick " + e.loaded);
}

function init()
{
    try {
        var xhr = new XMLHttpRequest();
        xhr.upload.onprogress = onProgress;
        xhr.onload = onLoad;
        xhr.open("POST", "../../resources/post-echo.cgi");
        xhr.send((new Array(100000)).join("aa"));
    } catch (e) {
        log("Exception received.");
    }
}