Open Bug 396434 Opened 17 years ago Updated 2 years ago

Impossible to disable cache in offline mode

Categories

(Core :: Networking: Cache, defect, P5)

defect

Tracking

()

People

(Reporter: jwkbugzilla, Unassigned)

References

Details

(Whiteboard: [necko-would-take])

I am doing something like this:

var request = new XMLHttpRequest();
request.open(...);
request.channel.loadFlags |= Components.interfaces.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE;

For most part it works fine. However, if we are in offline mode the response to this request still comes from the cache. It seems that this is the expected behavior, from nsHttpChannel::Connect():

        if (offline)
            mLoadFlags |= (LOAD_ONLY_FROM_CACHE | LOAD_CHECK_OFFLINE_CACHE);

        ...

        rv = OpenCacheEntry(offline, &delayed);

And nsHttpChannel::OpenCacheEntry():

    if (mLoadFlags & (LOAD_ONLY_FROM_CACHE | INHIBIT_CACHING)) {
        // If we have been asked to bypass the cache and not write to the
        // cache, then don't use the cache at all.  Unless we're actually
        // offline, which takes precedence over BYPASS_LOCAL_CACHE.
        if (BYPASS_LOCAL_CACHE(mLoadFlags) && !offline)
            return NS_ERROR_NOT_AVAILABLE;

Which is all fine but what should we do if we *really* don't want to get the cache but rather NS_ERROR_OFFLINE instead?
Whiteboard: [necko-would-take]
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.