modules/libjar/test/unit/test_bug407303.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 // Regression test for bug 407303 - A failed channel should not be checked
michael@0 2 // for an unsafe content type.
michael@0 3
michael@0 4 const Cc = Components.classes;
michael@0 5 const Ci = Components.interfaces;
michael@0 6
michael@0 7 // XXX: NS_ERROR_UNKNOWN_HOST is not in Components.results
michael@0 8 const NS_ERROR_UNKNOWN_HOST = 0x804B001E;
michael@0 9
michael@0 10 var listener = {
michael@0 11 QueryInterface: function(iid) {
michael@0 12 if (iid.equals(Ci.nsISupports) ||
michael@0 13 iid.equals(Ci.nsIRequestObserver))
michael@0 14 return this;
michael@0 15 throw Cr.NS_ERROR_NO_INTERFACE;
michael@0 16 },
michael@0 17
michael@0 18 onStartRequest: function(request, context) {
michael@0 19 },
michael@0 20
michael@0 21 onDataAvailable: function(request, context, stream, offset, count) {
michael@0 22 do_throw("shouldn't get data!");
michael@0 23 },
michael@0 24
michael@0 25 onStopRequest: function(request, context, status) {
michael@0 26 do_check_eq(status, NS_ERROR_UNKNOWN_HOST);
michael@0 27 do_test_finished();
michael@0 28 }
michael@0 29 };
michael@0 30
michael@0 31 function run_test() {
michael@0 32 var ios = Cc["@mozilla.org/network/io-service;1"].
michael@0 33 getService(Ci.nsIIOService);
michael@0 34
michael@0 35 var channel = ios.newChannel("jar:http://test.invalid/test.jar!/index.html",
michael@0 36 null, null);
michael@0 37 channel.asyncOpen(listener, null);
michael@0 38 do_test_pending();
michael@0 39 }

mercurial