Bug 1800790 [wpt PR 36982] - Add makotokato as reviewer, a=testonly
[gecko.git] / intl / uconv / nsITextToSubURI.idl
blob3bb404e4148357ed2b4c753918043e814dee9160
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.idl"
9 %{C++
10 // {8B042E22-6F87-11d3-B3C8-00805F8A6670}
11 #define NS_TEXTTOSUBURI_CID { 0x8b042e22, 0x6f87, 0x11d3, { 0xb3, 0xc8, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
12 #define NS_ITEXTTOSUBURI_CONTRACTID "@mozilla.org/intl/texttosuburi;1"
15 [scriptable, uuid(8B042E24-6F87-11d3-B3C8-00805F8A6670)]
16 interface nsITextToSubURI : nsISupports
18 ACString ConvertAndEscape(in ACString charset, in AString text);
19 AString UnEscapeAndConvert(in ACString charset, in ACString text);
21 /**
22 * Unescapes the given URI fragment (for UI purpose only)
23 * Note:
24 * <ul>
25 * <li> escaping back the result (unescaped string) is not guaranteed to
26 * give the original escaped string
27 * <li> The URI fragment (escaped) is assumed to be in UTF-8 and converted
28 * to AString (UTF-16)
29 * <li> In case of successful conversion any resulting character listed
30 * in netwerk/dns/IDNCharacterBlocklist.inc (except space) is escaped
31 * <li> Always succeeeds (callers don't need to do error checking)
32 * </ul>
34 * @param aURIFragment the URI (or URI fragment) to unescape
35 * @param aDontEscape whether to escape IDN blocklisted characters
36 * @return Unescaped aURIFragment converted to unicode
38 AString unEscapeURIForUI(in AUTF8String aURIFragment,
39 [optional] in boolean aDontEscape);
40 %{C++
41 nsresult UnEscapeURIForUI(const nsACString& aURIFragment,
42 nsAString& _retval) {
43 return UnEscapeURIForUI(aURIFragment, false, _retval);
47 /**
48 * Unescapes only non ASCII characters in the given URI fragment
49 * note: this method assumes the URI as UTF-8 and fallbacks to the given
50 * charset if the charset is an ASCII superset
52 * @param aCharset the charset to convert from
53 * @param aURIFragment the URI (or URI fragment) to unescape
54 * @return Unescaped aURIFragment converted to unicode
55 * @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
56 * or NS_ERROR_UDEC_ILLEGALINPUT in case of conversion failure
58 [binaryname(UnEscapeNonAsciiURIJS)]
59 AString unEscapeNonAsciiURI(in ACString aCharset, in AUTF8String aURIFragment);