-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLOSED] Client-side disabling of the cache #2590
Comments
Comment by peterflynn Three quick thoughts:
|
Comment by gruehle Peter hit on the main points I was going to bring up. The shell API can be Rather than disabling the cache at app startup, did you try clearing the cache before reload (Network.clearBrowserCache)? This may be less invasive, and possibly more reliable. BTW, your code works perfectly except one case: launch Brackets, open DevTools (with caching disabled), close DevTools and re-launch Brackets. In that case the re-launch doesn't clear/ignore the cache. Doing a subsequent reload fixes things. |
Comment by DennisKehrig "Should we have a -shell API like getOwnRemoteDebuggingUrl()?" "OTOH, the tail end of app startup will still be delayed while we talk to the socket... so maybe that should happen after APP_READY instead of before?" "Do we understand why this works? The manual caching workaround only remains in effect while the dev tools window is open -- as soon as you close it, caching turns back on." "In fact, we should make sure it's not too persistent -- if the change is remembered across CEF launches, then the 2nd bullet above is wrong and all "normal"/non-dev launches past the first one would also have no caching..." Rather than disabling the cache at app startup, did you try clearing the cache before reload (Network.clearBrowserCache)? This may be less invasive, and possibly more reliable. "BTW, your code works perfectly except one case: launch Brackets, open DevTools (with caching disabled), close DevTools and re-launch Brackets. In that case the re-launch doesn't clear/ignore the cache. Doing a subsequent reload fixes things." |
Comment by gruehle
Yes - the If we do stick with the current implementation of disabling cache at startup, I'm in favor of doing it after the |
Comment by DennisKehrig Thanks, Glenn! Sounds good to me. |
Comment by DennisKehrig Investigated a bit further by hacking the dev tools. Peter was right in being surprised that this works - I didn't see any call to Network.setCacheDisabled(false) that the dev tools perform when the connection is closed. In fact, even when simply killing the Chrome frame with the dev tools open (and thus giving it no time to perform a cleanup), caching is enabled again afterwards. So it remains mysterious why the cache remains disabled after we disconnected. Another clue: simply opening and closing the dev tools is not a problem. Rather, a reload has to occur before closing dev tools again. Then our code to disable the cache does not work because we can't connect. Only THEN will closing the dev tools actually turn caching back on. |
Comment by DennisKehrig Okay, got it. If the cache is disabled, the next reload is guaranteed to not be cached (regardless of whether it occurs while the client is still connected or not). Also, all reloads during that connection will not be cached. If there has been a reload after disabling the cache while still connected, the first reload after having disconnected will not be cached. So we need to disable the cache after every reload. Normally the dev tools don't do that. They disable the cache once when you open them (and every time you check the checkbox). We can hack the dev tools to change this. |
Comment by gruehle I tried calling function handleFileReload(commandData) {
return _handleWindowGoingAway(commandData, function () {
_disableCache().always(function () {
window.location.reload(true);
});
});
} This way the cache is disabled immediately before the window is reloaded. This always worked for me, even if I opened up DevTools, disabled caching, and closed DevTools. Reloading from DevTools works as long as caching is disabled. Can you think of any downside to disabling at reload time? |
Comment by DennisKehrig Sounds good, this way at least reloading with dev tools on only works when the cache is disabled there, making it easier to make the connection when it doesn't work. |
Comment by DennisKehrig Of course this wouldn't work if some extension triggered window.location.reload(), but since other things are associated with reloading, people should use Commands.DEBUG_REFRESH_WINDOW anyway. |
Comment by DennisKehrig Thank, |
Comment by gruehle Hey Would you mind submitting a new pull request that only has the changes to DocumentCommandHandlers.js? Thanks! |
Comment by DennisKehrig Sure, Glenn! Have fun with #2894 :) |
Issue by DennisKehrig
Thursday Jan 31, 2013 at 03:32 GMT
Originally opened as adobe/brackets#2732
Contribution to #1744
DennisKehrig included the following code: https://github.com/adobe/brackets/pull/2732/commits
The text was updated successfully, but these errors were encountered: