Interface nsIIOServiceType

nsIIOService provides a set of network utility functions. This interface duplicates many of the nsIProtocolHandler methods in a protocol handler independent way (e.g., NewURI inspects the scheme in order to delegate creation of the new URI to the appropriate protocol handler). nsIIOService also provides a set of URL parsing utility functions. These are provided as a convenience to the programmer and in some cases to improve performance by eliminating intermediate data structures and interfaces.

Hierarchy

Properties

connectivity: boolean

Returns false if there are no interfaces for a network request

manageOfflineStatus: boolean

While this is set, IOService will monitor an nsINetworkLinkService (if available) and set its offline status to "true" whenever isLinkUp is false.

Applications that want to control changes to the IOService's offline status should set this to false, watch for network:link-status-changed broadcasts, and change nsIIOService::offline as they see fit. Note that this means during application startup, IOService may be offline if there is no link, until application code runs and can turn off this management.

offline: boolean

Returns true if networking is in "offline" mode. When in offline mode, attempts to access the network will fail (although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up).

Changing this fires observer notifications ... see below.

socketProcessId: number

The pid for socket process.

socketProcessLaunched: boolean

Return true if socket process is launched.

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

    • aURI: nsIURI
    • aLoadingNode: Node
    • aLoadingPrincipal: nsIPrincipal
    • aTriggeringPrincipal: nsIPrincipal
    • aLoadingClientInfo: const_MaybeClientInfoRef
    • aController: const_MaybeServiceWorkerDescriptorRef
    • aSecurityFlags: number
    • aContentPolicyType: nsContentPolicyType
    • aSandboxFlags: number
    • aSkipCheckForBrokenURLOrZeroSized: boolean
    • aResult: nsIChannel

    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

  • Checks if a port number is banned. This involves consulting a list of unsafe ports, corresponding to network services that may be easily exploitable. If the given port is considered unsafe, then the protocol handler (corresponding to aScheme) will be asked whether it wishes to override the IO service's decision to block the port. This gives the protocol handler ultimate control over its own security policy while ensuring reasonable, default protection.

    See

    nsIProtocolHandler::allowPort

    Parameters

    • aPort: number
    • aScheme: string

    Returns boolean

  • Converts an internal URI (e.g. one that has a username and password in it) into one which we can expose to the user, for example on the URL bar.

    Returns

    nsIURI The converted, exposable URI.

    Parameters

    • aURI: nsIURI

      The URI to be converted.

    Returns nsIURI

  • Utility to extract the scheme from a URL string, consistently and according to spec (see RFC 2396).

    NOTE: Most URL parsing is done via nsIURI, and in fact the scheme can also be extracted from a URL string via nsIURI. This method is provided purely as an optimization.

    Returns

    URL scheme, lowercase

    Throws

    NS_ERROR_MALFORMED_URI if URL string is not of the right form.

    Parameters

    • urlString: string

    Returns string

  • Returns the default port for a given scheme.

    Returns

    default port for the corresponding protocol

    Parameters

    • aScheme: string

      the URI scheme

    Returns number

  • Returns the dynamic protocol flags for a given URI.

    Returns

    protocol flags for that URI

    Parameters

    • aURI: nsIURI

      the URI to get all dynamic flags for

    Returns number

  • Returns the protocol flags for a given scheme.

    Returns

    protocol flags for the corresponding protocol

    Parameters

    • aScheme: string

      the URI scheme

    Returns number

  • Returns a protocol handler for a given URI scheme.

    Returns

    reference to corresponding nsIProtocolHandler

    Parameters

    • aScheme: string

      the URI scheme

    Returns nsIProtocolHandler

  • Checks if a URI host is a local IPv4 or IPv6 address literal.

    Returns

    true if the URI hostname is a local IP address

    Parameters

    • aURI: nsIURI

    Returns boolean

  • Checks if a URI host is a shared IPv4 address literal.

    Returns

    true if the URI hostname is a shared IP address

    Parameters

    • aURI: nsIURI

    Returns boolean

  • Equivalent to newChannelFromURI(newURI(...))

    Parameters

    • aSpec: string
    • aOriginCharset: string
    • aBaseURI: nsIURI
    • aLoadingNode: Node
    • aLoadingPrincipal: nsIPrincipal
    • aTriggeringPrincipal: nsIPrincipal
    • aSecurityFlags: number
    • aContentPolicyType: nsContentPolicyType

    Returns nsIChannel

  • Creates a channel for a given URI.

    Returns

    reference to the new nsIChannel object

    Please note, if you provide both a loadingNode and a loadingPrincipal, then loadingPrincipal must be equal to loadingNode->NodePrincipal(). But less error prone is to just supply a loadingNode.

    Keep in mind that URIs coming from a webpage should never use the systemPrincipal as the loadingPrincipal.

    Parameters

    • aURI: nsIURI

      nsIURI from which to make a channel

    • aLoadingNode: Node
    • aLoadingPrincipal: nsIPrincipal
    • aTriggeringPrincipal: nsIPrincipal
    • aSecurityFlags: number
    • aContentPolicyType: nsContentPolicyType

      These will be used as values for the nsILoadInfo object on the created channel. For details, see nsILoadInfo in nsILoadInfo.idl

    Returns nsIChannel

  • Equivalent to newChannelFromURI(aURI, aLoadingNode, ...)

    Parameters

    • aURI: nsIURI
    • aLoadInfo: nsILoadInfo

    Returns nsIChannel

  • Creates a channel for a given URI.

    Returns

    reference to the new nsIChannel object

    Please note, if you provide both a loadingNode and a loadingPrincipal, then loadingPrincipal must be equal to loadingNode->NodePrincipal(). But less error prone is to just supply a loadingNode.

    Parameters

    • aURI: nsIURI

      nsIURI from which to make a channel

    • aProxyURI: nsIURI

      nsIURI to use for proxy resolution. Can be null in which case aURI is used

    • aProxyFlags: number

      flags from nsIProtocolProxyService to use when resolving proxies for this new channel

    • aLoadingNode: Node
    • aLoadingPrincipal: nsIPrincipal
    • aTriggeringPrincipal: nsIPrincipal
    • aSecurityFlags: number
    • aContentPolicyType: nsContentPolicyType

      These will be used as values for the nsILoadInfo object on the created channel. For details, see nsILoadInfo in nsILoadInfo.idl

    Returns nsIChannel

  • This method constructs a new URI from a nsIFile.

    Returns

    reference to a new nsIURI object

    Note: in the future, for perf reasons we should allow callers to specify whether this is a file or directory by splitting this into newDirURI() and newActualFileURI().

    Parameters

    • aFile: nsIFile

      specifies the file path

    Returns nsIURI

  • This method constructs a new URI based on the scheme of the URI spec. QueryInterface can be used on the resulting URI object to obtain a more specific type of URI.

    Parameters

    • aSpec: string
    • aOriginCharset: string
    • aBaseURI: nsIURI

    Returns nsIURI

  • Creates a WebTransport.

    Returns nsIWebTransport

  • Register a protocol handler at runtime, given protocol flags and a default port.

    Statically registered protocol handlers cannot be overridden, and an error will be returned if that is attempted.

    Runtime registered protocol handlers are never QueryInterface-ed into nsIProtocolHandlerWithDynamicFlags, so that interface will be ignored.

    Parameters

    • aScheme: string

      the scheme handled by the protocol handler.

    • aHandler: nsIProtocolHandler

      the protocol handler instance.

    • aProtocolFlags: number

      protocol flags for this protocol, see nsIProtocolHandler for values.

    • aDefaultPort: number

      default port for this scheme, or -1.

    Returns void

  • Unregister a protocol handler which was previously registered using registerProtocolHandler.

    Parameters

    • aScheme: string

      the scheme to unregister a handler for.

    Returns void

Generated using TypeDoc