Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Please add a summary to this article.
Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

Implemented by @mozilla.org/image/loader;1 as a service:

var imgILoader = Components.classes["@mozilla.org/image/loader;1"]
                 .getService(Components.interfaces.imgILoader);

Method overview

imgIRequest loadImage(in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest, in nsIChannelPolicy channelPolicy);
imgIRequest loadImageWithChannel(in nsIChannel aChannel, in imgIDecoderObserver aObserver, in nsISupports cx, out nsIStreamListener aListener);
boolean supportImageWithMimeType(in string mimeType);

Constants

Constant Value Description
LOAD_CORS_ANONYMOUS 1 << 16
LOAD_CORS_USE_CREDENTIALS 1 << 17

Methods

loadImage()

Start the load and decode of an image.

imgIRequest loadImage(
  in nsIURI aURI,
  in nsIURI aInitialDocumentURL,
  in nsIURI aReferrerURI,
  in nsIPrincipal aLoadingPrincipal,
  in nsILoadGroup aLoadGroup,
  in imgIDecoderObserver aObserver,
  in nsISupports aCX,
  in nsLoadFlags aLoadFlags,
  in nsISupports cacheKey,
  in imgIRequest aRequest,
  in nsIChannelPolicy channelPolicy
);
Parameters
aURI
The URI to load.
aInitialDocumentURL
aReferrerURI
The 'referring' URI.
aLoadingPrincipal
The principal of the loading document.
aLoadGroup
Loadgroup to put the image load into.
aObserver
The observer (may be null)
aCX
Some random data.
aLoadFlags
Load flags for the request.
cacheKey
aRequest
A newly created, unused imgIRequest object or null for one to be created for you. libpr0n does NOT keep a strong ref to the observer; this prevents reference cycles. This means that callers of loadImage should make sure to Cancel() the resulting request before the observer goes away.
channelPolicy
Return value

loadImageWithChannel()

Start the load and decode of an image.

libpr0n does NOT keep a strong ref to the observer; this prevents reference cycles. This means that callers of loadImageWithChannel should make sure to Cancel() the resulting request before the observer goes away.

imgIRequest loadImageWithChannel(
  in nsIChannel aChannel,
  in imgIDecoderObserver aObserver,
  in nsISupports cx,
  out nsIStreamListener aListener
);
Parameters
aChannel
The channel to load the image from. This must already be opened before this method is called, and there must have been no OnDataAvailable calls for it yet.
aObserver
The observer (may be null)
cx
Some random data.
aListener
A listener that you must send the channel's notifications and data to. Can be null, in which case imagelib has found a cached image and is not interested in the data. aChannel will be canceled for you in this case.
Return value

 

supportImageWithMimeType()

Checks if a decoder for the an image with the given mime type is available.

boolean supportImageWithMimeType(
  in string mimeType
);
Parameters
mimeType
The type to find a decoder for.
Return value

true if a decoder is available, false otherwise.

Document Tags and Contributors

 Contributors to this page: Sheppy, trevorh, PWeilbacher, Nickolay, Nsertzen, Georgmaass
 Last updated by: Sheppy,