Interface imgIRequestType

imgIRequest interface

Author

Stuart Parmenter stuart@mozilla.com

Version

0.1

See

imagelib2

Hierarchy

Properties

CORSMode: number

The CORS mode that this image was loaded with (a mozilla::CORSMode).

URI: nsIURI

The URI the image load was started with. Note that this might not be the actual URI for the image (e.g. if HTTP redirects happened during the load).

canceledReason: string
fileName: string

The filename that should be used when saving the image. This is determined from the Content-Disposition, if present, or the uri of the image. This filename should be validated using nsIMIMEService::GetValidFilenameForSaving before creating the file.

finalURI: nsIURI

The URI of the resource we ended up loading after all redirects, etc.

hadCrossOriginRedirects: bool

true if the loading of the image required cross-origin redirects.

image: imgIContainer

the image container...

Returns

the image object associated with the request.

Attention

NEED DOCS

imageErrorCode: number

Actual error code that generated a STATUS_ERROR imageStatus (see xpcom/base/ErrorList.h)

imagePrincipal: nsIPrincipal

The principal gotten from the channel the image was loaded from.

imageStatus: number

Status flags of the STATUS_* variety.

loadFlags: nsLoadFlags

The load flags of this request. Bits 0-15 are reserved.

When added to a load group, this request's load flags are merged with the load flags of the load group.

loadGroup: nsILoadGroup

The load group of this request. While pending, the request is a member of the load group. It is the responsibility of the request to implement this policy.

mimeType: string
multipart: bool

Whether the request is multipart (ie, multipart/x-mixed-replace)

name: string

The name of the request. Often this is the URI of the request.

notificationObserver: imgINotificationObserver
providerId: number

Provider ID for image providers created by this image.

referrerInfo: nsIReferrerInfo

The referrer that this image was loaded with.

status: number

The error status associated with the request.

triggeringPrincipal: nsIPrincipal

