Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

privacy.sanitize.sanitizeOnShutdown and network.cookie.lifetimePolicy is not working as they should. Why?

  • 6 replies
  • 1 has this problem
  • 11 views
  • Last reply by Towa Shina

more options

(I don't know why but my reply won't show up. So I'm posting the same thing here.)

So I made more research and made my question simpler. FYI I reseted my firefox and since then I've changed settings only via about:preferences and user.js.


Situation A:

(1) Set these preferences.

  • permissions.default.geo =2
  • network.cookie.lifetimePolicy =0
  • privacy.sanitize.sanitizeOnShutdown =true

(2) Go to https://www.jma.go.jp/jp/highresorad/index.html

  • You'll see a pop-up message that says "位置情報を取得できませんでした。".

(3) Check the box down below (今後このメッセージを表示しない。), and close that message. Then press f5.

  • You'll see that the pop-up message won't show up anymore.

(4) Open a new tab. Then close the previous tab. Revisit the site.

  • You'll see that the pop-up message doesn't show up.

(5) Close all Firefox windows. Then open Firefox and visit the site.

  • Expected: The cookies should have deleted. The pop-up message will show up.
  • Actual Result: The pop-up message doesn't show up.

(6) Do Ctrl-Shift-Delete. Then press F5.

  • You'll see the pop-up message shows up this time.


Situation B:

(1) Set these preferences.

  • permissions.default.geo =2
  • network.cookie.lifetimePolicy =2
  • privacy.sanitize.sanitizeOnShutdown =true

(2) Go to https://www.jma.go.jp/jp/highresorad/index.html

  • You'll see a pop-up message that says "位置情報を取得できませんでした。".

(3) Check the box down below (今後このメッセージを表示しない。), and close that message. Then press f5.

  • You'll see that the pop-up message won't show up anymore.

(4) Open a new tab. Then close the previous tab. Revisit the site.

  • Expected: You'll see that the pop-up message doesn't show up.
  • Actual Result: You'll see that the pop-up message does show up.

(5) Close all Firefox windows. Then open Firefox and visit the site.

  • You'll see that the pop-up message shows up.

(6) Do Ctrl-Shift-Delete. Then press F5.

  • You'll see the pop-up message shows up this time.


(Original post below.)

Hello.

(Sorry about messy English.)

(1) I set preferences as below.

   network.cookie.lifetimePolicy =0 (accept cookies normally)
   privacy.clearOnShutdown.* =true (define what data is cleared when Firefox is closed)
   privacy.sanitize.sanitizeOnShutdown =true (make Firefox clear the data when it's closed)

These settings should make Firefox clear all my cookies when closed. But Firefox kept some of it. Firefox cleared the login state, but some site data such as volume control on Nicovideo's video player were kept. That means when you login to the site and watch a video at 17% volume, then close Firefox without clicking the logout link, reopen the same page, you'll see yourself logged out, but when you login to the site, you'll see the volume is set to 17% on the video player, not default 100%.

(2) Now I changed one setting.

   network.cookie.lifetimePolicy =2 (cookies are now for current session only)

This didn't work as intended either. Firefox sure cleared all the cookies, but it did in a weird way. The login states were working as intended. But some site data are not sheared between tabs. That means when you watch a video at 27% volume and close the tab, then revisit the same page, you'll see the volume on the video player is now set to the default 100%.

(3) And finally I found the one caused this.

   dom.ipc.processCount =1 (Firefox must run on a single process)
   network.cookie.lifetimePolicy =2 (same)
   privacy.sanitize.sanitizeOnShutdown =true (same)

I honestly don't understand why this works, but this way everything seems to be working properly. All cookies are sheared between tabs and they are cleared when Firefox is closed.

My question is:

(a) Why did this happen? Especially the situation (1) makes no sense to me. Why Firefox left some cookies when I told it to clear the cookies on shutdown?

(b) Is there any way to share data between processes? I don't want my Firefox to be single-processed slow browser.

Thanks.

Modified by Towa Shina

Chosen solution

After much more research on Situation B, when you turn on this setting, the data isn't actually written to disk. As a result, only currently open tabs from the site are notified of the change in local storage. A new tab never gains access to the local storage set before it opened.

This doesn't happen in pre-release versions (such as Nightly and Developer Edition) because for a long time now they have been testing the "Local Storage Next Generation" (LSNG) system that doesn't have this problem. I don't know why it is taking so long to get all the bugs out of LSNG, but I definitely get the sense that there isn't going to be a fix for this before LSNG actually rolls out.

If you want to try LSNG in its current "beta" or "unstable" shape, you can toggle a preference. I don't know whether this will convert your existing storage or flush it, but if you already clear all your data anyway, I guess that doesn't really matter for you.

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste next and pause while the list is filtered

(3) Double-click the dom.storage.next_gen preference to switch the value from false to true

I don't know when that takes effect, but possibly you'll need to exit and restart Firefox before anything changes.

More info on about:config: Configuration Editor for Firefox.

Read this answer in context 👍 1

All Replies (6)

more options

hello

Towa Shina


Steps to reproduce:

  1. Create a new (empty) Firefox profile folder.
  2. Create a prefs.js file in the profile folder with the following entries:
  • user_pref("network.cookie.lifetimePolicy", 2);
  • user_pref("privacy.sanitize.sanitizeOnShutdown", true);

3 Start Firefox.

4 Close Firefox (the problems do not occur when you start Firefox for the first time).

Actual results:

Problem 1: When you open Firefox, the start page isn't shown ([[default:https://start.fedoraproject.org/]] ). You only see a blank page.

Problem 2: If Firefox is not running and you open the browser with a link (for example, by clicking a link in your email client), you also see only a blank page and the link isn't opened.

Both problems only appear when no further Firefox instance is already running.

Expected results:

   The start page should always be shown, if one is configured (or if the default is used), not only for the second Firefox window you open.
   If you open the first Firefox instance with a link, the page should be shown instead of a blank page.

if the problem is not resolved please reinstall firefox:

then goto download latest firefox

https://www.mozilla.org/en-US/firefox/new/

tell me its help

thank you

Helpful?

more options

So I made more research and made my question simpler. FYI I reseted my Firefox and since then I've changed settings only via about:preferences and user.js.


Situation A:

(1) Set these preferences.

  • permissions.default.geo =2
  • network.cookie.lifetimePolicy =0
  • privacy.sanitize.sanitizeOnShutdown =true

(2) Go to https://www.jma.go.jp/jp/highresorad/index.html

  • You'll see a pop-up message that says "位置情報を取得できませんでした。".

(3) Check the box down below (今後このメッセージを表示しない。), and close that message. Then press f5.

  • You'll see that the pop-up message won't show up no more.

(4) Open a new tab. Then close the previous tab. Revisit the site.

  • You'll see that the pop-up message doesn't show up.

(5) Close all Firefox windows. Make sure that all Firefox processes are gone. Then open Firefox and visit the site.

  • Expected: The cookies should have deleted. The pop-up message will show up.
  • Actual Result: The pop-up message doesn't show up. Meaning some cookies have remained.

(6) Do Ctrl-Shift-Delete. Press F5.

  • You'll see the pop-up message shows up this time. Meaning all cookies are now gone.


Situation B:

(1) Set these preferences.

  • permissions.default.geo =2
  • network.cookie.lifetimePolicy =2
  • privacy.sanitize.sanitizeOnShutdown =true

(2) Go to https://www.jma.go.jp/jp/highresorad/index.html

  • You'll see a pop-up message that says "位置情報を取得できませんでした。".

(3) Check the box down below (今後このメッセージを表示しない。), and close that message. Then Press f5.

  • You'll see that the pop-up message won't show up no more.

(4) Open a new tab. Then close the previous tab. Revisit the site.

  • Expected: You'll see that the pop-up message doesn't show up.
  • Actual Result: You'll see that the pop-up message does show up. Meaning the cookie is not shared between tabs.

(5) Close all Firefox windows. Make sure that all Firefox processes are gone. Then Open Firefox and visit the site.

  • You'll see that the pop-up message shows up.

(6) Do Ctrl-Shift-Delete. Press F5.

  • You'll see the pop-up message shows up this time.


And I realized that dom.ipc.processCount does not actually solved my problems. Sorry for the incorrect information.

Helpful?

more options

Hmm, I have permissions.default.geo = 0 but I don't think it is important for this scenario because I just have to press Esc to dismiss Firefox's permission request and then the site will show its dialog.

I tried this interactive test:

(1) Tell the site not to ask me again.

The site set a value in "local storage" -- the first screenshot shows in the Storage Inspector (Shift+F9) where the site did that.

(2) Clear cookies and site data.

When you click the lock icon, an option should appear at the bottom of the drop-down to Clear Cookies and Site Data (sorry, I do not know the Japanese text). This is shown in the second screenshot. When you click that, Firefox shows a dialog for that site. That is shown in the third screenshot.

(3) Close the Storage Inspector and re-open it again.

This refreshes the display and shows that the set value was removed successfully. When reloading the page, the geo prompt comes up again. This is shown in the fourth screenshot.


Firefox treats "local storage" similarly to cookies for many purposes. For example, if you have denied cookie permission for a site, it also cannot set values in local storage. If you clear site data through the Options/Preferences page in the "Cookies and Site Data" section then they are both cleared at the same time.

However, "Clear Recent History" (Ctrl+Shift+Delete) and "Sanitize at shutdown" ("Clear history when Firefox closes") treat cookies and local storage separately. The checkbox for "Offline Website Data" clears the local storage. (See the fifth screenshot.)

In about:config, the preferences are named in a way you might find odd, because of their historical use for webapps that could work offline:

  • privacy.clearOnShutdown.offlineApps (for shutdown)
  • privacy.cpd.offlineApps (for the Ctrl+Shift+Delete dialog)

However, I think you selected those. Hmm.


This definitely leaves a couple of questions:

(1) If Firefox was configured with network.cookie.lifetimePolicy = 2 ("Delete cookies and site data when Firefox is closed"), why didn't the page check geo permissions again?

One possible reason for this is if the page is restored from cache; that doesn't trigger scripts that run on page "load". You would need to check the Storage Inspector to see whether the saved value is gone.

(2) If Sanitize on Shutdown was set to remove local storage, why didn't the page check geo permission again?

This rules out the page being restored from cache, so this is a big mystery to me. Maybe something is going wrong in the shutdown process that prevents all of the local storage and cache from being cleared??


I will test in a separate profile where I can afford to lose all my data. ;-)

Helpful?

more options

Regarding "Situation B"

Setting network.cookie.lifetimePolicy = 2 definitely affects how sites can access local storage. I use that setting and I know it prevents email messages from displaying in a popup window on the Outlook Web App platform (outlook.com/Office365). Sites that require local storage to pass messages between tabs/windows need an exception in the "Manage Permissions" dialog on the Options/Preferences page.

These are my screenshots for those threads:

Entering a new permission:

I don't know the exact rules for when a site can and cannot access local storage, but these examples of a new window (OWA) and a new tab (your test) demonstrate that access is tightly restricted by default. I wonder if there is any way to relax it a bit and still have Firefox empty the stored items at the end of the session?

Helpful?

more options

Chosen Solution

After much more research on Situation B, when you turn on this setting, the data isn't actually written to disk. As a result, only currently open tabs from the site are notified of the change in local storage. A new tab never gains access to the local storage set before it opened.

This doesn't happen in pre-release versions (such as Nightly and Developer Edition) because for a long time now they have been testing the "Local Storage Next Generation" (LSNG) system that doesn't have this problem. I don't know why it is taking so long to get all the bugs out of LSNG, but I definitely get the sense that there isn't going to be a fix for this before LSNG actually rolls out.

If you want to try LSNG in its current "beta" or "unstable" shape, you can toggle a preference. I don't know whether this will convert your existing storage or flush it, but if you already clear all your data anyway, I guess that doesn't really matter for you.

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste next and pause while the list is filtered

(3) Double-click the dom.storage.next_gen preference to switch the value from false to true

I don't know when that takes effect, but possibly you'll need to exit and restart Firefox before anything changes.

More info on about:config: Configuration Editor for Firefox.

Helpful?

more options

Thank you very much for the detailed research, jscher2000.

dom.storage.next_gen =true solved my problem. Although I see one of reasons why the LSNG is labeled "beta" as some local storage data which was made before the dom.storage.next_gen =true is now immune to both Ctrl-Shift-Delete and privacy.sanitize.sanitizeOnShutdown =true until I revisit the sites. But that doesn't seem a big problem to me.

One thing I struggled against to make this work was that now all local storage data gets deleted when closed regardless of the exceptions in the "Manage Permission" dialog on about:preferences#privacy. It was because privacy.clearOnShutdown.offlineApps =true deletes all existing local storage data when dom.storage.next_gen is set true. (This seems to be intended but doesn't occur when dom.storage.next_gen is set false.) Luckily network.cookie.lifetimePolicy =2 affects local storage and now doesn't mess up things. I could make it work with network.cookie.lifetimePolicy =2 and privacy.clearOnShutdown.offlineApps =false.

I've suffered this for a few years and finally it's gone. I really appreciate you.

Helpful?

Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.