summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/test_disabled_ftp.js
blob: 953c9ac45bb3189064134a23d8bb2c3af4f1df09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use strict";

registerCleanupFunction(function() {
  Services.prefs.clearUserPref("network.ftp.enabled");
});

add_task(async function ftp_disabled() {
  Services.prefs.setBoolPref("network.ftp.enabled", false);
  Services.prefs.setBoolPref("network.protocol-handler.external.ftp", false);

  Assert.throws(
    () => {
      NetUtil.newChannel({
        uri: "ftp://ftp.de.debian.org/",
        loadUsingSystemPrincipal: true,
      }).QueryInterface(Ci.nsIHttpChannel);
    },
    /NS_ERROR_UNKNOWN_PROTOCOL/,
    "creating the FTP channel must throw"
  );
});