1 // -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 function check_ip(s, v, ip) {
18 let uri = Services.io.newURI(str);
19 ok(!s.isSecureURI(uri));
21 let parsedMaxAge = {};
22 let parsedIncludeSubdomains = {};
25 "max-age=1000;includeSubdomains",
28 parsedIncludeSubdomains
32 "URI should not be secure if it contains an IP address"
35 /* Test that processHeader will ignore headers for an uri, if the uri
36 * contains an IP address not a hostname.
37 * If processHeader indeed ignore the header, then the output parameters will
38 * remain empty, and we shouldn't see the values passed as the header.
40 notEqual(parsedMaxAge.value, 1000);
41 notEqual(parsedIncludeSubdomains.value, true);
42 notEqual(parsedMaxAge.value, undefined);
43 notEqual(parsedIncludeSubdomains.value, undefined);
47 let SSService = Cc["@mozilla.org/ssservice;1"].getService(
48 Ci.nsISiteSecurityService
51 check_ip(SSService, 4, "127.0.0.1");
52 check_ip(SSService, 4, "10.0.0.1");
53 check_ip(SSService, 6, "2001:db8::1");
54 check_ip(SSService, 6, "1080::8:800:200C:417A");