Skip to content

Commit

Permalink
Refactor: add this.oldSessionStore lazy getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Aug 11, 2014
1 parent b995769 commit 4dbd2e9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bootstrap.js
Expand Up @@ -50,7 +50,7 @@ var privateTab = {
for(var window in this.windows)
this.initWindow(window, reason);
Services.ww.registerNotification(this);
if(this.platformVersion < 29 || this.isSeaMonkey) // See https://bugzilla.mozilla.org/show_bug.cgi?id=899276
if(this.oldSessionStore)
Services.obs.addObserver(this, "sessionstore-state-write", false);
else if(
window
Expand Down Expand Up @@ -78,7 +78,7 @@ var privateTab = {

if(reason != APP_SHUTDOWN) {
// nsISessionStore may save data after our shutdown
if(this.platformVersion < 29 || this.isSeaMonkey)
if(this.oldSessionStore)
Services.obs.removeObserver(this, "sessionstore-state-write");
else
this.dontSaveClosedPrivateTabs(false);
Expand Down Expand Up @@ -1247,11 +1247,7 @@ var privateTab = {
this.cleanupClosedTab(e);
},
tabClosingHandler: function(e) {
if(
this.platformVersion < 29
|| this.isSeaMonkey
|| !prefs.get("rememberClosedPrivateTabs")
)
if(this.oldSessionStore || !prefs.get("rememberClosedPrivateTabs"))
return;
var tab = e.originalTarget || e.target;
if(!tab.hasAttribute(this.privateAttr))
Expand Down Expand Up @@ -1358,7 +1354,7 @@ var privateTab = {
+ "\nTry don't save it in undo close history"
);
var silentFail = false;
if(this.platformVersion >= 29) // See https://bugzilla.mozilla.org/show_bug.cgi?id=899276
if(!this.oldSessionStore)
silentFail = true;
else if(e.detail) {
_log("Tab moved to another window");
Expand Down Expand Up @@ -3745,6 +3741,10 @@ var privateTab = {
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore);
},
get oldSessionStore() { // See https://bugzilla.mozilla.org/show_bug.cgi?id=899276
delete this.oldSessionStore;
return this.oldSessionStore = this.platformVersion < 29 || this.isSeaMonkey;
},

_stylesLoaded: false,
loadStyles: function(window) {
Expand Down

0 comments on commit 4dbd2e9

Please sign in to comment.