summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/test_bug376660.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /netwerk/test/unit/test_bug376660.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/test/unit/test_bug376660.js')
-rw-r--r--netwerk/test/unit/test_bug376660.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/netwerk/test/unit/test_bug376660.js b/netwerk/test/unit/test_bug376660.js
new file mode 100644
index 000000000..8208eef6a
--- /dev/null
+++ b/netwerk/test/unit/test_bug376660.js
@@ -0,0 +1,72 @@
+Cu.import("resource://gre/modules/NetUtil.jsm");
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+
+var listener = {
+ expect_failure: false,
+ QueryInterface: function listener_qi(iid) {
+ if (iid.equals(Ci.nsISupports) ||
+ iid.equals(Ci.nsIUnicharStreamLoaderObserver)) {
+ return this;
+ }
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ },
+ onDetermineCharset : function onDetermineCharset(loader, context, data)
+ {
+ return "us-ascii";
+ },
+ onStreamComplete : function onStreamComplete (loader, context, status, data)
+ {
+ try {
+ if (this.expect_failure)
+ do_check_false(Components.isSuccessCode(status));
+ else
+ do_check_eq(status, Components.results.NS_OK);
+ do_check_eq(data, "");
+ do_check_neq(loader.channel, null);
+ tests[current_test++]();
+ } finally {
+ do_test_finished();
+ }
+ }
+};
+
+var current_test = 0;
+var tests = [test1, test2, done];
+
+function run_test() {
+ tests[current_test++]();
+}
+
+function test1() {
+ var f =
+ Cc["@mozilla.org/network/unichar-stream-loader;1"].
+ createInstance(Ci.nsIUnicharStreamLoader);
+ f.init(listener);
+
+ var chan = NetUtil.newChannel({
+ uri: "data:text/plain,",
+ loadUsingSystemPrincipal: true
+ });
+ chan.asyncOpen2(f);
+ do_test_pending();
+}
+
+function test2() {
+ var f =
+ Cc["@mozilla.org/network/unichar-stream-loader;1"].
+ createInstance(Ci.nsIUnicharStreamLoader);
+ f.init(listener);
+
+ var chan = NetUtil.newChannel({
+ uri: "http://localhost:0/",
+ loadUsingSystemPrincipal: true
+ });
+ listener.expect_failure = true;
+ chan.asyncOpen2(f);
+ do_test_pending();
+}
+
+function done() {
+}