Interface nsIRaceCacheWithNetworkType

This holds methods used to race the cache with the network for a specific channel. This interface is was designed with nsHttpChannel in mind, and it's expected this will be the only class implementing it.

Hierarchy

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

  • Normally a HTTP channel would immediately call AsyncOpenURI leading to the cache storage to lookup the cache entry and return it. In order to simmulate real life conditions where fetching a cache entry takes a long time, we set a timer to delay the operation. Can only be called on the main thread.

    Parameters

    • timeout: number

      the delay in milliseconds until the cache open will be triggered.

    Returns void

  • Immediatelly triggers AsyncOpenURI if the timer hasn't fired. Can only be called on the main thread. This is only called in tests to reliably trigger the opening of the cache entry.

    Throws

    NS_ERROR_NOT_AVAILABLE if opening the cache wasn't delayed.

    Returns void


  • TEST ONLY: The following methods are for testing purposes only. Do not use them to do anything important in your code.


    Triggers network activity after given timeout. If timeout is 0, network activity is triggered immediately if asyncOpen has already been called. Otherwise the delayed timer will be set when the normal call to TriggerNetwork is made. If the cache.asyncOpenURI callbacks have already been called, the network activity may have already been triggered or the content may have already been delivered from the cache, so this operation will have no effect.

    Parameters

    • timeout: number

      the delay in milliseconds until the network will be triggered.

    Returns void

Generated using TypeDoc