Closed Bug 752684 Opened 12 years ago Closed 8 years ago

Clean up and rename cache flags to make API less error-prone

Categories

(Core :: Networking: Cache, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jduell.mcbugs, Unassigned)

References

(Blocks 1 open bug)

Details

Our network caching flags are generally poorly named and a big confusing mess. I think getting cache flags right is probably the hardest and most confusing part of the necko API for client code.

(Pop quiz: what's the difference between LOAD_NO_NETWORK_IO and LOAD_ONLY_FROM_CACHE?  Hint: the IDL says it's about validation but AFAICT there's no difference there, and it's actually about fallback channels).  

See also bug 752663.

I think we should think seriously about cleaning up this interface and renaming/restructuring it as needed for clarity.  I expect we'd want to keep the old constants for backward-compat, but they could be deprecated and the newer API could be a lot easier for new necko client code to understand.
Blocks: http_cache
(In reply to Jason Duell (:jduell) from comment #0)
> (Pop quiz: what's the difference between LOAD_NO_NETWORK_IO and
> LOAD_ONLY_FROM_CACHE?  Hint: the IDL says it's about validation but
> AFAICT there's no difference there, 

instead of comparing LOAD_NO_NETWORK_IO and LOAD_ONLY_FROM_CACHE, you should compare LOAD_FROM_CACHE and LOAD_ONLY_FROM_CACHE. There is a subtle difference between the two, that has to do with validation.

> it's actually about fallback channels).  

Is that true, or is it just the case that the fallback channel implementation has a bug? I remember being confused about this recently and my conclusion was that we should change the handling of those flags so there is no difference w.r.t. whether we fall back, but when there's LOAD_NO_NETWORK_IO or similar, we should ensure we open the fallback channel with the same flags.

So, if my conclusion was wrong, then I agree that this is supremely confusing and should be fixed.
> compare LOAD_FROM_CACHE and LOAD_ONLY_FROM_CACHE. There is a subtle difference

Actually they are totally different, and orthoganal: the former bypasses all validation, and the latter causes loads to fail if they can't be satisfied from the cache.

> is it just the case that the fallback channel implementation has a bug? 

I don't know the fallback code enough to say.  Sounds like you might want to open a bug for it?
these are exposed to js and extensions... risk is worse than reward. docs would be welcome
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.