nsIPrivateBrowsingService 编辑

netwerk/base/public/nsIPrivateBrowsingService.idlScriptable Provides access to information about the state of the private browsing service. 1.0 66 Introduced 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"]
                    .getService(Components.interfaces.nsIPrivateBrowsingService);

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

Method overview

void removeDataFromDomain(in AUTF8String aDomain);

Attributes

AttributeTypeDescription
autoStartedbooleanIndicates whether or not private browsing was started automatically at application launch time.  This is only ever true if privateBrowsingEnabled is also true. Read only.
lastChangedByCommandLinebooleanIndicates 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.
privateBrowsingEnabledbooleanIndicates 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.

Methods

removeDataFromDomain()

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

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

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:43 次

字数:5125

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文