Skip to content
Permalink
Browse files

Use SessionStore.jsm instead of nsISessionStore in Firefox 61+

  • Loading branch information...
Infocatcher committed Apr 7, 2018
1 parent 23c436d commit da2f5aa540a0681e3521e94828ce15a73049e553
@@ -213,10 +213,12 @@ function processAddonsTab(e) {
else {
gBrowser.removeTab(tab);
(function forgetClosedTab(isSecondTry) {
var ss = (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore);
var ss = "nsISessionStore" in Components.interfaces
? (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore)
: SessionStore; // Firefox 61+ https://bugzilla.mozilla.org/show_bug.cgi?id=1450559
if(!("forgetClosedTab" in ss))
return;
var closedTabs = JSON.parse(ss.getClosedTabData(window));
@@ -212,10 +212,12 @@ function getStdImage(iid) {

function initSessionStore() {
initSessionStore = function() {};
var ss = (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore);
var ss = "nsISessionStore" in Components.interfaces
? (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore)
: SessionStore; // Firefox 61+ https://bugzilla.mozilla.org/show_bug.cgi?id=1450559
ss.persistTabAttribute(cbIdTabAttr);
}
function checkTab(tab) {
@@ -352,7 +352,7 @@ var cmds = this.commands = {
get ss() {
delete this.ss;
if(!("nsISessionStore" in Components.interfaces)) // Thunderbird
return this.ss = null;
return this.ss = window.SessionStore || null; // Firefox 61+ https://bugzilla.mozilla.org/show_bug.cgi?id=1450559
return this.ss = (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
@@ -130,10 +130,12 @@ this.historyManager = {
_forceSaveSessionTimer: 0,
forceSaveSession: function() {
const key = "custombuttonsPurgeTabHistoryForceSaveSession";
var ss = ( // Firefox or SeaMonkey
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore);
var ss = "nsISessionStore" in Components.interfaces
? (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore)
: SessionStore; // Firefox 61+ https://bugzilla.mozilla.org/show_bug.cgi?id=1450559
ss.setWindowValue(window, key, "" + Date.now());
clearTimeout(this._forceSaveSessionTimer);
this._forceSaveSessionTimer = setTimeout(function() {
@@ -294,10 +294,12 @@ this.bookmarks = {

get ss() {
delete this.ss;
return this.ss = (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore);
return this.ss = "nsISessionStore" in Components.interfaces
? (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore)
: SessionStore; // Firefox 61+ https://bugzilla.mozilla.org/show_bug.cgi?id=1450559
},
get ios() {
delete this.ios;
@@ -115,7 +115,10 @@ function _localize(sid) {
}
};
var locale = (function() {
if("Services" in window && Services.locale && Services.locale.getRequestedLocales) { var locales = Services.locale.getRequestedLocales(); return locales && locales[0]; }
if("Services" in window && Services.locale && Services.locale.getRequestedLocales) {
var locales = Services.locale.getRequestedLocales();
return locales && locales[0];
}
var prefs = "Services" in window && Services.prefs
|| Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
@@ -316,10 +319,12 @@ this.undoCloseTabsList = {
},
get ss() {
delete this.ss;
return this.ss = (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore);
return this.ss = "nsISessionStore" in Components.interfaces
? (
Components.classes["@mozilla.org/browser/sessionstore;1"]
|| Components.classes["@mozilla.org/suite/sessionstore;1"]
).getService(Components.interfaces.nsISessionStore)
: SessionStore; // Firefox 61+ https://bugzilla.mozilla.org/show_bug.cgi?id=1450559
},
get appInfo() {
delete this.appInfo;

0 comments on commit da2f5aa

Please sign in to comment.
You can’t perform that action at this time.