michael@0: // Regression test for bug 407303 - A failed channel should not be checked michael@0: // for an unsafe content type. michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: michael@0: // XXX: NS_ERROR_UNKNOWN_HOST is not in Components.results michael@0: const NS_ERROR_UNKNOWN_HOST = 0x804B001E; michael@0: michael@0: var listener = { michael@0: QueryInterface: function(iid) { michael@0: if (iid.equals(Ci.nsISupports) || michael@0: iid.equals(Ci.nsIRequestObserver)) michael@0: return this; michael@0: throw Cr.NS_ERROR_NO_INTERFACE; michael@0: }, michael@0: michael@0: onStartRequest: function(request, context) { michael@0: }, michael@0: michael@0: onDataAvailable: function(request, context, stream, offset, count) { michael@0: do_throw("shouldn't get data!"); michael@0: }, michael@0: michael@0: onStopRequest: function(request, context, status) { michael@0: do_check_eq(status, NS_ERROR_UNKNOWN_HOST); michael@0: do_test_finished(); michael@0: } michael@0: }; michael@0: michael@0: function run_test() { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: michael@0: var channel = ios.newChannel("jar:http://test.invalid/test.jar!/index.html", michael@0: null, null); michael@0: channel.asyncOpen(listener, null); michael@0: do_test_pending(); michael@0: }