Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * nsIIDNService interface. |
michael@0 | 9 | * |
michael@0 | 10 | * IDN (Internationalized Domain Name) support. Provides facilities |
michael@0 | 11 | * for manipulating IDN hostnames according to the specification set |
michael@0 | 12 | * forth by the IETF. |
michael@0 | 13 | * |
michael@0 | 14 | * IDN effort: |
michael@0 | 15 | * http://www.ietf.org/html.characters/idn-charter.html |
michael@0 | 16 | * http://www.i-dns.net |
michael@0 | 17 | * |
michael@0 | 18 | * IDNA specification: |
michael@0 | 19 | * http://search.ietf.org/internet-drafts/draft-ietf-idn-idna-06.txt |
michael@0 | 20 | */ |
michael@0 | 21 | |
michael@0 | 22 | [scriptable, uuid(a592a60e-3621-4f19-a318-2bf233cfad3e)] |
michael@0 | 23 | interface nsIIDNService : nsISupports |
michael@0 | 24 | { |
michael@0 | 25 | /** |
michael@0 | 26 | * Prepares the input hostname according to IDNA ToASCII operation, |
michael@0 | 27 | * the input hostname is assumed to be UTF8-encoded. |
michael@0 | 28 | */ |
michael@0 | 29 | ACString convertUTF8toACE(in AUTF8String input); |
michael@0 | 30 | |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * This is the ToUnicode operation as specified in the IDNA proposal, |
michael@0 | 34 | * with an additional step to encode the result in UTF-8. |
michael@0 | 35 | * It takes an ACE-encoded hostname and performs ToUnicode to it, then |
michael@0 | 36 | * encodes the resulting string into UTF8. |
michael@0 | 37 | */ |
michael@0 | 38 | AUTF8String convertACEtoUTF8(in ACString input); |
michael@0 | 39 | |
michael@0 | 40 | /** |
michael@0 | 41 | * Checks if the input string is ACE encoded or not. |
michael@0 | 42 | */ |
michael@0 | 43 | boolean isACE(in ACString input); |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * Performs the unicode normalization needed for hostnames in IDN, |
michael@0 | 47 | * for callers that want early normalization. |
michael@0 | 48 | */ |
michael@0 | 49 | AUTF8String normalize(in AUTF8String input); |
michael@0 | 50 | |
michael@0 | 51 | /** |
michael@0 | 52 | * Normalizes and converts a host to UTF-8 if the host is in the IDN |
michael@0 | 53 | * whitelist, otherwise converts it to ACE. This is useful for display |
michael@0 | 54 | * purposes and to ensure an encoding consistent with nsIURI::GetHost(). |
michael@0 | 55 | * If the result is ASCII or ACE encoded, |isASCII| will be true. |
michael@0 | 56 | */ |
michael@0 | 57 | AUTF8String convertToDisplayIDN(in AUTF8String input, out boolean isASCII); |
michael@0 | 58 | }; |