If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Impossible to disable cache in offline mode

NEW
Unassigned

Status

()

Core
Networking: Cache
P5
normal
10 years ago
11 days ago

People

(Reporter: Wladimir Palant, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [necko-would-take])

(Reporter)

Description

10 years ago
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
You need to log in before you can comment on or make changes to this bug.