Struct xpcom::interfaces::nsICachingChannel
[−]
[src]
#[repr(C)]pub struct nsICachingChannel { /* fields omitted */ }
interface nsICachingChannel : nsICacheInfoChannel
/**
* A channel may optionally implement this interface to allow clients
* to affect its behavior with respect to how it uses the cache service.
*
* This interface provides:
* 1) Support for "stream as file" semantics (for JAR and plugins).
* 2) Support for "pinning" cached data in the cache (for printing and save-as).
* 3) Support for uniquely identifying cached data in cases when the URL
* is insufficient (e.g., HTTP form submission).
*/
Methods
impl nsICachingChannel
[src]
pub fn coerce<T: nsICachingChannelCoerce>(&self) -> &T
[src]
Cast this nsICachingChannel
to one of its base interfaces.
impl nsICachingChannel
[src]
pub const LOAD_NO_NETWORK_IO: i64
LOAD_NO_NETWORK_IO: i64 = 67108864
/**************************************************************************
* Caching channel specific load flags:
*/
/**
* This load flag inhibits fetching from the net. An error of
* NS_ERROR_DOCUMENT_NOT_CACHED will be sent to the listener's
* onStopRequest if network IO is necessary to complete the request.
*
* This flag can be used to find out whether fetching this URL would
* cause validation of the cache entry via the network.
*
* Combining this flag with LOAD_BYPASS_LOCAL_CACHE will cause all
* loads to fail. This flag differs from LOAD_ONLY_FROM_CACHE in that
* this flag fails the load if validation is required while
* LOAD_ONLY_FROM_CACHE skips validation where possible.
*/
pub const LOAD_CHECK_OFFLINE_CACHE: i64
LOAD_CHECK_OFFLINE_CACHE: i64 = 134217728
/**
* This load flag causes the offline cache to be checked when fetching
* a request. It will be set automatically if the browser is offline.
*
* This flag will not be transferred through a redirect.
*/
pub const LOAD_BYPASS_LOCAL_CACHE: i64
LOAD_BYPASS_LOCAL_CACHE: i64 = 268435456
/**
* This load flag causes the local cache to be skipped when fetching a
* request. Unlike LOAD_BYPASS_CACHE, it does not force an end-to-end load
* (i.e., it does not affect proxy caches).
*/
pub const LOAD_BYPASS_LOCAL_CACHE_IF_BUSY: i64
LOAD_BYPASS_LOCAL_CACHE_IF_BUSY: i64 = 536870912
/**
* This load flag causes the local cache to be skipped if the request
* would otherwise block waiting to access the cache.
*/
pub const LOAD_ONLY_FROM_CACHE: i64
LOAD_ONLY_FROM_CACHE: i64 = 1073741824
/**
* This load flag inhibits fetching from the net if the data in the cache
* has been evicted. An error of NS_ERROR_DOCUMENT_NOT_CACHED will be sent
* to the listener's onStopRequest in this case. This flag is set
* automatically when the application is offline.
*/
pub const LOAD_ONLY_IF_MODIFIED: i64
LOAD_ONLY_IF_MODIFIED: i64 = 2147483648
/**
* This load flag controls what happens when a document would be loaded
* from the cache to satisfy a call to AsyncOpen. If this attribute is
* set to TRUE, then the document will not be loaded from the cache. A
* stream listener can check nsICachingChannel::isFromCache to determine
* if the AsyncOpen will actually result in data being streamed.
*
* If this flag has been set, and the request can be satisfied via the
* cache, then the OnDataAvailable events will be skipped. The listener
* will only see OnStartRequest followed by OnStopRequest.
*/
pub unsafe fn GetCacheToken(
&self,
aCacheToken: *mut *const nsISupports
) -> nsresult
[src]
&self,
aCacheToken: *mut *const nsISupports
) -> nsresult
/**
* Set/get the cache token... uniquely identifies the data in the cache.
* Holding a reference to this token prevents the cached data from being
* removed.
*
* A cache token retrieved from a particular instance of nsICachingChannel
* could be set on another instance of nsICachingChannel provided the
* underlying implementations are compatible. The implementation of
* nsICachingChannel would be expected to only read from the cache entry
* identified by the cache token and not try to validate it.
*
* The cache token can be QI'd to a nsICacheEntryInfo if more detail
* about the cache entry is needed (e.g., expiration time).
*/
attribute nsISupports cacheToken;
pub unsafe fn SetCacheToken(&self, aCacheToken: *const nsISupports) -> nsresult
[src]
/**
* Set/get the cache token... uniquely identifies the data in the cache.
* Holding a reference to this token prevents the cached data from being
* removed.
*
* A cache token retrieved from a particular instance of nsICachingChannel
* could be set on another instance of nsICachingChannel provided the
* underlying implementations are compatible. The implementation of
* nsICachingChannel would be expected to only read from the cache entry
* identified by the cache token and not try to validate it.
*
* The cache token can be QI'd to a nsICacheEntryInfo if more detail
* about the cache entry is needed (e.g., expiration time).
*/
attribute nsISupports cacheToken;
pub unsafe fn GetOfflineCacheToken(
&self,
aOfflineCacheToken: *mut *const nsISupports
) -> nsresult
[src]
&self,
aOfflineCacheToken: *mut *const nsISupports
) -> nsresult
/**
* The same as above but accessing the offline app cache token if there
* is any.
*
* @throws
* NS_ERROR_NOT_AVAILABLE when there is not offline cache token
*/
attribute nsISupports offlineCacheToken;
pub unsafe fn SetOfflineCacheToken(
&self,
aOfflineCacheToken: *const nsISupports
) -> nsresult
[src]
&self,
aOfflineCacheToken: *const nsISupports
) -> nsresult
/**
* The same as above but accessing the offline app cache token if there
* is any.
*
* @throws
* NS_ERROR_NOT_AVAILABLE when there is not offline cache token
*/
attribute nsISupports offlineCacheToken;
pub unsafe fn GetCacheOnlyMetadata(
&self,
aCacheOnlyMetadata: *mut bool
) -> nsresult
[src]
&self,
aCacheOnlyMetadata: *mut bool
) -> nsresult
/**
* Instructs the channel to only store the metadata of the entry, and not
* the content. When reading an existing entry, this automatically sets
* LOAD_ONLY_IF_MODIFIED flag.
* Must be called before asyncOpen().
*/
attribute boolean cacheOnlyMetadata;
pub unsafe fn SetCacheOnlyMetadata(&self, aCacheOnlyMetadata: bool) -> nsresult
[src]
/**
* Instructs the channel to only store the metadata of the entry, and not
* the content. When reading an existing entry, this automatically sets
* LOAD_ONLY_IF_MODIFIED flag.
* Must be called before asyncOpen().
*/
attribute boolean cacheOnlyMetadata;
pub unsafe fn GetPin(&self, aPin: *mut bool) -> nsresult
[src]
/**
* Tells the channel to use the pinning storage.
*/
attribute boolean pin;
pub unsafe fn SetPin(&self, aPin: bool) -> nsresult
[src]
/**
* Tells the channel to use the pinning storage.
*/
attribute boolean pin;
pub unsafe fn ForceCacheEntryValidFor(
&self,
aSecondsToTheFuture: uint32_t
) -> nsresult
[src]
&self,
aSecondsToTheFuture: uint32_t
) -> nsresult
/**
* Overrides cache validation for a time specified in seconds.
*
* @param aSecondsToTheFuture
*
*/
void forceCacheEntryValidFor (in unsigned long aSecondsToTheFuture);
Methods from Deref<Target = nsICacheInfoChannel>
pub fn coerce<T: nsICacheInfoChannelCoerce>(&self) -> &T
[src]
Cast this nsICacheInfoChannel
to one of its base interfaces.
pub unsafe fn GetCacheTokenFetchCount(
&self,
aCacheTokenFetchCount: *mut int32_t
) -> nsresult
[src]
&self,
aCacheTokenFetchCount: *mut int32_t
) -> nsresult
/**
* Get the number of times the cache entry has been opened. This attribute is
* equivalent to nsICachingChannel.cacheToken.fetchCount.
*
* @throws NS_ERROR_NOT_AVAILABLE if the cache entry or the alternate data
* cache entry cannot be read.
*/
readonly attribute int32_t cacheTokenFetchCount;
pub unsafe fn GetCacheTokenExpirationTime(
&self,
aCacheTokenExpirationTime: *mut uint32_t
) -> nsresult
[src]
&self,
aCacheTokenExpirationTime: *mut uint32_t
) -> nsresult
/**
* Get expiration time from cache token. This attribute is equivalent to
* nsICachingChannel.cacheToken.expirationTime.
*/
readonly attribute uint32_t cacheTokenExpirationTime;
pub unsafe fn GetCacheTokenCachedCharset(
&self,
aCacheTokenCachedCharset: &mut nsACString
) -> nsresult
[src]
&self,
aCacheTokenCachedCharset: &mut nsACString
) -> nsresult
/**
* Set/get charset of cache entry. Accessing this attribute is equivalent to
* calling nsICachingChannel.cacheToken.getMetaDataElement("charset") and
* nsICachingChannel.cacheToken.setMetaDataElement("charset").
*/
attribute ACString cacheTokenCachedCharset;
pub unsafe fn SetCacheTokenCachedCharset(
&self,
aCacheTokenCachedCharset: &nsACString
) -> nsresult
[src]
&self,
aCacheTokenCachedCharset: &nsACString
) -> nsresult
/**
* Set/get charset of cache entry. Accessing this attribute is equivalent to
* calling nsICachingChannel.cacheToken.getMetaDataElement("charset") and
* nsICachingChannel.cacheToken.setMetaDataElement("charset").
*/
attribute ACString cacheTokenCachedCharset;
pub unsafe fn IsFromCache(&self, _retval: *mut bool) -> nsresult
[src]
/**
* TRUE if this channel's data is being loaded from the cache. This value
* is undefined before the channel fires its OnStartRequest notification
* and after the channel fires its OnStopRequest notification.
*/
boolean isFromCache ();
pub unsafe fn GetCacheEntryId(&self, _retval: *mut uint64_t) -> nsresult
[src]
/**
* The unique ID of the corresponding nsICacheEntry from which the response is
* retrieved. By comparing the returned value, we can judge whether the data
* of two distinct nsICacheInfoChannels is from the same nsICacheEntry. This
* scenario could be useful when verifying whether the alternative data from
* one nsICacheInfochannel matches the main data from another one.
*
* Note: NS_ERROR_NOT_AVAILABLE is thrown when a nsICacheInfoChannel has no
* valid corresponding nsICacheEntry.
*/
uint64_t getCacheEntryId ();
pub unsafe fn GetCacheKey(&self, aCacheKey: *mut *const nsISupports) -> nsresult
[src]
/**
* Set/get the cache key... uniquely identifies the data in the cache
* for this channel. Holding a reference to this key does NOT prevent
* the cached data from being removed.
*
* A cache key retrieved from a particular instance of nsICacheInfoChannel
* could be set on another instance of nsICacheInfoChannel provided the
* underlying implementations are compatible and provided the new
* channel instance was created with the same URI. The implementation of
* nsICacheInfoChannel would be expected to use the cache entry identified
* by the cache token. Depending on the value of nsIRequest::loadFlags,
* the cache entry may be validated, overwritten, or simply read.
*
* The cache key may be NULL indicating that the URI of the channel is
* sufficient to locate the same cache entry. Setting a NULL cache key
* is likewise valid.
*/
attribute nsISupports cacheKey;
pub unsafe fn SetCacheKey(&self, aCacheKey: *const nsISupports) -> nsresult
[src]
/**
* Set/get the cache key... uniquely identifies the data in the cache
* for this channel. Holding a reference to this key does NOT prevent
* the cached data from being removed.
*
* A cache key retrieved from a particular instance of nsICacheInfoChannel
* could be set on another instance of nsICacheInfoChannel provided the
* underlying implementations are compatible and provided the new
* channel instance was created with the same URI. The implementation of
* nsICacheInfoChannel would be expected to use the cache entry identified
* by the cache token. Depending on the value of nsIRequest::loadFlags,
* the cache entry may be validated, overwritten, or simply read.
*
* The cache key may be NULL indicating that the URI of the channel is
* sufficient to locate the same cache entry. Setting a NULL cache key
* is likewise valid.
*/
attribute nsISupports cacheKey;
pub unsafe fn GetAllowStaleCacheContent(
&self,
aAllowStaleCacheContent: *mut bool
) -> nsresult
[src]
&self,
aAllowStaleCacheContent: *mut bool
) -> nsresult
/**
* Tells the channel to behave as if the LOAD_FROM_CACHE flag has been set,
* but without affecting the loads for the entire loadGroup in case of this
* channel being the default load group's channel.
*/
attribute boolean allowStaleCacheContent;
pub unsafe fn SetAllowStaleCacheContent(
&self,
aAllowStaleCacheContent: bool
) -> nsresult
[src]
&self,
aAllowStaleCacheContent: bool
) -> nsresult
/**
* Tells the channel to behave as if the LOAD_FROM_CACHE flag has been set,
* but without affecting the loads for the entire loadGroup in case of this
* channel being the default load group's channel.
*/
attribute boolean allowStaleCacheContent;
pub unsafe fn PreferAlternativeDataType(&self, type_: &nsACString) -> nsresult
[src]
/**
* Calling this method instructs the channel to serve the alternative data
* if that was previously saved in the cache, otherwise it will serve the
* real data.
* Must be called before AsyncOpen.
*/
void preferAlternativeDataType (in ACString type);
pub unsafe fn GetPreferredAlternativeDataType(
&self,
aPreferredAlternativeDataType: &mut nsACString
) -> nsresult
[src]
&self,
aPreferredAlternativeDataType: &mut nsACString
) -> nsresult
/**
* Get the preferred alternative data type set by preferAlternativeDataType().
* This attribute stands for the desired data type instead of the type of the
* information retrieved from the network stack.
*/
readonly attribute ACString preferredAlternativeDataType;
pub unsafe fn GetAlternativeDataType(
&self,
aAlternativeDataType: &mut nsACString
) -> nsresult
[src]
&self,
aAlternativeDataType: &mut nsACString
) -> nsresult
/**
* Holds the type of the alternative data representation that the channel
* is returning.
* Is empty string if no alternative data representation was requested, or
* if the requested representation wasn't found in the cache.
* Can only be called during or after OnStartRequest.
*/
readonly attribute ACString alternativeDataType;
pub unsafe fn OpenAlternativeOutputStream(
&self,
type_: &nsACString,
_retval: *mut *const nsIOutputStream
) -> nsresult
[src]
&self,
type_: &nsACString,
_retval: *mut *const nsIOutputStream
) -> nsresult
/**
* Opens and returns an output stream that a consumer may use to save an
* alternate representation of the data.
* Must be called after the OnStopRequest that delivered the real data.
* The consumer may choose to replace the saved alt representation.
* Opening the output stream will fail if there are any open input streams
* reading the already saved alt representation.
*/
nsIOutputStream openAlternativeOutputStream (in ACString type);
Trait Implementations
impl XpCom for nsICachingChannel
[src]
const IID: nsIID
IID: nsIID = nsID(3709690146, 24271, 20452, [143, 15, 153, 94, 122, 179, 18, 26])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsICachingChannel
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsICachingChannel
[src]
type Target = nsICacheInfoChannel
The resulting type after dereferencing.
fn deref(&self) -> &nsICacheInfoChannel
[src]
Dereferences the value.