summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/test_channel_long_domain.js
blob: 86dbbed3e33f16efb023321857bc156d2403d17f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Tests that domains longer than 253 characters fail to load when pref is true

add_task(async function test_long_domain_fails() {
  let domain = "http://" + "a".repeat(254);

  let req = await new Promise(resolve => {
    let chan = NetUtil.newChannel({
      uri: domain,
      loadUsingSystemPrincipal: true,
    });
    chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE));
  });
  Assert.equal(req.status, Cr.NS_ERROR_UNKNOWN_HOST, "Request should fail");
});