1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 let SSService = Cc["@mozilla.org/ssservice;1"].getService(
9 Ci.nsISiteSecurityService
11 let uri = Services.io.newURI("https://example.com");
12 let uri1 = Services.io.newURI("https://example.com.");
13 let uri2 = Services.io.newURI("https://example.com..");
14 ok(!SSService.isSecureURI(uri));
15 ok(!SSService.isSecureURI(uri1));
16 // These cases are only relevant as long as bug 1118522 hasn't been fixed.
17 ok(!SSService.isSecureURI(uri2));
19 SSService.processHeader(uri, "max-age=1000;includeSubdomains");
20 ok(SSService.isSecureURI(uri));
21 ok(SSService.isSecureURI(uri1));
22 ok(SSService.isSecureURI(uri2));
24 SSService.resetState(uri);
25 ok(!SSService.isSecureURI(uri));
26 ok(!SSService.isSecureURI(uri1));
27 ok(!SSService.isSecureURI(uri2));
29 // Somehow creating this malformed URI succeeds - we need to handle it
31 uri = Services.io.newURI("https://../foo");
32 equal(uri.host, "..");
35 SSService.isSecureURI(uri);
37 /NS_ERROR_UNEXPECTED/,
38 "Malformed URI should be rejected"