rem: cocoon.sendPage("redirect.xml", { "url" : redirectUri }); 
add: cocoon.redirectTo(redirectUri); 
context: function uploadDocument() {    var documentRoot = cocoon.parameters["documentRoot"];    var cocoonFlowHelper = new Packages.org.apache.lenya.cms.cocoon.flow.FlowHelper();    var redirectUri = cocoonFlowHelper.getRequestURI(cocoon);    var servletContextPath = cocoonFlowHelper.getPageEnvelope(cocoon).getPublication().getServletContext();    //var uploadHelper = new Packages.org.apache.lenya.cms.authoring.UploadHelper(documentRoot + "/authoring/al/140");    var uploadHelper = new Packages.org.apache.lenya.cms.authoring.UploadHelper(servletContextPath + "/lenya/pubs/default/content");        var uploaded = false;    while (!uploaded) {                cocoon.sendPageAndWait("form.xml", {            "error-messages" : null,            //"error-messages" : uploadHelper.getErrorMessages(),            "form-title" : "Upload Document"        });                if (cocoon.request.getParameter("upload-regulation")) {            var part = cocoon.request.get("upload-regulation");            uploaded = uploadHelper.save(part);        }    }        cocoon.sendPage("redirect.xml", { "url" : redirectUri });}
meta: 791	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/791/5b9c6ae2fb641effa76e35efe68abb2bee660da7/upload.js/buggy/src/webapp/lenya/pubs/default/resources/misc/upload.js