From:  Valentin Gosu <>
Date:  19 Dec 2015 06:54:41 Hong Kong Time

Re: devtools re-fetching problem


On 18 December 2015 at 22:56, Tom Tromey  wrote:

> I mentioned this on #necko the other day.
> We've had a "re-fetching" problem in devtools for a while now.
> The basic issue is that the platform drops the original text of some
> things, like style sheets.  (Instead just the parsed form is preserved.)
> So, in order to make some tools work with the source text, devtools
> re-fetches the sources.  However, this is sub-optimal -- maybe the
> sources have changed on the server, leading to confusing results.
> We were wondering if there was some way we could solve this problem.
> One idea we had is to always cache these things, in a way that would let
> the devtools retrieve them.  Is this possible?
> Or ... some other idea here.
Is the problem that we're not caching these resources? Maybe because of the
response headers?
Or is there another reason that we can't use the previously downloaded

> On irc jduell mentioned:
>  tromey: I think you want to set the LOAD_ONLY_FROM_CACHE loadflag
> on
>          your network request
> ... which isn't really want we want, I think (but which in context made
> perfect sense) --

nsIRequest::LOAD_FROM_CACHE should disable revalidation, and give you what
is in the cache. It falls back on the network if the resource is missing,
but if you combine it with nsICachingChannel::LOAD_ONLY_FROM_CACHE, it
would fail it the resource wasn't cached.

Of course, if the file is not cached at all, this wouldn't work, and a
re-fetch would be necessary :)

> but maybe a Plan B would be to use that to at least
> inform users: "hey, devtools had to re-fetch this, be warned".