-
Notifications
You must be signed in to change notification settings - Fork 42
/
104fx_import_esr102_stspreload.pl
executable file
·57 lines (47 loc) · 1.34 KB
/
104fx_import_esr102_stspreload.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl -s
print <<'EOF';
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*****************************************************************************/
/* This is an automatically generated file. If you're not */
/* nsSiteSecurityService.cpp, you shouldn't be #including it. */
/*****************************************************************************/
/* imported from ESR102 by TenFourFox conversion script */
#include <stdint.h>
EOF
# let's have a little paranoia.
while(<>) {
if (/^const PRTime gPreloadListExpirationTime = INT64_C/) {
print;
$got_time = 1;
}
if (/%%/) {
$got_delim = 1;
last;
}
}
die("unexpected format of $source\n") if (!$got_time || !$got_delim);
print <<'EOF';
class nsSTSPreload
{
public:
const char *mHost;
const bool mIncludeSubdomains;
};
static const nsSTSPreload kSTSPreloadList[] = {
EOF
while(<>) {
chomp;
last if (/%%/);
($host, $subd, $crap) = split(/, /, $_, 3);
if (!length($crap) && length($host) &&
($subd eq '0' || $subd eq '1')) {
print " { \"$host\", ";
print (($subd eq '1') ? "true" : "false");
print " },\n";
} else {
die("unexpected line: $_\n");
}
}
print "};\n";