modules/libjar/test/unit/test_bug407303.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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