Necko Interfaces Overview

by 2 contributors:

Warning: The content of this article may be out of date. It was last updated in 2001.

nsIIOService

  • central necko service
  • manages protocol handlers
  • thin layer over protocol handlers
  • provides interface for creating URI objects from URI strings
  • maps URI scheme to appropriate nsIProtocolHandler impl

nsIURI (nsIURL, nsIFileURL, nsIStandardURL)

  • represents an URI, with getters and setters for various URI parts (eg. scheme, host, path, ...)
  • per protocol implementation
  • necko provides URI impl's for common URI formats (see nsStandardURL, nsSimpleURI)

nsIChannel : nsIRequest

  • represents a logical connection to the resource identified by a nsIURI
  • per protocol implementation
  • single use (ie. channel is used to download the resource once)
  • download initiated via nsIChannel::AsyncOpen method
  • can be canceled via nsIRequest::Cancel method at anytime after invocation of AsyncOpen method

nsIProtocolHandler

  • a service that manages a protocol, identified by it's URI scheme (eg. http)
  • maps URI string to nsIURI instance via NewURI method
  • creates nsIChannel instance from nsIURI instance via NewChannel method

nsIStreamListener : nsIRequestObserver

  • implemented by the consumer of a nsIChannel instance
  • passed to nsIChannel::AsyncOpen method
  • nsIRequestObserver::OnStartRequest - notifies start of async download
  • nsIStreamListener::OnDataAvailable - notifies presence of downloaded data
  • nsIRequestObserver::OnStopRequest - notifies completion of async download, possibly w/ error

nsILoadGroup : nsIRequest

  • attribute of a nsIRequest
  • channel impl adds itself to its load group during invocation of AsyncOpen
  • channel impl removes itself from its load group when download completes
  • load groups in gecko own all channels used to load a particular page (until the channels complete)
  • all channels owned by a load group can be canceled at once via the load group's nsIRequest::Cancel method

nsITransport

  • represents a physical connection, such as a file descriptor or a socket
  • used directly by protocol handler implementations (as well as by mailnews and chatzilla)
  • synchronous I/O methods: OpenInputStream, OpenOutputStream
  • asynchronous I/O methods: AsyncRead, AsyncWrite
  • nsITransport::AsyncRead takes a nsIStreamListener parameter


Original Document Information

  • Author(s): Darin Fisher
  • Last Updated Date: December 10, 2001
  • Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details.

Document Tags and Contributors

Contributors to this page: teoli, kohei.yoshino
Last updated by: kohei.yoshino,