|
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/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 /** |
|
8 * nsIIDNService interface. |
|
9 * |
|
10 * IDN (Internationalized Domain Name) support. Provides facilities |
|
11 * for manipulating IDN hostnames according to the specification set |
|
12 * forth by the IETF. |
|
13 * |
|
14 * IDN effort: |
|
15 * http://www.ietf.org/html.characters/idn-charter.html |
|
16 * http://www.i-dns.net |
|
17 * |
|
18 * IDNA specification: |
|
19 * http://search.ietf.org/internet-drafts/draft-ietf-idn-idna-06.txt |
|
20 */ |
|
21 |
|
22 [scriptable, uuid(a592a60e-3621-4f19-a318-2bf233cfad3e)] |
|
23 interface nsIIDNService : nsISupports |
|
24 { |
|
25 /** |
|
26 * Prepares the input hostname according to IDNA ToASCII operation, |
|
27 * the input hostname is assumed to be UTF8-encoded. |
|
28 */ |
|
29 ACString convertUTF8toACE(in AUTF8String input); |
|
30 |
|
31 |
|
32 /** |
|
33 * This is the ToUnicode operation as specified in the IDNA proposal, |
|
34 * with an additional step to encode the result in UTF-8. |
|
35 * It takes an ACE-encoded hostname and performs ToUnicode to it, then |
|
36 * encodes the resulting string into UTF8. |
|
37 */ |
|
38 AUTF8String convertACEtoUTF8(in ACString input); |
|
39 |
|
40 /** |
|
41 * Checks if the input string is ACE encoded or not. |
|
42 */ |
|
43 boolean isACE(in ACString input); |
|
44 |
|
45 /** |
|
46 * Performs the unicode normalization needed for hostnames in IDN, |
|
47 * for callers that want early normalization. |
|
48 */ |
|
49 AUTF8String normalize(in AUTF8String input); |
|
50 |
|
51 /** |
|
52 * Normalizes and converts a host to UTF-8 if the host is in the IDN |
|
53 * whitelist, otherwise converts it to ACE. This is useful for display |
|
54 * purposes and to ensure an encoding consistent with nsIURI::GetHost(). |
|
55 * If the result is ASCII or ACE encoded, |isASCII| will be true. |
|
56 */ |
|
57 AUTF8String convertToDisplayIDN(in AUTF8String input, out boolean isASCII); |
|
58 }; |