modules/libjar/test/unit/test_bug407303.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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