The principal for the document that loaded this image. Used when trying to validate a CORS image load.

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

  • Parameters

    • aCategory: uint32_t

    Returns void

  • Cancels the current request. This will close any open input or output streams and terminate any async requests. Users should normally pass NS_BINDING_ABORTED, although other errors may also be passed. The error passed in will become the value of the status attribute.

    Implementations must not send any notifications (e.g. via nsIRequestObserver) synchronously from this function. Similarly, removal from the load group (if any) must also happen asynchronously.

    Requests that use nsIStreamListener must not call onDataAvailable anymore after cancel has been called.

    Parameters

    • aStatus: number

      the reason for canceling this request.

      NOTE: most nsIRequest implementations expect aStatus to be a failure code; however, some implementations may allow aStatus to be a success code such as NS_OK. In general, aStatus should be a failure code.

    Returns void

  • Cancels this request as in nsIRequest::Cancel(); further, also nulls out decoderObserver so it gets no further notifications from us.

    NOTE: You should not use this in any new code; instead, use cancel(). Note that cancel() is asynchronous, which means that some time after you call it, the listener/observer will get an OnStopRequest(). This means that, if you're the observer, you can't call cancel() from your destructor.

    Parameters

    • aStatus: number

    Returns void

  • Parameters

    • aStatus: number
    • aReason: string

    Returns void

  • Clone this request; the returned request will have aObserver as the observer. aObserver will be notified synchronously (before the clone() call returns) with all the notifications that have already been dispatched for this image load.

    Parameters

    • aObserver: imgINotificationObserver

    Returns imgIRequest

  • Tell the image it can forget about a request that the image animate.

    See

    Image::DecrementAnimationConsumers for documentation of the underlying call.

    Returns void

  • If this request is for an animated image, the method creates a new request which contains the current frame of the image. Otherwise returns the same request.

    Returns imgIRequest

  • These methods encode/decode the TRR mode to/from the loadFlags. Helper methods Get/SetTRRModeImpl are provided so implementations don't need to duplicate code.

    Requests with TRR_DEFAULT_MODE will use the mode indicated by the pref

    • see network.trr.mode in all.js Requests with TRR_DISABLED_MODE will always use native DNS, even if the pref is set to mode3 (TRR-only). Requests with TRR_FIRST_MODE will first use TRR then fallback to regular DNS, unless TRR is disabled by setting the pref to mode5, parental control being enabled, or the domain being in the exclusion list. Requests with TRR_ONLY_MODE will only use TRR, unless not allowed by the same conditions mentioned above.

    Returns nsIRequest_TRRMode

  • %{C++ DecodeResult RequestDecodeWithResult(uint32_t aFlags); %}

    Returns true if there is a image and the image has a frame and the frame currently has a least 1 decoded pixel. Only valid for raster images.

    Returns boolean

  • Requests that the image animate (if it has an animation).

    See

    Image::IncrementAnimationConsumers for documentation of the underlying call.

    Returns void

  • Indicates whether the request is pending. nsIRequest::isPending is true when there is an outstanding asynchronous event that will make the request no longer be pending. Requests do not necessarily start out pending; in some cases, requests have to be explicitly initiated (e.g. nsIChannel implementations are only pending once asyncOpen returns successfully).

    Requests can become pending multiple times during their lifetime.

    Returns

    TRUE if the request has yet to reach completion.

    Returns

    FALSE if the request has reached completion (e.g., after OnStopRequest has fired).

    Note

    Suspended requests are still considered pending.

    Returns boolean

  • Locks an image. If the image does not exist yet, locks it once it becomes available. The lock persists for the lifetime of the imgIRequest (until unlockImage is called) even if the underlying image changes.

    If you don't call unlockImage() by the time this imgIRequest goes away, it will be called for you automatically.

    See

    imgIContainer::lockImage for documentation of the underlying call.

    Returns void

  • This method triggers decoding for an image, but unlike startDecoding() it enables the caller to provide more detailed information about the decode request.

    Returns

    DECODE_SURFACE_AVAILABLE if is a surface that satisfies the request and it is fully decoded. DECODE_REQUESTED if we requested a decode. DECODE_REQUEST_FAILED if we failed to request a decode. This means that either there is an error in the image or we cannot allocate a surface that big.

    Parameters

    • aFlags: uint32_t

      Flags of the FLAG_* variety.

    Returns imgIContainer_DecodeResult

  • If this image is unlocked, discard the image's decoded data. If the image is locked or is already discarded, do nothing.

    Returns void

  • Resumes the current request. This may have the effect of re-opening any underlying transport and will resume the delivery of data to any open streams.

    Returns void

  • Parameters

    • mode: nsIRequest_TRRMode

    Returns void

  • Requests a synchronous decode for the image.

    imgIContainer has a startDecoding() method, but callers may want to request a decode before the container has necessarily been instantiated. Calling startDecoding() on the imgIRequest simply forwards along the request if the container already exists, or calls it once the container becomes available if it does not yet exist.

    Parameters

    • aFlags: uint32_t

    Returns void

  • Exactly like startDecoding above except returns whether the current frame of the image is complete or not.

    Parameters

    • aFlags: uint32_t

      Flags of the FLAG_* variety. Only FLAG_ASYNC_NOTIFY is accepted; all others are ignored.

    Returns boolean

  • Suspends the current request. This may have the effect of closing any underlying transport (in order to free up resources), although any open streams remain logically opened and will continue delivering data when the transport is resumed.

    Calling cancel() on a suspended request must not send any notifications (such as onstopRequest) until the request is resumed.

    NOTE: some implementations are unable to immediately suspend, and may continue to deliver events already posted to an event queue. In general, callers should be capable of handling events even after suspending a request.

    Returns void

  • Unlocks an image.

    See

    imgIContainer::unlockImage for documentation of the underlying call.

    Returns void

Generated using TypeDoc