1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/urlformatter/nsIURLFormatter.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 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 +/** 1.9 + * nsIURLFormatter 1.10 + * 1.11 + * nsIURLFormatter exposes methods to substitute variables in URL formats. 1.12 + * Variable names can contain 'A-Z' letters and '_' characters. 1.13 + * 1.14 + * Mozilla Applications linking to Mozilla websites are strongly encouraged to use 1.15 + * URLs of the following format: 1.16 + * 1.17 + * http[s]://%SERVICE%.mozilla.[com|org]/%LOCALE%/ 1.18 + */ 1.19 + 1.20 +#include "nsISupports.idl" 1.21 + 1.22 +[scriptable, uuid(4ab31d30-372d-11db-a98b-0800200c9a66)] 1.23 +interface nsIURLFormatter: nsISupports 1.24 +{ 1.25 + /** 1.26 + * formatURL - Formats a string URL 1.27 + * 1.28 + * The set of known variables is predefined. 1.29 + * If a variable is unknown, it is left unchanged and a non-fatal error is reported. 1.30 + * 1.31 + * @param aFormat string Unformatted URL. 1.32 + * 1.33 + * @return The formatted URL. 1.34 + */ 1.35 + AString formatURL(in AString aFormat); 1.36 + 1.37 + /** 1.38 + * formatURLPref - Formats a string URL stored in a preference 1.39 + * 1.40 + * If the preference value cannot be retrieved, a fatal error is reported 1.41 + * and the "about:blank" URL is returned. 1.42 + * 1.43 + * @param aPref string Preference name. 1.44 + * 1.45 + * @return The formatted URL returned by formatURL(), or "about:blank". 1.46 + */ 1.47 + AString formatURLPref(in AString aPref); 1.48 +};