Bug 1875768 - Call the appropriate postfork handler on MacOS r=glandium
[gecko.git] / netwerk / base / nsICachingChannel.idl
blob3623423ff7415fe2cbd7702e2954f1b7ecaaa54c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsICacheInfoChannel.idl"
8 interface nsIFile;
10 /**
11 * A channel may optionally implement this interface to allow clients
12 * to affect its behavior with respect to how it uses the cache service.
14 * This interface provides:
15 * 1) Support for "stream as file" semantics (for JAR and plugins).
16 * 2) Support for "pinning" cached data in the cache (for printing and save-as).
17 * 3) Support for uniquely identifying cached data in cases when the URL
18 * is insufficient (e.g., HTTP form submission).
20 [scriptable, builtinclass, uuid(dd1d6122-5ecf-4fe4-8f0f-995e7ab3121a)]
21 interface nsICachingChannel : nsICacheInfoChannel
23 /**
24 * Set/get the cache token... uniquely identifies the data in the cache.
25 * Holding a reference to this token prevents the cached data from being
26 * removed.
28 * A cache token retrieved from a particular instance of nsICachingChannel
29 * could be set on another instance of nsICachingChannel provided the
30 * underlying implementations are compatible. The implementation of
31 * nsICachingChannel would be expected to only read from the cache entry
32 * identified by the cache token and not try to validate it.
34 * The cache token can be QI'd to a nsICacheEntryInfo if more detail
35 * about the cache entry is needed (e.g., expiration time).
37 attribute nsISupports cacheToken;
39 /**
40 * Instructs the channel to only store the metadata of the entry, and not
41 * the content. When reading an existing entry, this automatically sets
42 * LOAD_ONLY_IF_MODIFIED flag.
43 * Must be called before asyncOpen().
45 attribute boolean cacheOnlyMetadata;
47 /**
48 * Tells the channel to use the pinning storage.
50 attribute boolean pin;
52 /**
53 * Overrides cache validation for a time specified in seconds.
55 * @param aSecondsToTheFuture
58 void forceCacheEntryValidFor(in unsigned long aSecondsToTheFuture);
60 /**************************************************************************
61 * Caching channel specific load flags:
64 /**
65 * This load flag inhibits fetching from the net. An error of
66 * NS_ERROR_DOCUMENT_NOT_CACHED will be sent to the listener's
67 * onStopRequest if network IO is necessary to complete the request.
69 * This flag can be used to find out whether fetching this URL would
70 * cause validation of the cache entry via the network.
72 * Combining this flag with LOAD_BYPASS_LOCAL_CACHE will cause all
73 * loads to fail.
75 const unsigned long LOAD_NO_NETWORK_IO = 1 << 26;
77 /**
78 * This load flag causes the local cache to be skipped when fetching a
79 * request. Unlike LOAD_BYPASS_CACHE, it does not force an end-to-end load
80 * (i.e., it does not affect proxy caches).
82 const unsigned long LOAD_BYPASS_LOCAL_CACHE = 1 << 28;
84 /**
85 * This load flag causes the local cache to be skipped if the request
86 * would otherwise block waiting to access the cache.
88 const unsigned long LOAD_BYPASS_LOCAL_CACHE_IF_BUSY = 1 << 29;
90 /**
91 * This load flag inhibits fetching from the net if the data in the cache
92 * has been evicted. An error of NS_ERROR_DOCUMENT_NOT_CACHED will be sent
93 * to the listener's onStopRequest in this case. This flag is set
94 * automatically when the application is offline.
96 const unsigned long LOAD_ONLY_FROM_CACHE = 1 << 30;
98 /**
99 * This load flag controls what happens when a document would be loaded
100 * from the cache to satisfy a call to AsyncOpen. If this attribute is
101 * set to TRUE, then the document will not be loaded from the cache. A
102 * stream listener can check nsICachingChannel::isFromCache to determine
103 * if the AsyncOpen will actually result in data being streamed.
105 * If this flag has been set, and the request can be satisfied via the
106 * cache, then the OnDataAvailable events will be skipped. The listener
107 * will only see OnStartRequest followed by OnStopRequest.
109 const unsigned long LOAD_ONLY_IF_MODIFIED = 1 << 31;