@deprecated Please use nsIContentPrefService2 instead.
Get a pref.
Besides the regular string, integer, boolean, etc. values, this method
may return null (nsIDataType::VTYPE_EMPTY), which means the pref is set
to NULL in the database, as well as undefined (nsIDataType::VTYPE_VOID),
which means there is no record for this pref in the database.
This method can be called from content processes in electrolysis builds.
We have a whitelist of values that can be read in such a way.
aGroup | the group for which to get the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to get the global pref (applies to all sites) |
aName | the name of the pref to get |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to search in memory or in permanent storage for it), obtained from a relevant window or channel. |
aCallback | an optional nsIContentPrefCallback to receive the result. If desired, JavaScript callers can instead provide a function to call upon completion |
the value of the pref @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Set a pref.
This method can be called from content processes in electrolysis builds.
We have a whitelist of values that can be set in such a way.
aGroup | the group for which to set the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to set the global pref (applies to all sites) |
aName | the name of the pref to set |
aValue | the new value of the pref |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to store it in memory or in permanent storage), obtained from a relevant window or channel. @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Check whether or not a pref exists.
aGroup | the group for which to check for the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to check for the global pref (applies to all sites) |
aName | the name of the pref to check for |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to search in memory or in permanent storage for it), obtained from a relevant window or channel. @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Check whether or not the value of a pref (or its non-existance) is cached.
aGroup | the group for which to check for the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to check for the global pref (applies to all sites) |
aName | the name of the pref to check for |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to search in memory or in permanent storage for it), obtained from a relevant window or channel. @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Remove a pref.
aGroup | the group for which to remove the pref, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to remove the global pref (applies to all sites) |
aName | the name of the pref to remove |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to search in memory or in permanent storage for it), obtained from a relevant window or channel. @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Remove all grouped prefs. Useful for removing references to the sites
the user has visited when the user clears their private data.
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to remove prefs in memory or in permanent storage), obtained from a relevant window or channel. |
Remove all prefs with the given name.
aName | the setting name for which to remove prefs |
aPrivacyContext | a context from which to determine the privacy status of the prefs (ie. whether to remove prefs in memory or in permanent storage), obtained from a relevant window or channel. @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Get the prefs that apply to the given site.
aGroup | the group for which to retrieve prefs, as an nsIURI from which the hostname will be used, a string (typically in the format of a hostname), or null to get the global prefs (apply to all sites) |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to search for prefs in memory or in permanent storage), obtained from a relevant window or channel. |
a property bag of prefs @throws NS_ERROR_ILLEGAL_VALUE if aGroup is not a string, nsIURI, or null |
Get the prefs with the given name.
aName | the setting name for which to retrieve prefs |
aPrivacyContext | a context from which to determine the privacy status of the pref (ie. whether to search for prefs in memory or in permanent storage), obtained from a relevant window or channel. |
a property bag of prefs @throws NS_ERROR_ILLEGAL_VALUE if aName is null or an empty string |
Add an observer.
aName | the setting to observe, or null to add a generic observer that observes all settings |
aObserver | the observer to add |
Remove an observer.
aName | the setting being observed, or null to remove a generic observer that observes all settings |
aObserver | the observer to remove |
The component that the service uses to determine the groups to which
URIs belong. By default this is the “hostname grouper”, which groups
URIs by full hostname (a.k.a. site).
The database connection to the content preferences database.
Useful for accessing and manipulating preferences in ways that are caller-
specific or for which there is not yet a generic method, although generic
functionality useful to multiple callers should generally be added to this
unfrozen interface. Also useful for testing the database creation
and migration code.