Interface nsIMIMEInfoType

nsIMIMEInfo extends nsIHandlerInfo with a bunch of information specific to MIME content-types. There is a one-to-many relationship between MIME types and file extensions. This means that a MIMEInfo object may have multiple file extensions associated with it. However, the reverse is not true.

MIMEInfo objects are generally retrieved from the MIME Service

See

nsIMIMEService

Hierarchy

Properties

MIMEType: string

The MIME type of this MIMEInfo.

Returns

String representing the MIME type.

Deprecated

use nsIHandlerInfo::type instead.

alwaysAskBeforeHandling: boolean

alwaysAskBeforeHandling: if true, we should always give the user a dialog asking how to dispose of this content.

defaultDescription: string

A pretty name description of the associated default application. Only usable if hasDefaultHandler is true.

description: string

A human readable description of the handler type

hasDefaultHandler: boolean

Indicates whether a default application handler exists, i.e. whether launchWithFile with action = useSystemDefault is possible and defaultDescription will contain usable information.

possibleApplicationHandlers: nsIMutableArray

Applications that can handle this content type.

The list will include the preferred handler, if any. Elements of this array are nsIHandlerApp objects, and this attribute will always reference an array, whether or not there are any possible handlers. If there are no possible handlers, the array will contain no elements, so just check its length (nsIArray::length) to see if there are any possible handlers.

possibleLocalHandlers: nsIArray

Returns a list of nsILocalHandlerApp objects containing handlers associated with this mimeinfo. Implemented per platform using information in this object to generate the best list. Typically used for an "open with" style user option.

Returns

nsIArray of nsILocalHandlerApp

preferredAction: nsHandlerInfoAction

preferredAction is how the user specified they would like to handle this content type: save to disk, use specified helper app, use OS default handler or handle using navigator; possible value constants listed below

preferredApplicationHandler: nsIHandlerApp

The application the user has said they want associated with this content type. This is not always guaranteed to be set!!

primaryExtension: string

Returns the first extension association in the internal set of extensions.

Returns

The first extension.

type: string

The type of this handler info. For MIME handlers, this is the MIME type. For protocol handlers, it's the scheme.

Returns

String representing the type.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Append a given extension to the set of extensions

    Parameters

    • aExtension: string

    Returns void

  • Returns whether or not these two nsIMIMEInfos are logically equivalent.

    Returns

    PR_TRUE if the two are considered equal

    Parameters

    • aMIMEInfo: nsIMIMEInfo

    Returns boolean

  • Returns whether or not the given extension is associated with this MIME info.

    Returns

    TRUE if the association exists.

    Parameters

    • aExtension: string

    Returns boolean

  • Gives you an array of file types associated with this type.

    Returns

    Number of elements in the array.

    Returns

    Array of extensions.

    Returns nsIUTF8StringEnumerator

  • Check if we ourselves are registered as the OS default for this type.

    Returns boolean

  • Launches the application with the specified file, in a way that depends on the value of preferredAction. preferredAction must be useHelperApp or useSystemDefault.

    Throw

    NS_ERROR_INVALID_ARG if action is not valid for this function. Other exceptions may be thrown.

    Parameters

    • aFile: nsIFile

      The file to launch this application with.

    Returns void

  • Launches the application with the specified URI, in a way that depends on the value of preferredAction. preferredAction must be useHelperApp or useSystemDefault.

    Note

    Only the URI scheme is used to determine how to launch. This is essentially a pass-by-value operation. This means that in the case of a file: URI, the handler that is registered for file: will be launched and our code will not make any decision based on the content-type or extension, though the invoked file: handler is free to do so.

    Throw

    NS_ERROR_INVALID_ARG if preferredAction is not valid for this call. Other exceptions may be thrown.

    Parameters

    • aURI: nsIURI

      The URI to launch this application with

    • aBrowsingContext: BrowsingContext

      The window to parent the dialog against, and, if a web handler is chosen, it is loaded in this window as well. See nsIHandlerApp.launchWithURI for more details.

    Returns void

  • Set File Extensions. Input is a comma delimited list of extensions.

    Parameters

    • aExtensions: string

    Returns void

Generated using TypeDoc