зеркало из https://github.com/mozilla/gecko-dev.git
Bug 372050 - "Expose UnescapeString through nsINetUtil". Patch by Prasad Sunkari <prasad@medhas.org>. r+sr=biesi.
This commit is contained in:
Родитель
75eeeb31df
Коммит
cc4ca83433
|
@ -44,7 +44,7 @@ interface nsIURI;
|
|||
/**
|
||||
* nsINetUtil provides various network-related utility methods.
|
||||
*/
|
||||
[scriptable, uuid(c2bf4fea-7f9f-44a4-a7e0-8b323fdcc5d5)]
|
||||
[scriptable, uuid(7701f947-e4aa-431c-aec6-6bb304193460)]
|
||||
interface nsINetUtil : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -73,13 +73,18 @@ interface nsINetUtil : nsISupports
|
|||
|
||||
/** Leave alphanumeric characters and forward slashes intact,
|
||||
%XX-escape all others */
|
||||
const unsigned long ESCAPE_URL_PATH = 3;
|
||||
const unsigned long ESCAPE_URL_PATH = 4;
|
||||
|
||||
/**
|
||||
* escape a string with %00-style escaping
|
||||
*/
|
||||
ACString escapeString(in ACString aString, in unsigned long aEscapeType);
|
||||
|
||||
/**
|
||||
* unescape a %00-style escaped string
|
||||
*/
|
||||
ACString unescapeString(in ACString aString);
|
||||
|
||||
/**
|
||||
* Test whether the given URI's handler has the given protocol flags.
|
||||
*
|
||||
|
|
|
@ -945,7 +945,7 @@ nsIOService::EscapeString(const nsACString& aString,
|
|||
PRUint32 aEscapeType,
|
||||
nsACString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_RANGE(aEscapeType, 0, 3);
|
||||
NS_ENSURE_ARG_RANGE(aEscapeType, 0, 4);
|
||||
|
||||
nsCAutoString stringCopy(aString);
|
||||
nsCString result;
|
||||
|
@ -957,3 +957,18 @@ nsIOService::EscapeString(const nsACString& aString,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::UnescapeString(const nsACString& aString, nsACString& aResult)
|
||||
{
|
||||
char *str = ToNewCString(aString);
|
||||
|
||||
if (!str)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
str = nsUnescape(str);
|
||||
aResult.Assign(str);
|
||||
|
||||
NS_Free(str);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче