1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 22:08:00 +01:00

Don't save storage objects while in private mode, restore them on exit.

This commit is contained in:
Kris Maglione
2009-06-28 14:37:23 -04:00
parent 3f5dd13453
commit 55164325df
10 changed files with 95 additions and 38 deletions

View File

@@ -13,9 +13,7 @@
{ arg: true, count: true, motion: true, route: true });
* IMPORTANT: shifted key notation now matches Vim's behaviour. E.g. <C-a>
and <C-A> are equivalent, to map the uppercase character use <C-S-A>. - Is this still true, or going to be true? --djk
* add 'private' - enter private browsing mode IMPORTANT: this doesn't
currently cause Vimperator-specific data like command-line history to be
purged.
* add 'private' - enter private browsing mode
* add -description option to :command
* command-line options are now supported via the host application's
-liberator option

View File

@@ -478,9 +478,9 @@ const config = { //{{{
});
// only available in FF 3.5
if (Ci.nsIPrivateBrowsingService)
services.add("privateBrowsing", "@mozilla.org/privatebrowsing;1", Ci.nsIPrivateBrowsingService);
if (services.get("privateBrowsing"))
{
services.add("privateBrowsing", "@mozilla.org/privatebrowsing;1", Ci.nsIPrivateBrowsingService);
options.add(["private", "pornmode"],
"Set the 'private browsing' option",
"boolean", false,
@@ -494,6 +494,27 @@ const config = { //{{{
return services.get("privateBrowsing").privateBrowsingEnabled;
}
});
let services = modules.services; // Storage objects are global to all windows, 'modules' isn't.
storage.newObject("private-mode-observer", function () {
({
init: function () {
services.get("observer").addObserver(this, "private-browsing", false);
services.get("observer").addObserver(this, "quit-application", false);
this.private = services.get("privateBrowsing").privateBrowsingEnabled;
},
observe: function (subject, topic, data) {
if (topic == "private-browsing") {
if (data == "enter")
storage.privateMode = true;
else if (data == "exit")
storage.privateMode = false;
} else if (topic == "quit-application") {
services.get("observer").removeObserver(this, "quit-application");
services.get("observer").removeObserver(this, "private-browsing");
}
},
}).init();
}, false);
}
// TODO: merge with Vimperator version and add Muttator version
@@ -508,7 +529,7 @@ const config = { //{{{
elem.setAttribute("titlemodifier", value);
// TODO: remove this FF3.5 test when we no longer support 3.0
if (Ci.nsIPrivateBrowsingService)
if (services.get("privateBrowsing"))
{
elem.setAttribute("titlemodifier_privatebrowsing", value);
elem.setAttribute("titlemodifier_normal", value);

View File

@@ -453,9 +453,6 @@ files, cookies, form data, passwords, and download list entries are available
only for the duration of the private browsing session and deleted when
returning to normal browsing mode.
Warning: Vimperator specific data like command-line history is not yet purged
when exiting private browsing mode.
Note: this is only available in FF 3.5.
____