Closed Bug 651888 Opened 13 years ago Closed 4 years ago

Add "Disable Cache" toolbox button

Categories

(DevTools :: General, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: sideshowbarker, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0a1) Gecko/20110421 Firefox/6.0a1
Build Identifier: 6.0a1 (2011-04-21)

This is an enhancement request.

Safari has a "Disable Caches" menu option (under the top-level Develop menu). When loading a page, it causes that page and all its resources to be fetched over the network rather than served from the browser cache.

It would be great if Firefox provided a similar option, under the Tools top-level menu, with an associated keyboard shortcut.

Being able to quickly and easily toggle disable/enable of the cache is enormously useful when doing page/site troubleshooting, and having the option be more easily discoverable in Firefox by Web-developers users would make Firefox a more attractive site-development and troubleshooting tool for them.

Reproducible: Always
Component: Networking: Cache → Developer Tools
Product: Core → Firefox
Version: unspecified → Trunk
Fwiw, we have a keyboard shortcut and mouse action to do a "reload with caches disabled".  Just hold down the shift key while reloading (whether via keyboard shortcut or click on reload button).
QA Contact: networking.cache → developer.tools
Boris, can we somehow close this bug?
You mean by the devtools module owner looking at it and deciding whether this is desirable?

Michael, also note that "disable caches" is underdefined.  Are the browser's caches being disabled?  Or all caches?  (Force-reload disables all caches, for example.)  Is use of persistent connections disallowed when caches are disabled?  What about or DNS cache?  The OS DNS cache?  It'd sort of help to have a clear description of what the actual goal is, since I presume it's not just "have a menuitem with the same label as Safari".
No need to be persnickety.

I was considering a mechanism to disable caches, but I think the reload behavior you mention is probably sufficient for the vast majority of developers. If we need something more advanced than that we can reopen with some clearer definition.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
To be clear, I'm not being persnickety.  I just think that if we decide to do something like this, we need a coherent plan of what we're doing.
I agree.
Coincidentally (or not?) a feature to expose disabling caches just landed in Web Inspector this week:

https://bugs.webkit.org/show_bug.cgi?id=64097

I'm thinking that the reason this is useful is not just for reloading a page but also for ajax requests that are made. I have found myself in development at times adding "?" + new Date().getTime() to requests that would be fine in production but I want them to load fresh every time in development.

