netwerk/dns/nsIIDNService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/dns/nsIIDNService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +/**
    1.11 + * nsIIDNService interface.
    1.12 + *
    1.13 + * IDN (Internationalized Domain Name) support. Provides facilities
    1.14 + * for manipulating IDN hostnames according to the specification set
    1.15 + * forth by the IETF.
    1.16 + *
    1.17 + * IDN effort:
    1.18 + * http://www.ietf.org/html.characters/idn-charter.html
    1.19 + * http://www.i-dns.net
    1.20 + *
    1.21 + * IDNA specification:
    1.22 + * http://search.ietf.org/internet-drafts/draft-ietf-idn-idna-06.txt
    1.23 + */
    1.24 +
    1.25 +[scriptable, uuid(a592a60e-3621-4f19-a318-2bf233cfad3e)]
    1.26 +interface nsIIDNService : nsISupports
    1.27 +{
    1.28 +    /**
    1.29 +     * Prepares the input hostname according to IDNA ToASCII operation,
    1.30 +     * the input hostname is assumed to be UTF8-encoded.
    1.31 +     */
    1.32 +    ACString convertUTF8toACE(in AUTF8String input);
    1.33 +
    1.34 +
    1.35 +    /**
    1.36 +     * This is the ToUnicode operation as specified in the IDNA proposal,
    1.37 +     * with an additional step to encode the result in UTF-8.
    1.38 +     * It takes an ACE-encoded hostname and performs ToUnicode to it, then
    1.39 +     * encodes the resulting string into UTF8.
    1.40 +     */
    1.41 +    AUTF8String convertACEtoUTF8(in ACString input);
    1.42 +
    1.43 +    /**
    1.44 +     * Checks if the input string is ACE encoded or not.
    1.45 +     */
    1.46 +    boolean isACE(in ACString input);
    1.47 +
    1.48 +    /**
    1.49 +     * Performs the unicode normalization needed for hostnames in IDN,
    1.50 +     * for callers that want early normalization.
    1.51 +     */
    1.52 +    AUTF8String normalize(in AUTF8String input);
    1.53 +
    1.54 +    /**
    1.55 +     * Normalizes and converts a host to UTF-8 if the host is in the IDN
    1.56 +     * whitelist, otherwise converts it to ACE. This is useful for display
    1.57 +     * purposes and to ensure an encoding consistent with nsIURI::GetHost().
    1.58 +     * If the result is ASCII or ACE encoded, |isASCII| will be true.
    1.59 +     */
    1.60 +    AUTF8String convertToDisplayIDN(in AUTF8String input, out boolean isASCII);
    1.61 +};

mercurial