Table of contents
- 1. Method overview
- 2. Constants
- 3. Methods
- 3.1. createExposableURI()
- 3.2. createFixupURI()
- 3.3. keywordToURI()
- 4. See also
Interface implemented by objects capable of fixing up strings into URIs.
Inherits from:
nsISupports
Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)
Implemented by: @mozilla.org/docshell/urifixup;1 as a service:
var uRIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
.createInstance(Components.interfaces.nsIURIFixup);
Method overview
nsIURI createExposableURI(in nsIURI aURI); |
nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags); |
nsIURI keywordToURI(in AUTF8String aKeyword); Requires Gecko 1.9
|
Constants
| Constant | Value | Description |
FIXUP_FLAG_NONE | 0 | No fixup flags. |
FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP | 1 | Allow the fixup to use a keyword lookup service to complete the URI. The fixup object implementer should honour this flag and only perform any lengthy keyword (or search) operation if it is set. |
FIXUP_FLAGS_MAKE_ALTERNATE_URI | 2 | Tell the fixup to make an alternate URI from the input URI, for example to turn foo into www.foo.com. |
FIXUP_FLAG_USE_UTF8 | 4 | Use UTF-8 to encode the URI instead of the platform character set. Requires Gecko 9.0 |
Methods
createExposableURI()
Converts an internal URI (for example a WYSIWYG URI) into one which we can expose to the user, for example on the URL bar.
nsIURI createExposableURI( in nsIURI aURI );
Parameters
aURI- The URI to be converted.
Return value
The converted, exposable URI, as an nsIURI
.
Exceptions thrown
NS_ERROR_UNKNOWN_PROTOCOL- When we can not get a protocol handler service for the URI scheme.
NS_ERROR_MALFORMED_URI- When the exposable portion of
aURIis malformed.
createFixupURI()
Converts the specified string into a URI, first attempting to correct any errors in the syntax or other vagaries. Returns a well formed URI or nsnull if it cannot.
nsIURI createFixupURI( in AUTF8String aURIText, in unsigned long aFixupFlags );
Parameters
aURIText- Candidate URI.
aFixupFlags- Flags that govern ways the URI may be fixed up.
Return value
The converted URI.
Requires Gecko 1.9 (Firefox 3)
keywordToURI()
Converts the specified keyword string into a URI. Note that it is the caller's responsibility to check whether keywords are enabled and whether aKeyword is a sensible keyword.
nsIURI keywordToURI( in AUTF8String aKeyword );
Parameters
aKeyword- The keyword to convert into a URI.
Return value
The converted URI.
Mozilla Developer Network