Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | function run_test() { |
michael@0 | 2 | do_test_pending(); |
michael@0 | 3 | |
michael@0 | 4 | function StreamListener() {} |
michael@0 | 5 | |
michael@0 | 6 | StreamListener.prototype = { |
michael@0 | 7 | QueryInterface: function(aIID) { |
michael@0 | 8 | if (aIID.equals(Components.interfaces.nsIStreamListener) || |
michael@0 | 9 | aIID.equals(Components.interfaces.nsIRequestObserver) || |
michael@0 | 10 | aIID.equals(Components.interfaces.nsISupports)) |
michael@0 | 11 | return this; |
michael@0 | 12 | throw Components.results.NS_NOINTERFACE; |
michael@0 | 13 | }, |
michael@0 | 14 | |
michael@0 | 15 | onStartRequest: function(aRequest, aContext) {}, |
michael@0 | 16 | |
michael@0 | 17 | onStopRequest: function(aRequest, aContext, aStatusCode) { |
michael@0 | 18 | // Make sure we can catch the error NS_ERROR_FILE_NOT_FOUND here. |
michael@0 | 19 | do_check_eq(aStatusCode, Components.results.NS_ERROR_FILE_NOT_FOUND); |
michael@0 | 20 | do_test_finished(); |
michael@0 | 21 | }, |
michael@0 | 22 | |
michael@0 | 23 | onDataAvailable: function(aRequest, aContext, aStream, aOffset, aCount) { |
michael@0 | 24 | do_throw("The channel must not call onDataAvailable()."); |
michael@0 | 25 | } |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | let listener = new StreamListener(); |
michael@0 | 29 | let ios = Components.classes["@mozilla.org/network/io-service;1"] |
michael@0 | 30 | .getService(Components.interfaces.nsIIOService); |
michael@0 | 31 | |
michael@0 | 32 | // This file does not exist. |
michael@0 | 33 | let file = do_get_file("_NOT_EXIST_.txt", true); |
michael@0 | 34 | do_check_false(file.exists()); |
michael@0 | 35 | |
michael@0 | 36 | let channel = ios.newChannelFromURI(ios.newFileURI(file)); |
michael@0 | 37 | channel.asyncOpen(listener, null); |
michael@0 | 38 | } |