I agree that we want to be sure that we define more clearly exactly what we expect this change to do. Also, I'm not sure that we'd want constantly visible UI for this (ie a button/menu item), but the command line could be a reasonable way to approach a feature like this. (Again, more consideration required).
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: WONTFIX → ---
(In reply to comment #3)
> Michael, also note that "disable caches" is underdefined.  Are the browser's
> caches being disabled?  Or all caches?  (Force-reload disables all caches,
> for example.)  Is use of persistent connections disallowed when caches are
> disabled?  What about or DNS cache?  The OS DNS cache?  It'd sort of help to
> have a clear description of what the actual goal is, since I presume it's
> not just "have a menuitem with the same label as Safari".

Agreed that the description is not clear, so maybe I should describe the use case instead:

The use case is, I'm in the midst of developing an HTML page/app that consists of file with the HTML source, files with images and other media that are embedded in the page, files that are CSS stylesheets referenced in the HTML source file, and files that are Javascript scripts that are referenced in the HTML source. And I am making changes to all those resources and then looking at the results in Firefox.

So when I make a change to any of those files and reload, want to make sure that Firefox reloads the file from the network instead of from its cache, and that it also loads any of the referenced files (images, media, CSS, JS) from the network instead of from the browser cache.
(In reply to comment #8)
> So when I make a change to any of those files and reload, want to make sure
> that Firefox reloads the file from the network instead of from its cache,
> and that it also loads any of the referenced files (images, media, CSS, JS)
> from the network instead of from the browser cache.

For that use case, you can just do what Boris suggests in comment 1, right? That should work right now. Is there something about that that does not work as expected?

I think there's still the ajax use case for this.
If you shift-reload, then I believe all network requests made by the page, including XHR, will bypass the cache.
(In reply to Kevin Dangoor from comment #9)
> For that use case, you can just do what Boris suggests in comment 1, right?

Yes, if it does always actually work as expected.

> That should work right now. Is there something about that that does not work
> as expected?

There have been times when I tried it but I found that files I had changed were not actually getting reloaded as expected. However, I can't reproduce it now, and if I could, I would file a new bug for it anyway. So I suppose this bug can be closed.
Even though the capability is there with Shift-Reload, it is not discoverable by developers. And when you are debugging and refreshing a lot, you need to remember to do it every time and it creates a bit of uncertainty. "Does Shift really flush all caches or did I forgot to press it or is my code not good yet?"

FWIW, Safari has a "Disable Caches" item in the Develop menu for a long time.
(In reply to Anthony Ricaud (:rik) from comment #12)
> FWIW, Safari has a "Disable Caches" item in the Develop menu for a long time.

For the sake of completeness, I guess it should be noted that Chrome Dev Tools has one now too, though it's not terrifically discoverable (you have to click on the gear icon in the lower-right-hand corner of the Dev Tools window, then select the Disable Caches option from there).
The shift-reload feature seems to have another caveat to it that this would fix: if you have a page that 301 redirects, you can't 'shift reload' the original page. This can make troubleshooting rewrites/redirects hard on a sysadmin, because the workflow is:

load the original page
get redirected (inspect for correctness)
clear cache
load the original page
get redirected (inspect for correctness)
clear cache
etc

If you don't manually clear the cache, Firefox will (rightly, IMO) assume the 301 is still correct. This is good behavior for general usage, but can make troubleshooting redirect problems harder if you don't know what's going on, and more time-consuming even if you do. It would be nice to tell Firefox "stop using the cache for a bit". :)

I often resort to using curl for this type of work, but then you have to deal with passing a User Agent and any other relevant headers yourself... doable obviously, but it just trades one complication for another.
Depends on: 864098
As I web developer doi g very quick iterations on a site being served from localhost, I would like to be able to disable all caching for a particular page for the current session with a single command.

Robcee: worth resurrecting this bug or should I log a new one? I think my use case is a bit more focused.
Flags: needinfo?(rcampbell)
What is wrong with using Disable Cache in the options menu? This disables all caches for the current tab.
Flags: needinfo?(rcampbell) → needinfo?(jgriffiths)
(In reply to Michael Ratcliffe [:miker] [:mratcliffe] from comment #17)
> What is wrong with using Disable Cache in the options menu? This disables
> all caches for the current tab.

IMO it's surfaced in the wrong area of the UI. I would expect web developers to access this option much more frequently then they would, say, switch themes. Instead, switching themes is at the very top of the options menu and cache control is buried a the bottom. I'd be happier if:

* we moved the cache control toggle out of the options dialog, not sure where
* we implemented a gcli command to toggle this

Needinfoing Darrin to see what he thinks
Flags: needinfo?(jgriffiths) → needinfo?(dhenein)
I agree with Jeff, especially with the increased popularity of tools like grunt/etc. that enable watch + live reload.

Not to jump on the bandwagon given our recent discussion here (https://groups.google.com/forum/#!topic/mozilla.dev.developer-tools/zhFZRLnlmVw), but this type of toggle strikes me as a good candidate for a command button. This is something *some* developers will use *often*. An enabled/disabled icon would allow for quick visibility and remove ambiguity of what is happening. Those who don't need it can hide/de-prioritize it, and those who need it can have it readily available. This allows us to maintain per-tab control as well.
Flags: needinfo?(dhenein)
(In reply to Darrin Henein [:darrin] from comment #19)
> I agree with Jeff, especially with the increased popularity of tools like
> grunt/etc. that enable watch + live reload.
> 
> Not to jump on the bandwagon given our recent discussion here
> (https://groups.google.com/forum/#!topic/mozilla.dev.developer-tools/
> zhFZRLnlmVw), but this type of toggle strikes me as a good candidate for a
> command button. This is something *some* developers will use *often*. An
> enabled/disabled icon would allow for quick visibility and remove ambiguity
> of what is happening. Those who don't need it can hide/de-prioritize it, and
> those who need it can have it readily available. This allows us to maintain
> per-tab control as well.

I think a command button makes sense, it is what I wanted when I implemented the current feature. I would suggest that we have a toggled state and as long as the toolbox is open it should stay applied. To clarify:
1. Toggle the cache off via the toolbox button.
2. The cache is off for all pages loaded in that tab.
3. Close the toolbox.
4. The cache is now on for all pages in that tab.
5. Open the toolbox again.
6. The cache is off for all pages loaded in that tab (again).
7. Toggle the cache off via the toolbox button.
8. The cache is now on for all pages in that tab.

Note that because of the way the cache works the page needs refreshing in order to enforce the change (we do this automatically).
Changing the bug title as it seems clear that a toolbox button is the way to go here.
Summary: add "Disable Caches" menu item / command → Add "Disable Cache" toolbox button
Assignee: nobody → mratcliffe
Depends on: 994732
Filter on 1ff0543e-b501-4893-a72b-e4773c01e655
Assignee: mratcliffe → nobody
Product: Firefox → DevTools

"Disable Cache" button is now available in the Network panel, closing.

Honza

Status: REOPENED → RESOLVED
Closed: 13 years ago4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.