Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | Cu.import("resource://testing-common/httpd.js"); |
michael@0 | 2 | |
michael@0 | 3 | var server; |
michael@0 | 4 | const BUGID = "331825"; |
michael@0 | 5 | |
michael@0 | 6 | function TestListener() { |
michael@0 | 7 | } |
michael@0 | 8 | TestListener.prototype.onStartRequest = function(request, context) { |
michael@0 | 9 | } |
michael@0 | 10 | TestListener.prototype.onStopRequest = function(request, context, status) { |
michael@0 | 11 | var channel = request.QueryInterface(Components.interfaces.nsIHttpChannel); |
michael@0 | 12 | do_check_eq(channel.responseStatus, 304); |
michael@0 | 13 | |
michael@0 | 14 | server.stop(do_test_finished); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function run_test() { |
michael@0 | 18 | // start server |
michael@0 | 19 | server = new HttpServer(); |
michael@0 | 20 | |
michael@0 | 21 | server.registerPathHandler("/bug" + BUGID, bug331825); |
michael@0 | 22 | |
michael@0 | 23 | server.start(-1); |
michael@0 | 24 | |
michael@0 | 25 | // make request |
michael@0 | 26 | var channel = |
michael@0 | 27 | Components.classes["@mozilla.org/network/io-service;1"]. |
michael@0 | 28 | getService(Components.interfaces.nsIIOService). |
michael@0 | 29 | newChannel("http://localhost:" + server.identity.primaryPort + "/bug" + |
michael@0 | 30 | BUGID, null, null); |
michael@0 | 31 | |
michael@0 | 32 | channel.QueryInterface(Components.interfaces.nsIHttpChannel); |
michael@0 | 33 | channel.setRequestHeader("If-None-Match", "foobar", false); |
michael@0 | 34 | channel.asyncOpen(new TestListener(), null); |
michael@0 | 35 | |
michael@0 | 36 | do_test_pending(); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | // PATH HANDLER FOR /bug331825 |
michael@0 | 40 | function bug331825(metadata, response) { |
michael@0 | 41 | response.setStatusLine(metadata.httpVersion, 304, "Not Modified"); |
michael@0 | 42 | } |