nsIIDNService.idl 1.9 KB

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