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.

     1 // Regression test for bug 407303 - A failed channel should not be checked
     2 // for an unsafe content type.
     4 const Cc = Components.classes;
     5 const Ci = Components.interfaces;
     7 // XXX: NS_ERROR_UNKNOWN_HOST is not in Components.results
     8 const NS_ERROR_UNKNOWN_HOST = 0x804B001E;
    10 var listener = {
    11   QueryInterface: function(iid) {
    12     if (iid.equals(Ci.nsISupports) ||
    13         iid.equals(Ci.nsIRequestObserver))
    14       return this;
    15     throw Cr.NS_ERROR_NO_INTERFACE;
    16   },
    18   onStartRequest: function(request, context) {
    19   },
    21   onDataAvailable: function(request, context, stream, offset, count) {
    22     do_throw("shouldn't get data!");
    23   },
    25   onStopRequest: function(request, context, status) {
    26     do_check_eq(status, NS_ERROR_UNKNOWN_HOST);
    27     do_test_finished();
    28   }
    29 };
    31 function run_test() {
    32   var ios = Cc["@mozilla.org/network/io-service;1"].
    33             getService(Ci.nsIIOService);
    35   var channel = ios.newChannel("jar:http://test.invalid/test.jar!/index.html",
    36                                null, null);
    37   channel.asyncOpen(listener, null);
    38   do_test_pending();
    39 }

mercurial