Bug 910167 - Remove remaining uses of nsISessionStore in browser/base/. r=dao

This commit is contained in:
Georgiana Chelu 2013-08-29 08:58:29 +02:00
parent 7335496ced
commit a20be101c5
5 changed files with 12 additions and 23 deletions

View File

@ -480,9 +480,6 @@ function HistoryMenu(aPopupShowingEvent) {
// Defining the prototype inheritance in the prototype itself would cause
// browser.js to halt on "PlacesMenu is not defined" error.
this.__proto__.__proto__ = PlacesMenu.prototype;
XPCOMUtils.defineLazyServiceGetter(this, "_ss",
"@mozilla.org/browser/sessionstore;1",
"nsISessionStore");
PlacesMenu.call(this, aPopupShowingEvent,
"place:sort=4&maxResults=15");
}
@ -493,7 +490,7 @@ HistoryMenu.prototype = {
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
// no restorable tabs, so disable menu
if (this._ss.getClosedTabCount(window) == 0)
if (SessionStore.getClosedTabCount(window) == 0)
undoMenu.setAttribute("disabled", true);
else
undoMenu.removeAttribute("disabled");
@ -525,7 +522,7 @@ HistoryMenu.prototype = {
undoPopup.removeChild(undoPopup.firstChild);
// no restorable tabs, so make sure menu is disabled, and return
if (this._ss.getClosedTabCount(window) == 0) {
if (SessionStore.getClosedTabCount(window) == 0) {
undoMenu.setAttribute("disabled", true);
return;
}
@ -534,7 +531,7 @@ HistoryMenu.prototype = {
undoMenu.removeAttribute("disabled");
// populate menu
var undoItems = JSON.parse(this._ss.getClosedTabData(window));
var undoItems = JSON.parse(SessionStore.getClosedTabData(window));
for (var i = 0; i < undoItems.length; i++) {
var m = document.createElement("menuitem");
m.setAttribute("label", undoItems[i].title);
@ -580,7 +577,7 @@ HistoryMenu.prototype = {
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
// no restorable windows, so disable menu
if (this._ss.getClosedWindowCount() == 0)
if (SessionStore.getClosedWindowCount() == 0)
undoMenu.setAttribute("disabled", true);
else
undoMenu.removeAttribute("disabled");
@ -601,7 +598,7 @@ HistoryMenu.prototype = {
undoPopup.removeChild(undoPopup.firstChild);
// no restorable windows, so make sure menu is disabled, and return
if (this._ss.getClosedWindowCount() == 0) {
if (SessionStore.getClosedWindowCount() == 0) {
undoMenu.setAttribute("disabled", true);
return;
}
@ -610,7 +607,7 @@ HistoryMenu.prototype = {
undoMenu.removeAttribute("disabled");
// populate menu
let undoItems = JSON.parse(this._ss.getClosedWindowData());
let undoItems = JSON.parse(SessionStore.getClosedWindowData());
for (let i = 0; i < undoItems.length; i++) {
let undoItem = undoItems[i];
let otherTabsCount = undoItem.tabs.length - 1;

View File

@ -67,15 +67,13 @@ let TabView = {
if (this.firstUseExperienced) {
// ___ visibility
let sessionstore =
Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
let data = SessionStore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
if (data && data == "true") {
this.show();
} else {
try {
data = sessionstore.getWindowValue(window, this.GROUPS_IDENTIFIER);
data = SessionStore.getWindowValue(window, this.GROUPS_IDENTIFIER);
if (data) {
let parsedData = JSON.parse(data);
this.updateGroupNumberBroadcaster(parsedData.totalNumber || 1);

View File

@ -1,7 +1,5 @@
function numClosedTabs()
Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore).
getClosedTabCount(window);
SessionStore.getClosedTabCount(window);
function isUndoCloseEnabled() {
updateTabContextMenu();

View File

@ -1,8 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const ss = Cc["@mozilla.org/browser/sessionstore;1"]
.getService(Ci.nsISessionStore);
const URL = "http://mochi.test:8888/browser/";
const PREF = "browser.sessionstore.restore_on_demand";
@ -36,12 +34,12 @@ function preparePendingTab(aCallback) {
let tab = gBrowser.addTab(URL);
whenLoaded(tab.linkedBrowser, function () {
let state = ss.getTabState(tab);
let state = SessionStore.getTabState(tab);
gBrowser.removeTab(tab);
tab = gBrowser.addTab("about:blank");
whenLoaded(tab.linkedBrowser, function () {
ss.setTabState(tab, state);
SessionStore.setTabState(tab, state);
ok(tab.hasAttribute("pending"), "tab should be pending");
aCallback(tab);
});

View File

@ -1,7 +1,5 @@
function numClosedTabs()
Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore).
getNumberOfTabsClosedLast(window);
SessionStore.getNumberOfTabsClosedLast(window);
var originalTab;
var tab1Loaded = false;