Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function getInputStream(path) |
michael@0 | 2 | { |
michael@0 | 3 | var file = Components.classes["@mozilla.org/file/directory_service;1"]. |
michael@0 | 4 | getService(Components.interfaces.nsIProperties). |
michael@0 | 5 | get("CurWorkD", Components.interfaces.nsILocalFile); |
michael@0 | 6 | var fis = Components.classes['@mozilla.org/network/file-input-stream;1']. |
michael@0 | 7 | createInstance(Components.interfaces.nsIFileInputStream); |
michael@0 | 8 | var split = path.split("/"); |
michael@0 | 9 | for(var i = 0; i < split.length; ++i) { |
michael@0 | 10 | file.append(split[i]); |
michael@0 | 11 | } |
michael@0 | 12 | fis.init(file, -1, -1, false); |
michael@0 | 13 | return fis; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | |
michael@0 | 18 | function handleRequest(request, response) |
michael@0 | 19 | { |
michael@0 | 20 | var inputStream = getInputStream("tests/content/base/test/bug638112-response.txt") |
michael@0 | 21 | response.seizePower(); |
michael@0 | 22 | response.bodyOutputStream.writeFrom(inputStream, |
michael@0 | 23 | inputStream.available()); |
michael@0 | 24 | response.finish(); |
michael@0 | 25 | inputStream.close(); |
michael@0 | 26 | } |