netwerk/test/unit/test_bug561042.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 Cu.import("resource://testing-common/httpd.js");
michael@0 2
michael@0 3 const SERVER_PORT = 8080;
michael@0 4 const baseURL = "http://localhost:" + SERVER_PORT + "/";
michael@0 5
michael@0 6 var cookie = "";
michael@0 7 for (let i =0; i < 10000; i++) {
michael@0 8 cookie += " big cookie";
michael@0 9 }
michael@0 10
michael@0 11 var listener = {
michael@0 12 onStartRequest: function (request, ctx) {
michael@0 13 },
michael@0 14
michael@0 15 onDataAvailable: function (request, ctx, stream) {
michael@0 16 },
michael@0 17
michael@0 18 onStopRequest: function (request, ctx, status) {
michael@0 19 do_check_eq(status, Components.results.NS_OK);
michael@0 20 do_test_finished();
michael@0 21 },
michael@0 22
michael@0 23 };
michael@0 24
michael@0 25 function run_test() {
michael@0 26 var server = new HttpServer();
michael@0 27 server.start(SERVER_PORT);
michael@0 28 server.registerPathHandler('/', function(metadata, response) {
michael@0 29 response.setStatusLine(metadata.httpVersion, 200, "OK");
michael@0 30 response.setHeader("Set-Cookie", "BigCookie=" + cookie, false);
michael@0 31 response.write("Hello world");
michael@0 32 });
michael@0 33
michael@0 34 var ios = Components.classes["@mozilla.org/network/io-service;1"]
michael@0 35 .getService(Components.interfaces.nsIIOService);
michael@0 36 var chan = ios.newChannel(baseURL, null, null)
michael@0 37 .QueryInterface(Components.interfaces.nsIHttpChannel);
michael@0 38 chan.asyncOpen(listener, null);
michael@0 39 do_test_pending();
michael@0 40 }

mercurial