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/. */
6 // The purpose of this test is to create an old site security service state
7 // file that is too large and see that the site security service migrates it to
8 // the new format properly.
11 let profileDir = do_get_profile();
12 let stateFile = profileDir.clone();
13 stateFile.append(SSS_STATE_OLD_FILE_NAME);
14 // Assuming we're working with a clean slate, the file shouldn't exist
15 // until we create it.
16 ok(!stateFile.exists());
17 let outputStream = FileUtils.openFileOutputStream(stateFile);
18 let expiryTime = Date.now() + 100000;
20 for (let i = 0; i < 10000; i++) {
21 // The 0s will all get squashed down into one 0 when they are read.
22 // This is just to make the file size large (>2MB).
24 `example${i}.example.com\t` +
25 "0000000000000000000000000000000000000000000000000\t" +
26 "00000000000000000000000000000000000000\t" +
30 writeLinesAndClose(lines, outputStream);
32 let siteSecurityService = Cc["@mozilla.org/ssservice;1"].getService(
33 Ci.nsISiteSecurityService
35 notEqual(siteSecurityService, null);
38 siteSecurityService.isSecureURI(
39 Services.io.newURI("https://example0.example.com")
43 siteSecurityService.isSecureURI(
44 Services.io.newURI("https://example423.example.com")
48 siteSecurityService.isSecureURI(
49 Services.io.newURI("https://example1023.example.com")
53 !siteSecurityService.isSecureURI(
54 Services.io.newURI("https://example1024.example.com")
58 !siteSecurityService.isSecureURI(
59 Services.io.newURI("https://example1025.example.com")
63 !siteSecurityService.isSecureURI(
64 Services.io.newURI("https://example9000.example.com")
68 !siteSecurityService.isSecureURI(
69 Services.io.newURI("https://example99999.example.com")