1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/passwordmgr/test/formsubmit.sjs Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +function handleRequest(request, response) 1.5 +{ 1.6 + try { 1.7 + reallyHandleRequest(request, response); 1.8 + } catch (e) { 1.9 + response.setStatusLine("1.0", 200, "AlmostOK"); 1.10 + response.write("Error handling request: " + e); 1.11 + } 1.12 +} 1.13 + 1.14 + 1.15 +function reallyHandleRequest(request, response) { 1.16 + var match; 1.17 + var requestAuth = true; 1.18 + 1.19 + // XXX I bet this doesn't work for POST requests. 1.20 + var query = request.queryString; 1.21 + 1.22 + var user = null, pass = null; 1.23 + // user=xxx 1.24 + match = /user=([^&]*)/.exec(query); 1.25 + if (match) 1.26 + user = match[1]; 1.27 + 1.28 + // pass=xxx 1.29 + match = /pass=([^&]*)/.exec(query); 1.30 + if (match) 1.31 + pass = match[1]; 1.32 + 1.33 + response.setStatusLine("1.0", 200, "OK"); 1.34 + 1.35 + response.setHeader("Content-Type", "application/xhtml+xml", false); 1.36 + response.write("<html xmlns='http://www.w3.org/1999/xhtml'>"); 1.37 + response.write("<p>User: <span id='user'>" + user + "</span></p>\n"); 1.38 + response.write("<p>Pass: <span id='pass'>" + pass + "</span></p>\n"); 1.39 + response.write("</html>"); 1.40 +}