Provides access to information about the state of the private browsing service.
Gecko 1.9.1
Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

This interface is deprecated since Firefox 20, and will probably be completely removed in Firefox 21.

The nsIPrivateBrowsingService interface provides access to information about the state of the private browsing feature offered in Firefox 3.5 and later. When Firefox is in private browsing mode, Firefox shouldn't save any potentially private information. The browser itself stops caching, and also doesn't record history information. In addition, temporary, databases are created to be used for cookies and local storage; these databases are thrown away when private browsing mode is turned off, and the regular databases are re-activated. The temporary cookie and local storage databases start out empty.

Extensions that record potentially private information should use this interface to detect whether private browsing mode is enabled, and if it is, avoid saving that information. For details on how to do this, see the article Supporting private browsing mode. Similarly, plug-ins can detect whether or not private browsing mode is in effect by using the NPN_GetValue() function to check the current value of the NPNVprivateModeBool variable.

Implemented by: @mozilla.org/privatebrowsing;1. To get access to the service from JavaScript, use:

var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]

C++ callers should use the contract ID @mozilla.org/privatebrowsing-wrapper;1 instead.

Method overview

void removeDataFromDomain(in AUTF8String aDomain);


Attribute Type Description
autoStarted boolean Indicates whether or not private browsing was started automatically at application launch time. This is only ever true if privateBrowsingEnabled is also true. Read only.
lastChangedByCommandLine boolean Indicates whether or not the last private browsing mode transition was performed on the command line (using either the -private or -private-toggle switches) rather than the user interface. Read only.
privateBrowsingEnabled boolean Indicates whether or not private browsing mode is currently enabled. You may also turn private browsing mode on and off by setting the value of this attribute. Changing this value while handling one of the notifications generated by the private browsing service throws an NS_ERROR_FAILURE exception.



Removes all data stored for the specified domain, including its subdomains.

void removeDataFromDomain(
  in AUTF8String aDomain
The domain for which data should be removed.

See also