1 var Cc = Components.classes;
2 var Ci = Components.interfaces;
6 QueryInterface: function listener_qi(iid) {
7 if (iid.equals(Ci.nsISupports) ||
8 iid.equals(Ci.nsIUnicharStreamLoaderObserver)) {
11 throw Components.results.NS_ERROR_NO_INTERFACE;
13 onDetermineCharset : function onDetermineCharset(loader, context,
18 onStreamComplete : function onStreamComplete (loader, context, status, data)
21 if (this.expect_failure)
22 do_check_false(Components.isSuccessCode(status));
24 do_check_eq(status, Components.results.NS_OK);
25 do_check_eq(data, null);
26 do_check_neq(loader.channel, null);
27 tests[current_test++]();
35 var tests = [test1, test2, done];
38 tests[current_test++]();
43 Cc["@mozilla.org/network/unichar-stream-loader;1"].
44 createInstance(Ci.nsIUnicharStreamLoader);
45 f.init(listener, 4096);
47 var ios = Components.classes["@mozilla.org/network/io-service;1"]
48 .getService(Components.interfaces.nsIIOService);
49 var chan = ios.newChannel("data:text/plain,", null, null);
50 chan.asyncOpen(f, null);
56 Cc["@mozilla.org/network/unichar-stream-loader;1"].
57 createInstance(Ci.nsIUnicharStreamLoader);
58 f.init(listener, 4096);
60 var ios = Components.classes["@mozilla.org/network/io-service;1"]
61 .getService(Components.interfaces.nsIIOService);
62 var chan = ios.newChannel("http://localhost:0/", null, null);
63 listener.expect_failure = true;
64 chan.asyncOpen(f, null);