docshell/base/nsIURIFixup.idlScriptable
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);
nsIURIFixupInfo getFixupURIInfo(in AUTF8String aURIText, in unsigned long aFixupFlags);

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.
FIXUP_FLAG_FIX_SCHEME_TYPOS 8 Fix common scheme typos.

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 aURI is 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.

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.

getFixupURIInfo()

Same as createFixupURI, but returns information about what it corrected (e.g. whether we could rescue the URI or "just" generated a keyword search URI instead).

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 information as an nsIURIFixupInfo

See also