Open Bug 706970 Opened 9 years ago Updated 3 months ago

Tabs restored at startup (app tabs, session restore) should be refreshed from server, not in a "stale" state from cache

Categories

(Firefox :: Session Restore, enhancement, P3)

8 Branch
enhancement

Tracking

()

People

(Reporter: rick3162, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [please read comment 57 before commenting])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1
Build ID: 20111120135848

Steps to reproduce:

I opened some tabs,
and having enabled "Don't load tabs until selected" and "When Firefox starts: Show my windows & tabs from last time" is enabled)
I closed Firefox.


Actual results:

When I restarted Firefox, all tabs
(both the active tab which was automatically loaded 
and the other tabs which I had to select in order to be loaded)
were reloaded from CACHE.


Expected results:

The tabs should be loaded by connecting to the SERVERS, not from cache.

I believe that, the user, when he restarts Firefox having these two options enabled,
expects that the (restored) tabs that he clicks to be loaded, have CURRENT/FRESH content and are not loaded from cache 
(that's would justify better the "extra click" by the user, I think).


Currently, the only way to make Firefox reload the pages at startup
is by enabling Tools>Privacy "Clear history when Firefox closes" and ticking the "Cache" box inside.
I have noticed this behaviour in older Firefox versions. But now I think it does reload from network when needed. At least I get uptodate version of pages when I open them.
No, you're wrong. 
They're loaded from cache, and afterwards the user must press F5 in order to get current content.
In Firefox 8 it works for me fine, on pages that are updated several hours a day. When I start Firefox after 24 hours and click on such an App tab, it gets a correct up to date version from the server.
Maybe your pages have bad headers, that do not tell Firefox to reload them often. Or what I say only works for pinned App tabs, not for normal tabs.
I can try that too.
Please do not insist.

Try this:
login to http://forums.mozillazine.org/  (provided that you've registered there)
-or whatever other forum you like-
both in Firefox AND in another browser.

Open http://forums.mozillazine.org/search.php?search_id=unreadposts
in BOTH browsers.
and click to view one of the undead threads using the OTHER browser.

Close Firefox, either having the tab with the above url pinned or not, it doesn't make a difference.
When you restart Firefox,
you'll see in the aforementioned tab (when you select it), 
that the thread you just viewed using the other browser is still listed as unread.
If then you press F5, then you'll see correct the unread list.
And, when you restart Firefox, and select one of the restored tabs (pinned or not),
have HttpFox addon running:
you'll see for yourself as it's being loaded
that EVERYTHING is loaded from cache.
Does the addon enable you to see the HTTP headers of the page? Can you see if there is any expiration date set when you first access the page (list of unread threads)?
Yes it does.
And, about expiration date: 
the headers that have 200,
either have a expire value 0 (never expire?), or they expire tomorrow (12-04).

If Firefox currently chooses to load at startup a restored tab from cache or network
based on the expiration date,
I believe that's not acceptable.

The user, when restarts the browser and clicks to select a tab,
from the procedure he sees that takes place (that the page is being *loaded* after his click)
expects it, when the loading ends, to have fresh content.
(In reply to Kostas from comment #7)
> Yes it does.
> And, about expiration date: 
> the headers that have 200,
> either have a expire value 0 (never expire?), or they expire tomorrow
> (12-04).

See? So why would the user and browser want to reload the page from network if the PAGE itself doesn't think it needs to reload that often? The page has told Firefox to not bother downloading until tomorrow. The page should know best how often the content changes. Yes, if its expiration dates are wrong, than it has bad headers as I suggested. The page needs to be fixed.
I do not know what the value 0 means. You can clear your cache, visit the page again and go to about:cache?device=disk to see how Firefox interpreted it.

I have tested it on page https://www.abclinuxu.cz , and there Firefox sets the expiration date to 1970-01-01, in the past. That means it needs to reload the page every time as it is always expired.

So, I am not knowledgeable enough to know if Firefox really behaves in this way and whether that is correct according to a specification. But as a user my expectation is that Firefox does not reload pages needlessly. It should observe the expiration headers.

It seems our expectations are conflicting.

Of course if you know better than the page, you can force a reload (F5), I think there even is a pref in Firefox to always reload pages (ignore expirations).
Component: General → Session Restore
QA Contact: general → session.restore
Look, I don't plan spending any more posts/effort trying to convince you, or argue with you.
You have your opinion, ok. 
You expressed it, ok.
But, it's not right posting continuously here
trying to convince me that there's no problem...


It's just plain annoying whenever I restart Firefox
after I click on a tabs to restore,
to get the content I had when I closed Firefox (even days ago),
and have to F5 every tab in order to make sure that the content I see is really updated.

I'd like to see the opinion from someone of the Firefox developer team on this, please.
The way "Don't load tabs until selected" should work is exactly what I expected and exactly what was occurring in Firefox 8.01.

Firefox would start without reloading all the tabs loading data from the cache and not the servers. 
This enabled Firefox to start quicker which should be it's purpose.
When I selected a tab I had not previously viewed, the tab would reload. I found this to be true because I have http://tvlistings.zap2it.com/tvlistings/ZCGrid.do set as an app tab.

This is how "Don't load tabs until selected" is supposed to work. 
This functionality should have not be relying on website headers, a simple array that contains all the tabs and removes those tabs that are selected will work better. Alternatively, tabs could be refreshed each time they are selected.

The way it was working in 8.01 was exactly what I expected to happen. I start Firefox and it only loads the current visible tab. When I selected a different tab, that tab was then refreshed and I could view the updated page. This functionality enables Firefox to start quicker because it does not need to load all the tabs.
Verified as WFM on:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:12.0a1) Gecko/20120109 Firefox/12.0a1

When restarting Firefox, each tab was only loaded when selected.

Kostas, please try to reproduce this issue on the latest Firefox version with a clean profile and let me know if you can:
http://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
I should've mentioned in the above comment, the websites on the tabs were not loaded  from cache but from the corresponding servers.
Yes, Firefox will attempt to load from the cache if it's available & allowed (I think that oversimplifies the heuristic, but it's good enough). Sometimes that's not going to be what you want though.

