I'll first try to sum what we actually want here:
- devtools want access to the raw content network requests already made
w/o rerequsting from network and just by doing the request again (use
the channel to obtain it)
- hence, when devtools are open, stuff that would not be cached (based
on load flags or response headers) we want to temporarily cache anyway
(best in some temp cache, ideally deferred)
- when devtools want the content again, use LOAD_FROM_CACHE |
LOAD_ONLY_FROM_CACHE flags (have to verify) or some devtools-specific
thing set on the channel to force use of the cached content
- when these flags are specified and a cache entry is not found in a
usual place, look into the temporary deferred cache we create just for
devtools
- if it's not found in any cache (usual nor devtools specific) -> fail
the load, so that devtools can decide to go to the network and
potentially prompt the user before that (or show something in the UI)
Makes sense?
Note that I really would like to avoid hacking this with appid or so.
We have patches for deferred caching already, relatively simple, just
waiting for review from Michal. He is not doing them because for the
original purpose (NSec) they may change even more. But personally, if
defer commit founds another usage purpose, we can review and land now,
updates for NSec can be done incrementally.
-hb-
On 1/7/2016 2:08, Jason Duell wrote:
> On Wed, Jan 6, 2016 at 8:52 AM, Honza Bambas <
hba...@mozilla.com> wrote:
>
>> I think this kind of caching should do devtools, not necko.
> If I read you correctly, Honza, you're saying devtools should cache the
> original page content, not necko. But I'm not sure that this is
> possible--I assume they don't have access to the original data, just the
> post-parsed DOM and whatnot. (Is that true?)
>
>>> some sort of flag that indicates it should be invisible to cache reads
> unless CACHE_HIDDEN_COPY is again present.
>>>>> We can't cache the resources if the web server tells us "don't cache
>>>> this", so even if we use things such as LOAD_ONLY_FROM_CACHE, we still
>>>> need
>>>> a solution for that case.
>>>>
>>>> Or ... some other idea here.
>>>> How about forcing Gecko retain the original source text when devtools are
>>>> being used?
>>>>
>>>
>>> Sounds like we need something like a CACHE_GECKO_COPY flag that keeps a
>>> "secret" cache only for internal gecko use?
>>>
>> If that would be enforced only for active devtools, we could go with that.
>>
>>
>>> 1) if the resource would normally be cached, does nothing (the resource
>>> gets cached normally)
>>> 2) If the resource wouldn't be cached, cache it (perhaps only in RAM?
>>>
>> Easy to evict on devtools close but easy to waste memory...
>>
>> Or
>>> maybe we'd need that only if INHIBIT_PERSISTENT_CACHING is set), with some
>>> sort of flag that indicates it should be invisible to cache reads unless
>>> CACHE_HIDDEN_COPY is again present.
>>>