You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

Necko Interfaces: an Overview
Darin Fisher <darin at meer dot net>
December 10, 2001

  • 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
  • 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
  • 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