netwerk/test/unit/test_freshconnection.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 // This is essentially a debug mode crashtest to make sure everything
michael@0 2 // involved in a reload runs on the right thread. It relies on the
michael@0 3 // assertions in necko.
michael@0 4
michael@0 5 var listener = {
michael@0 6 onStartRequest: function test_onStartR(request, ctx) {
michael@0 7 },
michael@0 8
michael@0 9 onDataAvailable: function test_ODA() {
michael@0 10 do_throw("Should not get any data!");
michael@0 11 },
michael@0 12
michael@0 13 onStopRequest: function test_onStopR(request, ctx, status) {
michael@0 14 do_test_finished();
michael@0 15 },
michael@0 16 };
michael@0 17
michael@0 18 function run_test() {
michael@0 19 var ios = Cc["@mozilla.org/network/io-service;1"].
michael@0 20 getService(Ci.nsIIOService);
michael@0 21 var chan = ios.newChannel("http://localhost:4444", "", null);
michael@0 22 chan.loadFlags = Ci.nsIRequest.LOAD_FRESH_CONNECTION |
michael@0 23 Ci.nsIChannel.LOAD_INITIAL_DOCUMENT_URI;
michael@0 24 chan.QueryInterface(Ci.nsIHttpChannel);
michael@0 25 chan.asyncOpen(listener, null);
michael@0 26 do_test_pending();
michael@0 27 }
michael@0 28

mercurial