How to change the default local storage settings in Firefox?

In Firefox 57, when I open a website, and check its permissions I can see a long list:

List with settings

I want to change these two default settings:

  • Maintain offline storage
  • Store Data in Persistant Storage

(not sure how the two are different, but I don't like the sound of either)

Both are set to Use default, but I can not find out how to change this default setting. Under PREFERENCES there is no way to change these settings, at least I can't find them.

Using Firefox 57 on Archlinux.


Solution 1:

I have to say up front that this is not a solution, but researching it was a learning experience and someone else may also be interested in my findings.

Currently there is no simple way to set these defaults; more on this in the notes below. Although there seems to be a way, I am no programmer and have not been able to follow the breadcrumbs to their source. If you search for “permissions” in about:config you will find an entry permissions.manager.defaultsUrl. It points to resource://app/defaults/permissions. Enter that into the address bar and hit return, you will see the contents of that internal resource:

# This file has default permissions for the permission manager.
# The file-format is strict:
# * matchtype \t type \t permission \t host
# * "origin" should be used for matchtype, "host" is supported for legacy reasons
# * type is a string that identifies the type of permission (e.g. "cookie")
# * permission is an integer between 1 and 15
# See nsPermissionManager.cpp for more...

# UITour
origin  uitour  1   https://www.mozilla.org
origin  uitour  1   https://support.mozilla.org
origin  uitour  1   https://addons.mozilla.org
origin  uitour  1   https://discovery.addons.mozilla.org
origin  uitour  1   about:home
origin  uitour  1   about:newtab

# XPInstall
origin  install 1   https://addons.mozilla.org
origin  install 1   https://testpilot.firefox.com

# Remote troubleshooting
origin  remote-troubleshooting  1   https://input.mozilla.org
origin  remote-troubleshooting  1   https://support.mozilla.org

The file nsPermissionManager.cpp is available as part of the source code, which you can find through your system or online. Here is the .cpp file and here is the header.

Of particular interest is this blog post discussing it; scroll down to the section Permissions.

This is all the further I could get, even after looking through permissions.sqlite with an SQLite manager. If there is a way to set the two defaults you’re interested in in about:config, I haven’t been able to find it.

Notes

“Maintain Offline Storage specifies whether or not the selected website has permission to store offline content, also known as application cache, on your hard drive or mobile device. This data can be utilized when the browser is in offline mode.” (source)

To clarify for others browsing this question, the website permissions are accessed from the menu using Tools > Page Info > Permissions or by right-clicking in a non-active area of the webpage and selecting View Page Info and selecting the Permissions tab.

Historical notes

Regarding there being no simply way to set defaults, see here:

Some permissions can be set via the Options/Preferences pages or possibly via the about:config page, but the default of others is hard coded and can't be changed.

This used to be possible—at least for Maintain Offline Storage—on about:permissions by selecting All Sites (Default Permissions for All Sites), but Mozilla removed about:permissions from Firefox in release 45. One unofficial reason given for this was due to it “missing a lot of settings since the new Options/Preferences in a tab” (source). This also removed the ability to see the permission settings for all sites in one place. I found a discussion on ghacks from May 2017 that there are plans to reimplement a permissions managemer.

See this announcement about the need to “manipulate a new string preference permissions.manager.defaultsUrl” in order to set default permissions starting in Firefox 35.