Kostas, if you don't want anything loaded from cache following startup, would it make sense for you to set Firefox to clear your cache at shutdown?
@Ioanna 
I've just tried it with the latest nightly (2012-01-10) on a new profile
and, no, it loads from cache.

@Paul
But, I've written in my very first post that I know that
the only way to make Firefox reload the pages at startup
is to clean the cache at shutdown.
But, this solution is totally unacceptable for me:
eg. currently Firefox cache is 577MB:
forcing Firefox to clean cache at closing:
1. inevitably will slow down the Firefox shutdown procedure,
2. it's a pity to delete so many cache files -
files that would improve Firefox performance the next time,
only because I want Firefox to force load tabs on startup...
(In reply to Kostas from comment #0)
> Expected results:
> 
> The tabs should be loaded by connecting to the SERVERS, not from cache.
> 
> I believe that, the user, when he restarts Firefox having these two options
> enabled, expects that the (restored) tabs that he clicks to be loaded, have
> CURRENT/FRESH content and are not loaded from cache 
> (that's would justify better the "extra click" by the user, I think).

Not me!  I believe the EXACT opposite.  I open a lot of tabs in Firefox (sometimes over 200!) when I startup Firefox with the "Don't load tabs until selected" option, I do not want Firefox trying to reload any of those pages any differently than how it behaves after a session restore.  I want it to reload from cache as much as possible so that I can access a page's content where I left it when I was last reading it.

So, as far as I'm concerned, the behavior of the "Don't load tabs until selected" option, reloading from cache when I access the page, is EXACTLY how want the option to work.

Please don't change this behavior without providing an option choose ones preference.
I agree with Daniel Kirkdorffer,

There should be options so that the user can select the way they want the "don't load tabs until selected" check box.

I prefer the functionality to do exactly as it states, to not load tabs until selected. While loading from the cache is OK, when I select the tab, I expect the page to be reloaded as it currently does.

To change the functionality so that it loads pages from the server is contrary to the stated function. How does one go from "don't load tabs until selected" to mean that the pages load from the server when Firefox is started. 

Please, do not use contrary meanings when describing functionality in Firefox. We get quite enough of that BS from politicians. The check box reads: "don't load tabs until selected." therefore, the tabs should not load the file when FF starts and remain in that state until the tab is selected.

If you change the functionality, then change the description to "Tab Loads Options" and have options that the user can select for their personal preference.
  * Don't load tabs until selected
     - Current functionality
  * Load tabs from server on start
     - loads tabs directly from server when FF starts
  * Load tabs from cache on start
     - loads tabs from cache when FF starts
  * Reload tab when selected
     - Issues an F5 for the newly selected tab.
     - Reload list to specify which tabs to reload when selected.

These options would enable a user to configure FF in a way that is most efficient for their surfing habits.

Scott A. Tovey
If you're going to make bug 690596 a duplicate of this bug, you really need to change the summary -- I'm using "Show my home page".
Something I never got answered from bug 690596: do pages loaded via session restore (which is what pinned tabs uses, right?) get all the normal DOM events (load, DOMContentLoaded, readystatechanged, etc.) as they're loaded?
(In reply to Nicholas Miell from comment #20)
> Something I never got answered from bug 690596: do pages loaded via session
> restore (which is what pinned tabs uses, right?) get all the normal DOM
> events (load, DOMContentLoaded, readystatechanged, etc.) as they're loaded?

I'm not 100% sure, but I think they do. At least in session restore we use "load" to restore form values.
OS: Windows 7 → All
Hardware: x86_64 → All
Summary: When you enable "Show my windows & tabs from last time" + "Don't load tabs until selected", tabs on startup should be loaded bypassing cache → Tabs restored at startup (app tabs, session restore) should be loaded bypassing cache
Then that suggests that the pages in question have broken scripting or broken cache control HTTP headers.

And this bug's summary is clearly nonsense, Firefox should obey the caching directives. That's the whole point of the cache.
The best would be to add an extra checkbox in Options>'General' tab  (next to the "Don't load tabs until selected" checkbox)
-or add an extra preference in about:config-
so, when it's enabled, the restored tabs at startup to be always loaded bypassing cache.
If any change is made to the current options via any new option or configuration, it must not, by default, change the current behavior one has selected.

i.e. those people, like myself, that have chosen to select the "Don't load tabs until selected" option, should have the same behavior and currently implemented after any new options are introduced, that pages are loaded from local cache.

If someone wants it to instead re-request the pages from the remote server, they should be required to have to willfully make that new selection or configuration.
(In reply to Daniel Kirkdorffer from comment #24) 
> i.e. those people, like myself, that have chosen to select the "Don't load
> tabs until selected" option, should have the same behavior and currently
> implemented after any new options are introduced, that pages are loaded from
> local cache.

I meant to write: "those people, like myself, that have chosen to select the "Don't load tabs until selected" option, should have the same behavior _as_ currently implemented after any new options are introduced: that pages are loaded from local cache."
Attached patch Patch v0.1Splinter Review
Dietrich, I'm not sure if we even want this, but I think this works (tested with http://playground.zpao.com/mozilla/cache/always.php). I don't like the reloadCurrentEntry() call immediately followed by the reload(flags), but it's the only way it works (same reload issue as bug 597757).
Attachment #615940 - Flags: feedback?(dietrich)
Comment on attachment 615940 [details] [diff] [review]
Patch v0.1

Review of attachment 615940 [details] [diff] [review]:
-----------------------------------------------------------------

Chatted on IRC about this, and I think the change is not appropriate for these reasons:

1. The session restore feature is designed to have Firefox behave as if you had not restarted the browser. There are definitely places where we can't or don't do that exactly for various reasons, but it's the general approach. Firefox would not force-reload tabs for a user without their or the website's prompting. So this feature should also not do that.

2. The web has caching policies built into it. We obey those policies as specified by websites. The default behavior is not "Firefox decides to load from cache." Firefox adheres to the caching policies of the web site itself. If a site says "do not reload until X", Firefox will respect that and pull from cache until it has expired. This patch would reverse that, overriding websites' stated cache policies.*

There are two situations that I think *are* worth examining however:

* Sometimes there is not a stated cache policy. How should we behave in that scenario?

* Sometimes the cache may have expired since the last shutdown. Should we reload then?
Attachment #615940 - Flags: feedback?(dietrich) → feedback-
(In reply to Dietrich Ayala (:dietrich) from comment #27)
> 2. The web has caching policies built into it. We obey those policies as
> specified by websites. The default behavior is not "Firefox decides to load
> from cache." Firefox adheres to the caching policies of the web site itself.
> If a site says "do not reload until X", Firefox will respect that and pull
> from cache until it has expired. This patch would reverse that, overriding
> websites' stated cache policies.*
> 
> There are two situations that I think *are* worth examining however:
> 
> * Sometimes there is not a stated cache policy. How should we behave in that
> scenario?
>
> * Sometimes the cache may have expired since the last shutdown. Should we
> reload then?

The session store is used for three somewhat incompatible purposes:

* to pretend as if the browser never crashed -- in which case pages should be loaded from cache regardless of their caching policy, because if no crash had occurred, the page would've sat inert in the browser window until the user chose to manually reload it.

* to record the users pinned tabs and home page(s) -- in which case, the pages should be loaded according to their caching policy, as if the user had created the tabs and manually entered the URLs themselves.

* to save the state for the "Restore Previous Session" menu option -- in which case I'm not sure what the browser should do, you could probably make an argument for either behavior.
(In reply to Paul O'Shannessy [:zpao] (no longer moco, slower to respond) from comment #26)
> Created attachment 615940 [details] [diff] [review]
> Patch v0.1
> 
> Dietrich, I'm not sure if we even want this, but I think this works (tested
> with http://playground.zpao.com/mozilla/cache/always.php). I don't like the
> reloadCurrentEntry() call immediately followed by the reload(flags), but
> it's the only way it works (same reload issue as bug 597757).


It would be great if that preference "browser.sessionstore.force_bypass_cache"
for about:config
(contained in your patch)
was incorporated in Firefox.
(In reply to Kostas from comment #29)
> (In reply to Paul O'Shannessy [:zpao] (no longer moco, slower to respond)
> from comment #26)
> > Created attachment 615940 [details] [diff] [review]
> > Patch v0.1
> > 
> > Dietrich, I'm not sure if we even want this, but I think this works (tested
> > with http://playground.zpao.com/mozilla/cache/always.php). I don't like the
> > reloadCurrentEntry() call immediately followed by the reload(flags), but
> > it's the only way it works (same reload issue as bug 597757).
> 
> 
> It would be great if that preference
> "browser.sessionstore.force_bypass_cache"
> for about:config
> (contained in your patch)
> was incorporated in Firefox.

To avoid any misunderstanding:
when saying "incopropated in Firefox"
I mean of course that it would be great 
if that preference could make it to Firefox stable release channel.
+1 for a preference

This is also a privacy issue. 

I have set Firefox to "Show my windows and tabs from last time" and to delete cookies at shutdown. As both options don't work together anyway, which is its own topic, I also set "Browser.sessionstore.privacy level" to 2, so cookies will be deleted properly.

But still, when I am logged into a website (like our company's gitlab server), close the browser and someone reopens it, the logged-in website will be showed, possibly containing private information. It is like being logged in without logging in (unless you try to open another page from there on, which is properly loaded from the server, thus not logged in).

Thus I am also in favor of an about:config pref to disable loading from cache after startup.
Duplicate of this bug: 510179
I would like to bump this bug. 
This behavior is not clear. Afer years of using firefox I've learned that when you open the browser, you have to press F5 to *really* load the page. That's awful. 
Who cares if the browser starts faster if I have to reload the page once it has finished loading from cache???

Imagine a board, you close firefox and when you come back and open it after, lets say, 8h you see the same threads, and you see things like "Foo answered a minute ago" when it should be "Foo answered 8h ago". And of course you don't see real new threads, cause what you are seeing is a "snapshot" of that board 8h ago when you left. Most users don't know this is happening to them, do you think is that right? do you think performance is a reason to hide the real content of a web page?
(In reply to salmarina from comment #33)


> Afer years of using firefox I've learned that when you open the browser, 
> you have to press F5 to *really* load the page. That's awful. 


After years of using firefox, I have not experienced this. The tab that is open when I start
firefox which is typically my yahoo email page refreshes and shows me that I have new email.

In addition, every tab that I select to view the contents, refreshes, I do not need to press
the f5 key unless I am on a site that does not have an auto refresh script on it.

I have (don't load tabs until selected) checked in the options tab settings.

I never see snapshots unless the tab was already viewed in which case I must press the f5 key to 
refresh the page.


> Who cares if the browser starts faster if I have to reload the page 
> once it has finished loading from cache???


Everyone who has experienced a browser crash because of a bug in a script on some page that is being refreshed even when that particular tab is not the current tab.

Considering the fact that you cannot view the contents of any given tab until you select the tab,
it is far better to prevent refreshing of that particular page until it is selected. In this way,
if the browser doe happen to crash because of a script update, you know which tab contains the 
buggy script and can close it before it fully refreshes on the next browser start.


> Most users don't know this is happening to them, do you think is that right? 

Yes, because most users do not know how to figure out which web page is causing
a browser crash due to an updated script. Those users blame the browser first and
the web developer never.

> do you think performance is a reason to hide the real content of a web page?

Yes, but performance is not the only reason, as I said previously, delaying 
a page refresh until the tab has been selected insures that if the page script
has been updated with a bug that can cause a browser crash, you will know exactly
which page you were on when the browser crashes. I infer that you have not run 
into this situation. I have, and I can assure you, it is a pain.

Delaying a page refresh also helps those who have dial up or low end 
DSL services. They are not able to download all the tabs that they may
have open at a single time. Delaying a page refresh also saves on bandwidth. 
If you leave a website open in a tab that you visit indiscriminately, you do 
not need that tab to refresh until you actually select it to view the site.

Take care.
We are not talking about lazy load, we are talking about loading from cache.

Open http://www.forocoches.com/foro/forumdisplay.php?f=2
Wait a few seconds and close firefox.
Open firefox again (restore last session option should be active) and you will see an outdated version of that board. Now press F5 and you will see the real content, updated.

And that's the problem: loading from cache.
Lazy load?

If that is what they call it, uses the cache. How else would Firefox be able 
to retain the icon in the tab?

By the by, all of my points still apply.

If Firefox refreshed the cache upon starting, it would no longer be a cache.
The point of the cache is to retain data that does not change over time, if
the cache contains the websites JavaScript, and the script updates data via
AJAX, if Firefox runs the cache scripts, then yes, the data should update.

Firefox could have an option for the user to indicate whether the user wants
the cache scripts refreshed or not. That would seem to solve your problem.
But in all honesty, I don't think they're smart enough to retain the current
expected functionality that Firefox has, and add an option to run a simple 
foreach loop to run each cached web page's JavaScript.

I don't think they are smart enough because they always remove functionality 
that is beneficial to users and then declare (blatantly lie) that Firefox
is better for it.

Nope, they're not smart enough to do what you're asking them.
I don't care about icons, images, scripts... that's something that in fact is usually cached by all browsers. But dynamic content (like the example I posted, a php script) is, guess, dynamic. Firefox should not cache dynamic content cause that makes it static. 

When I open the browser I want it to load pages, not snapshots. When I want a snapshot of a page, I use Ctrl+S.

Those pages that load the content via ajax are not affected by this "behaviour". That in fact adds more confusion, users don't know that some pages are restored updated (ajax) while others are restored from cache (snapshot, not up to date). Isn't it obscure?

There is no problem in retaining favicons and tab titles, but when you click a tab, load the page not the cache. Its going to be slower, of course, but browsers should browse the internet not the cache in my opinion. 

This "feature" is not clear, it is inconsistent (ajax vs non-ajax pages), sometimes presents outdated content to users, makes other press F5 just after browser start and in return we just get a few milliseconds less startup time. Don't think it is worth it.
I think you need to set "browser.cache.check_doc_frequency" to 1.

see http://kb.mozillazine.org/Browser.cache.check_doc_frequency
I will try that A. Sel. But looking for info about that preference:
https://support.mozilla.org/es/questions/988902
The author said this didn't work on FF27 at start up. And it seems he thinks the same I think about this feature...
"browser.cache.check_doc_frequency" didn't work, tabs are still loaded from cache at start.

Let's add another interesting thing about this feature: some extensions and scripts do not work properly. For example AdBlock. When you open the browser and a page/tab is loaded from cache sometimes the ads are not hidden. Then you press F5 and everything works as expected, ads gone.
Similar things happen to some userscripts, I'm still trying to find out why and how to detect a cache load (in case that's possible).


Firefox is already the fastest browser when it comes to session restoring, so please, stop loading pages from cache, there is no need to be so aggressive, break extensions and produce strange behaviors.
Oh. I remember now that it did not work for me either. That's when I got the idea that it can't load from cache, when there is no cache.

Just set "Options > Privacy > History > Clear History when Firefox closes" and make sure that *only* "Cache" is specified in "Settings..." (the button next to it).

Hope this helps...
@A.Sel he (and I) are already aware that you can clear the browser cache however the proper healthy behavior would be to load new dynamic content from the server while loading properly cached data from the cache.  In other words when I click the tab to load a forum; pictures and other static (non-changing) content should load from the cache (saving bandwidth) while the thread list and other dynamic (changing) content should be updated with data from the server.

Now I do understand that many sites don't properly handle their headers and the headers tell Firefox not to load the new content BUT I think Mozilla should be smart enough to realize this common issue with web sites (especially forums) and load the page script from the server.  It would also be nice if it auto-detected when their wasn't an internet connection and loaded from cache in that case only but, that's a whole other issue.

+1 to make it an option (with better wording).
Hello there,

I've got an associated bug:
In my company we use a website to submit the time we needed to work on a project.
Because I use that website every day, I've pinned it.

Since I've pinned it, there are some problems. The page gets reloaded everytime I click the app tab for the first time of the browser session, but the content of the <input> tags remains unchanged.
I need to press Ctrl+F5 to reload the website entirely and take the <input> values from the server. The remainder of the page (e. g. the highlighted day) is always reloaded from the webserver, only the <input> tags are not taken from the server.

Furthermore only the input fields which has been filled by myself in the last firefox session are not reloaded. The other fields become reloaded.

All these problems don't occur if I don't pin the tab.

That the page becomes reloaded every time (except of the <input> tags) seems to depend on the HTTP response header of the page ("Cache-control: max-age=0, no-cache, no-store, must-revalidate").
But this doesn't seem to work for <input> tags...

It whould be nice if the behaviour of app tabs could be changed or if an option in about:config could be added for that.

Kind Regards
David Gausmann
A relevant issue/use case: (its about the new Stack Overflow navigation opt-in)
http://meta.stackoverflow.com/questions/312786/bug-report-homepage-at-session-restore-shows-relative-dates-from-the-last-time
It occurs in Firefox 43 (it doesn't occur in Chrome 46).


For reference, here is a screenshot of the Firefox Network Monitor devtool while loading http://stackoverflow.com/,
showing only the HTML network request(s)(1) and its relevant cache-related headers:
https://i.imgur.com/wwL870a.jpg
i.e.
Response headers: Cache-control: "private, max-age=0"
Request headers:  Cache-control: "max-age=0"


If you examine that HTML you'll notice that it contains the relative and absolute timestamp for each question listed, 
with the relative date being for the the time the page is loaded.
Then -via a script- the relative timestamps e.g. '1 min ago' after 1 min they will become '2 min ago' and so on.

Therefore, the 1st time the page is loaded,
the relative dates are displayed as they are transferred in the HTML -or as they are loaded from cache, as in session restore-
and, then, every 1 min, they are increased locally via a script.
I just want to say this is still an issue.
The years passed by.
Looks like this is more a feature than a bug. A feature I don't like at all obviously...
They did it on purpose, and except a few ones here, everybody seems to like and understand this strange behavior. What I don't know is why this is still open. 

For those who say this doesn't happen, it is probably because the page being loaded (for example your email) loads the content via ajax. That bypasses the cache. But any other thing, like a php script for example, loads from cache, and is outdated.
The current Firefox stable version is 48.
Related to my OP (having then FF 8), 
the setting "Don't load tabs until selected" is no longer available,
as this behavior is the default in Firefox (the pref "browser.sessionstore.restore_on_demand" is true by default).
There's only "When Firefox starts: Show my windows & tabs from last time", now.


I sum the approaches suggested:
1. adding a "browser.sessionstore.force_bypass_cache" pref in about:config (comment 26)
2. Investigate these two situations:  (comment 27)
  * Sometimes there is not a stated cache policy. How should we behave in that scenario?
  * Sometimes the cache may have expired since the last shutdown. Should we reload then?

I support either of these approaches.
And yes, I think that the page should be reloaded 
when there's not a stated cache policy 
or when cache has expired since last shutdown.


Also, because in Chrome this issue doesn't occur,
if someone could explain the way Chrome browser implements session restore 
(having on Chrome's settings|On startup|select "Continue where you left off" i.e. https://support.google.com/chrome/answer/95314?hl=en),
it might help in finding a way that solves this issue 
that is, making Firefox provide up-to-date content on session restore
while still adhering to the caching policy of the web sites, when available.
Based on [1] :

> F5 usually updates the page only if it is modified. The browser usually tries to use all types 
> of cache as much as possible and adds an "If-modified-since" header to the request. 
> Opera differs by sending a "Cache-Control: no-cache".
> 
> CTRL-F5 is used to force an update, disregarding any cache. IE7 adds an "Cache-Control: no-cache", 
> as does FF, which also adds "Pragma: no-cache". Chrome does a normal "If-modified-since" and 
> Opera ignores the key. 

As I've written in comment 2, currently, most of the time 
the user needs to press F5 (or the "Reload current page" button) in restored tabs 
in order to get updated content (F5 will suffice - Ctrl+F5 is not needed).
Note that only Ctrl+F5 disregards any cache.

So, I think that a solution to this issue would be, 
when selecting a tab and it loads (due to the "Don't load tabs until selected" behavior), 
Firefox to load it via performing an "F5" action, i.e. a refresh
(I don't think that this is what is currently happening).
This way I believe that restored pages would always be up-to-date, while still making use of cache if available.
And because since Firefox FF 47 [2] the "Don't load tabs until selected" is the default behavior, i.e. Firefox will wait until you select a tab before loading it,
I think that this won't have any significant impact on the performance of reloading restored tabs, and that's because only 1 (non pinned) tab is restored at any time, i.e. as you select it (not all tabs, simultaneously).
In any case, maybe provide my suggested behavior as an setting/pref.



[1] http://stackoverflow.com/questions/385367/what-requests-do-browsers-f5-and-ctrl-f5-refreshes-generate
[2] https://support.mozilla.org/en-US/kb/allow-firefox-load-multiple-tabs-background
Summary: Tabs restored at startup (app tabs, session restore) should be loaded bypassing cache → Tabs restored at startup (app tabs, session restore) should be refreshed
(In reply to Kostas from comment #48)
> Based on [1] :
> 
> As I've written in comment 2, currently, most of the time 
> the user needs to press F5 (or the "Reload current page" button) in restored
> tabs 
> in order to get updated content (F5 will suffice - Ctrl+F5 is not needed).
> Note that only Ctrl+F5 disregards any cache.
> 
> So, I think that a solution to this issue would be, 
> when selecting a tab and it loads (due to the "Don't load tabs until
> selected" behavior), 
> Firefox to load it via performing an "F5" action, i.e. a refresh
> (I don't think that this is what is currently happening).
> This way I believe that restored pages would always be up-to-date, while
> still making use of cache if available.
> And because since Firefox FF 47 [2] the "Don't load tabs until selected" is
> the default behavior, i.e. Firefox will wait until you select a tab before
> loading it,
> I think that this won't have any significant impact on the performance of
> reloading restored tabs, and that's because only 1 (non pinned) tab is
> restored at any time, i.e. as you select it (not all tabs, simultaneously).
> In any case, maybe provide my suggested behavior as an setting/pref.
> 
> 
> 
> [1]
> http://stackoverflow.com/questions/385367/what-requests-do-browsers-f5-and-
> ctrl-f5-refreshes-generate
> [2]
> https://support.mozilla.org/en-US/kb/allow-firefox-load-multiple-tabs-
> background

I have been getting the activity you described for several years.

My yahoo email sorts my email into folders and I always made sure 
that bot spam and trash is deleted. When I click the tab the next day,
the spam folder indicates that there is new spam in the folder.
If there is new email in the inbox or any other folder I have mail
sorted into, they also indicate that there is new email in them.

I have never had to hit F5 or CTRL + F5 to refresh the page.
Websites that refresh their content when I click on the tab
the next day after shutting down are:
Yahoo.com
zap2it.com
Facebook.com
Twitter.com and others.

Zap2it.com is a TV listings site, so it is a good 
site to debug exactly what your problem is!

Take care;
Scott
(In reply to Scott from comment #49)
> (In reply to Kostas from comment #48)
> > Based on [1] :
> > 
> > As I've written in comment 2, currently, most of the time 
> > the user needs to press F5 (or the "Reload current page" button) in restored
> > tabs 
> > in order to get updated content (F5 will suffice - Ctrl+F5 is not needed).
> > Note that only Ctrl+F5 disregards any cache.
> > 
> > So, I think that a solution to this issue would be, 
> > when selecting a tab and it loads (due to the "Don't load tabs until
> > selected" behavior), 
> > Firefox to load it via performing an "F5" action, i.e. a refresh
> > (I don't think that this is what is currently happening).
> > This way I believe that restored pages would always be up-to-date, while
> > still making use of cache if available.
> > And because since Firefox FF 47 [2] the "Don't load tabs until selected" is
> > the default behavior, i.e. Firefox will wait until you select a tab before
> > loading it,
> > I think that this won't have any significant impact on the performance of
> > reloading restored tabs, and that's because only 1 (non pinned) tab is
> > restored at any time, i.e. as you select it (not all tabs, simultaneously).
> > In any case, maybe provide my suggested behavior as an setting/pref.
> > 
> > 
> > 
> > [1]
> > http://stackoverflow.com/questions/385367/what-requests-do-browsers-f5-and-
> > ctrl-f5-refreshes-generate
> > [2]
> > https://support.mozilla.org/en-US/kb/allow-firefox-load-multiple-tabs-
> > background
> 
> I have been getting the activity you described for several years.
> 
> My yahoo email sorts my email into folders and I always made sure 
> that bot spam and trash is deleted. When I click the tab the next day,
> the spam folder indicates that there is new spam in the folder.
> If there is new email in the inbox or any other folder I have mail
> sorted into, they also indicate that there is new email in them.
> 
> I have never had to hit F5 or CTRL + F5 to refresh the page.
> Websites that refresh their content when I click on the tab
> the next day after shutting down are:
> Yahoo.com
> zap2it.com
> Facebook.com
> Twitter.com and others.
> 
> Zap2it.com is a TV listings site, so it is a good 
> site to debug exactly what your problem is!
> 
> Take care;
> Scott

That is because those pages load the content after the page has loaded, using ajax.
Try to open any php forum, there are millions out there, and leave the tab there for a while. Select another tab, close Firefox, open it again and click the forum tab. Take a snapshot, press F5 and enjoy the game of the "find the differences", powered by Firefox.
> close Firefox, open it again and click the forum tab.

By far the worst part of the experience is that even the icon in the tab bar is properly animated: Fx pretends to all 100% that it is loading something from the net. While it actually is not.
I have also experienced the described problem here, but I need to press Ctrl+F5 to get what I want.
But in my issue, I am also the webmaster of the pinned website with the problems.

My website is used for entering the number of hours every employee in my company had required to work on a project.
The website content is generated once using PHP, but the entered values are transferred via AJAX. There are many nameless input fields (type=text) for entering the hours.

My problem is that Firefox does successfully load the current page content the first time I click the tab, BUT also restores the previously entered values (which doesn't belong to the page content).
When the week has changed, I got all of the input fields filled with the values from the previous week (which doesn't belong to the current week, because the current week is the future on monday morning). So I always need to press Ctrl+F5 on monday to clear those input fields for the coming week.

A solution (for me as webmaster) will be to modify the website, so it will also generate its content via JavaScript, but it is unpleasant when you need to modify a website to avoid a browser-specific behaviour.

Kind Regards
David Gausmann
(In reply to salmarina from comment #50)
> (In reply to Scott from comment #49)
> 
> That is because those pages load the content after the page has loaded,
> using ajax.
> Try to open any php forum, there are millions out there, and leave the tab
> there for a while. Select another tab, close Firefox, open it again and
> click the forum tab. Take a snapshot, press F5 and enjoy the game of the
> "find the differences", powered by Firefox.

On 9/13/2016 I set up a date and time script on a local website 
to test this as you suggested.

The date and time displayed was: 9/13/2016 at 2:10:45
On 9/14/2016 I clicked on the tab to check the content of the page:
The date and time displayed is: 9/13/2016  at 2:10:45

This confirms your complaint. 
If the page was actually loaded and refreshed from the 
web server when the tab was clicked, the date and time 
would have changed.

The techs must be assuming; due to AJAX sites, that the 
page is loading from the server and not from cache.

You are correct in asserting that when the tab is clicked,
is should not only load the page but refresh the content
from the website.

Take care:
Scott
Another example where this issue occurs:
the tab restored at startup being any issue page in a GitHub repo.
(e.g. any page inside e.g. https://github.com/eslint/eslint/issues)
I have to press F5 to get updated content (=new comments and/or newly edited comments).

As with all example URLs mentioned in this bug, in Chrome this issue doesn't occur.
(In reply to Kostas from comment #44)
> A relevant issue/use case: (its about the new Stack Overflow navigation
> opt-in)
> http://meta.stackoverflow.com/questions/312786/bug-report-homepage-at-
> session-restore-shows-relative-dates-from-the-last-time
> It occurs in Firefox 43 (it doesn't occur in Chrome 46).

Additionally to the above, (and that the reputation displayed is from the last time, as someone commented in the link above),
with any StackExchange page, e.g. http://superuser.com/questions/1143238/
no new comments or answers are displayed at session restore, unless I press F5.

(In Chrome this issue doesn't occur).
Another example:
when the tab restored at startup is https://inbox.google.com/
then initially, for an interval of up to 5 sec, its content is of the last session, i.e. emails and reminders that I have marked as done during the last session,
and then it gets updated content.

(In Chrome this issue doesn't occur).
(interpreting past developer comments as this is working as designed, and the requested change would be considered to be an *enhancement*, implimented in such a way that current behavior can be maintained)
Severity: normal → enhancement
Summary: Tabs restored at startup (app tabs, session restore) should be refreshed → Tabs restored at startup (app tabs, session restore) should be refreshed from server, not in a "stale" state from cache
As an enhancement, the initial implementation should use the current functionality as the default with a checkbox in the Options general settings to permit refreshing from the server.

An additional enhancement would allow the user to enter the tab URLs in a list that are to be refreshed from the server while those not in the list are refreshed from the cache. This would give the user the ultimate flexibility and control of his or her browsing habits.
Blocks: ss-feature
Status: UNCONFIRMED → NEW
Ever confirmed: true
Call me stupid if wish, but not everyone shares the opinions of the previous commenters.  As I wrote back in 2012, as far as I'm concerned, the behavior of the "Don't load tabs until selected" option, reloading from cache when I access the page, is EXACTLY how would want the feature to work.

The behavior should not be changed without also providing an option choose a personal preference, and should remain the default behavior if such an option is provided.
Firefox should at least obey caching directives. Otherwise it is useless for much of the non-AJAX segment of the internet.
The feature you are talking about, @Daniel, is "Save Page", or Ctrl+S.
You can save the current page, and load it from "cache" (aka hard disk) whenever you want. 

But in my opinion, "loading" a webpage in a browser should download the webpage from the server, not from disk. That's what I use the browser for, you know, browsing the internet, not my hard disk. And I think that should be the expected behavior. 

But obviously I am wrong, and that's why this issue is considered a feature. 
It seems that I am using Firefox wrong, expecting it browse the Internet, not my hard disk.
@salmarina - That is your opinion.  It doesn't match my browsing habits though.  I might open a new tab to read later, and later might happen after a shutdown of Firefox, sometimes out of my control because of a forced shutdown or crash.

Your suggested solution doesn't address that.  You aren't "wrong", you're just of a different opinion than those that implemented the current behavior, and many users.  Personally, I think the solution would be to provide a way, via an option, to override the default behavior (i.e. the current behavior now), to suit your needs.  Then you can select the option and surf the Internet in the way you like, and I can too.
I would suggest a quick test: Find someone, a friend, your family, anyone.

Open Youtube on Firefox, go to "trending videos" to see a list of currently popular videos. Close Firefox, and open it again (with the restore tabs option enabled obviously). Now try to find out what the user thinks he is seeing:

What do you think is this page?
Do you think it is updated?
If we close the browser and open it again tomorrow, will you see the same videos we are seeing now?

I can guarantee NOBODY will ever answer to these 3 questions correctly. The idea of "page snapshots" is completely artificial. BUT you don't have to believe me. Just do the test yourself. 
Unless the user has discovered the bug already (5 years is a lot of time to discover this "feature"), and knows the F5 trick, I am pretty sure you will get the same answers as me. 

Do the test, all of you, maybe my friends and family are weird too haha, who knows. Do the test and let me know. Just for fun.
To each their own.  I've tried to be reasonable.  You seem to be unable to consider that there are differing opinions, and differing use cases.  There are plenty of web pages that can be cached appropriately for the my needs.  I don't care about sub-sections of a page that are more dynamic and won't cache.  Cachable content, much of it textual, is often generated and presented on a page.  Or I might be in the middle of filling out a form, or typing text (such as in this comment), when Firefox is exited.  Go ahead, try it with the settings you don't agree with, type in your reply and exit your browser without saving the changes, then reopen it and presto, your text is in the form and you can continue.
Please ignore my last comment.  It was not supposed to be submitted.
(In reply to Daniel Kirkdorffer from comment #68)
> Please ignore my last comment.  It was not supposed to be submitted.

Firefox cached it by accident? :P
(In reply to salmarina from comment #69)
> (In reply to Daniel Kirkdorffer from comment #68)
> > Please ignore my last comment.  It was not supposed to be submitted.
> 
> Firefox cached it by accident? :P

No.  I wasn't using Firefox, I was using Chrome.

No, I didn't intend to send the admittedly snarky part.  My general point stands though: There are plenty of web pages that can be cached appropriately for my needs.  I don't care about sub-sections of a page that are more dynamic and won't cache.  Cachable content, much of it textual, is often generated and presented on a page.
I agree that this should be a selectable option for the user.

Firefox should either not cache the content and refresh the page from the internet when the tab is selected, or retrieve the page data from the users cache per the user's selected option. I would go even further and suggest that this should also be selectable per individual tab option as well.

This would be the ideal solution as in some cases, such as opening a tab to read an article later in time, the user wants the static data on the page to remain the same and in other cases such as selecting the tab that connects to your email or a TV listings site, the user wants the data refreshed from the site.

Forcing a single option on every person, regardless which option it is is the wrong way. Providing a means for all users to get what they want, is always the right way to go.

Sadly, the ultimate selected method is the one that is held near and dear in the heart of an individual who has deluded himself into thinking that any other opinion, even one that is all inclusive as this one is, is a threat to his delusional and non existent godhood!
(In reply to Daniel Kirkdorffer from comment #70)
> My general point stands though: There are plenty of web pages that can be cached
> appropriately for my needs.  I don't care about sub-sections of a page that
> are more dynamic and won't cache.  Cachable content, much of it textual, is
> often generated and presented on a page.

If there is no header telling Firefox to cache a resource, Firefox should not cache it... Why do we have headers for if the browser is going to ignore them? 

(In reply to Scott from comment #71)
> This would be the ideal solution as in some cases, such as opening a tab to
> read an article later in time, the user wants the static data on the page to
> remain the same and in other cases such as selecting the tab that connects
> to your email or a TV listings site, the user wants the data refreshed from
> the site.

Maybe the article had errors that were fixed later, or an update was made, or the article now has more comments... the user will never know, cause Firefox is showing an outdated content without telling him.

---

There is no need to show outdated content. That's just a performance optimization that is against UX.
If you want to preserve input values, like forms, you can do that after loading the page from the server (and most modern pages already do that without relying on the browser).
If you are worried about Firefox crashing, ok, show a cached page after Firefox crashes and warn the user about that, but only when Firefox crashes.

But please, don't show me outdated content. I am connected to the Internet for a reason, and I am not in offline mode for a reason. Load the page, that's what the browser is supposed to do. If you want a cached page, there is an option for that already: Ctrl+S. 

A browser that loads pages from hard disk, it sounds absurd. But heh it loads so fast!! We are genius! Firefox now starts much faster than Chrome! We did it! We are the fastest browser on Earth, yay! 
At least I hope you don't remove the refresh page button, I know it is slow, but I need it.
This is an enhancement requrest and as far as I know no developer has yet commented since comment 27 whether it will be implemented or not.  Until such a person comes back you are debating about something whose summary you may agree with or disagree with, but doing so does NOT change the request. So please stop now
Whiteboard: [please read comment 57 before commenting]
(In reply to Dietrich Ayala (:dietrich) from comment #27)
> Comment on attachment 615940 [details] [diff] [review]
> Patch v0.1
> 
> Review of attachment 615940 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Chatted on IRC about this, and I think the change is not appropriate for
> these reasons:
> 
> 1. The session restore feature is designed to have Firefox behave as if you
> had not restarted the browser. There are definitely places where we can't or
> don't do that exactly for various reasons, but it's the general approach.
> Firefox would not force-reload tabs for a user without their or the
> website's prompting. So this feature should also not do that.
> 
> 2. The web has caching policies built into it. We obey those policies as
> specified by websites. The default behavior is not "Firefox decides to load
> from cache." Firefox adheres to the caching policies of the web site itself.
> If a site says "do not reload until X", Firefox will respect that and pull
> from cache until it has expired. This patch would reverse that, overriding
> websites' stated cache policies.*
> 
> There are two situations that I think *are* worth examining however:
> 
> * Sometimes there is not a stated cache policy. How should we behave in that
> scenario?
> 
> * Sometimes the cache may have expired since the last shutdown. Should we
> reload then?

There is a patch, and a review. Can we get an update, or get this patch "un-bit-rotted"?

Thanks.
(From comment #27)

> … caching policies … specified by websites. …

(In reply to Kostas from comment #54)

> … any issue page in a GitHub repo. …

Please, does anyone know GitHub's policy? 

The staleness with GitHub can be particularly troublesome; it's commonplace for me to find things two or more days out of date (and embarrassing and/or confusing when the staleness becomes apparent only after I reply to an issue). 

Does anyone know of a WebExtensions-compatible extension that can allow a user to override a policy for a site or domain?
Duplicate of this bug: 1376351
Priority: -- → P3
Suspect that BugZilla here can be bitten by this bug. A few minutes ago I added a comment that _reportedly_ collided, mid-air, with SIXTEEN others. Stale air? Methinks. Mozodour.
<https://screenshots.firefox.com/cM1z7gBwCl5SCOaI/framasphere.org> is typical of the ugliness that results in diaspora* -based Framasphere when it's not realised, when previewing (bug free) then posting (bugged), that: 

* Firefox has represented stale content 

:-(

<https://forums.pcbsd.org/thread-20352-post-112385.html#pid112385> (2015-11-29) reminds me that "Firefox session restoration and staleness" was the thing that troubled me most about Firefox when I began switching from Safari. Two years later, it's still most troublesome. 

----

For anyone who would like to experiment with a workaround to the staleness, try: 

1. create a Firefox container

2. be prepared for loss of things such as saved form field data

3. send each non-contained (default) page to the container

4. restart Firefox

5. restore the previous session

– are the contained pages stale, or fresh?

Related, unanswered: 

Aiming to work with no more than one container _and_ avoid (default) non-contained work - Test Pilot / Containers - Mozilla Discourse
<https://discourse.mozilla.org/t/-/20025?u=grahamperrin>

(In reply to Graham Perrin from comment #78)

https://screenshots.firefox.com/cM1z7gBwCl5SCOaI/framasphere.org

For posterity, here's the screenshot that's to be removed from the screenshots service.

(In reply to Graham Perrin from comment #75)

… The staleness with GitHub can be particularly troublesome; …

For what it's worth, I have a vague sense that GitHub has been improved in ways that lessen the impact of this bug 706970. The same may be true of Bugzilla @ Mozilla.

TBH I'm uncertain. It's possible that I have learnt to unconsciously key Control-R before viewing pages at affected sites.

Here is another victim of this "feature", a user of the well known extension uBlock reported:
"Ublock doesn't seem to do anything at all on the page visited when opening the browser with the (Firefox) setting 'Show your windows and tabs from last time'. In particular, ads that are otherwise blocked are displayed." (https://github.com/gorhill/uBlock/issues/3625)
uBlock developers have an "experimental" flag that is enabled on Firefox as a workaround for this bug feature.
But unfortunately web developers can't do much about this. Unless you want them all to transform their sites so instead of serving their content directly they would serve a script instead, that then loads the content via AJAX.

I seriously can't believe it is 2020 and we still have to manually reload restored pages when we open Firefox.
Hopefully one day, someone will realize that lazy loading tabs at startup is good enough and you don't have to lazy load them from disk. We use Firefox to browse the Internet, not our HDDs.

You need to log in before you can comment on or make changes to this bug.