--- a/suite/common/dataman/dataman.js
+++ b/suite/common/dataman/dataman.js
@@ -35,25 +35,16 @@
*
* ***** END LICENSE BLOCK ***** */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
// locally loaded services
var gLocSvc = {};
-XPCOMUtils.defineLazyServiceGetter(gLocSvc, "eTLD",
- "@mozilla.org/network/effective-tld-service;1",
- "nsIEffectiveTLDService");
-XPCOMUtils.defineLazyServiceGetter(gLocSvc, "cookie",
- "@mozilla.org/cookiemanager;1",
- "nsICookieManager2");
-XPCOMUtils.defineLazyServiceGetter(gLocSvc, "pwd",
- "@mozilla.org/login-manager;1",
- "nsILoginManager");
XPCOMUtils.defineLazyServiceGetter(gLocSvc, "date",
"@mozilla.org/intl/scriptabledateformat;1",
"nsIScriptableDateFormat");
XPCOMUtils.defineLazyServiceGetter(gLocSvc, "fhist",
"@mozilla.org/satchel/form-history;1",
"nsIFormHistory2");
XPCOMUtils.defineLazyServiceGetter(gLocSvc, "url",
"@mozilla.org/network/url-parser;1?auth=maybe",
@@ -297,17 +288,17 @@ var gDomains = {
}
gDomains.ignoreUpdate = false;
gDomains.search(gDomains.searchfield.value);
yield setTimeout(nextStep, 0);
// Add domains for password rejects to permissions.
gDataman.debugMsg("Add pwd reject permissions to domain list: " + Date.now()/1000);
gDomains.ignoreUpdate = true;
- let rejectHosts = gLocSvc.pwd.getAllDisabledHosts();
+ let rejectHosts = Services.logins.getAllDisabledHosts();
for (let i = 0; i < rejectHosts.length; i++)
gDomains.addDomainOrFlag(rejectHosts[i], "hasPermissions");
gDomains.ignoreUpdate = false;
gDomains.search(gDomains.searchfield.value);
yield setTimeout(nextStep, 0);
// Add domains for content prefs.
gDataman.debugMsg("Add content prefs to domain list: " + Date.now()/1000);
@@ -460,17 +451,17 @@ var gDomains = {
pathPos, pathLen);
var auth = aHostname.substring(authPos.value, authPos.value + authLen.value);
gLocSvc.url.parseAuthority(auth, authLen.value, usernamePos, usernameLen,
passwordPos, passwordLen, hostnamePos, hostnameLen, port);
var hostName = auth.substring(hostnamePos.value, hostnamePos.value + hostnameLen.value);
var domain;
try {
- domain = gLocSvc.eTLD.getBaseDomainFromHost(hostName);
+ domain = Services.eTLD.getBaseDomainFromHost(hostName);
}
catch (e) {
domain = hostName;
}
this.xlcache[aHostname] = domain;
gDataman.debugMsg("cached: " + aHostname + " -> " + this.xlcache[aHostname]);
}
return this.xlcache[aHostname];
@@ -838,17 +829,17 @@ var gCookies = {
gDataman.debugMsg("Shutting down cookies panel");
this.tree.view.selection.clearSelection();
this.tree.view = null;
this.displayedCookies = [];
},
loadList: function cookies_loadList() {
this.cookies = [];
- let enumerator = gLocSvc.cookie.enumerator;
+ let enumerator = Services.cookies.enumerator;
while (enumerator.hasMoreElements()) {
let nextCookie = enumerator.getNext();
if (!nextCookie) break;
nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie2);
this.cookies.push(this._makeCookieObject(nextCookie));
}
},
@@ -1019,18 +1010,18 @@ var gCookies = {
this.tree.view.selection.clearSelection();
// Loop backwards so later indexes in the list don't change.
for (let i = selections.length - 1; i >= 0; i--) {
let delCookie = this.displayedCookies[selections[i]];
this.cookies.splice(this.cookies.indexOf(this.displayedCookies[selections[i]]), 1);
this.displayedCookies.splice(selections[i], 1);
this.tree.treeBoxObject.rowCountChanged(selections[i], -1);
- gLocSvc.cookie.remove(delCookie.host, delCookie.name, delCookie.path,
- this.blockOnRemove.checked);
+ Services.cookies.remove(delCookie.host, delCookie.name, delCookie.path,
+ this.blockOnRemove.checked);
}
if (!this.displayedCookies.length)
gDomains.removeDomainOrFlag(gDomains.selectedDomain.title, "hasCookies");
// Select the entry after the first deleted one or the last of all entries.
if (selections.length && this.displayedCookies.length)
this.tree.view.selection.toggleSelect(selections[0] < this.displayedCookies.length ?
selections[0] :
this.displayedCookies.length - 1);
@@ -1140,18 +1131,18 @@ var gCookies = {
}
}
}
},
forget: function cookies_forget() {
for (let i = 0; i < this.cookies.length; i++) {
if (gDomains.hostMatchesSelected(this.cookies[i].rawHost)) {
- gLocSvc.cookie.remove(this.cookies[i].host, this.cookies[i].name,
- this.cookies[i].path, false);
+ Services.cookies.remove(this.cookies[i].host, this.cookies[i].name,
+ this.cookies[i].path, false);
this.cookies.splice(i, 1);
}
}
gDomains.removeDomainOrFlag(gDomains.selectedDomain.title, "hasCookies");
},
// nsITreeView
__proto__: gBaseTreeView,
@@ -1196,17 +1187,17 @@ var gPerms = {
permElem.setAttribute("displayHost",
gLocSvc.idn.convertToDisplayIDN(rawHost, {}));
permElem.setAttribute("capability", nextPermission.capability);
permElem.setAttribute("class", "permission");
this.list.appendChild(permElem);
}
}
// Visually treat password rejects like permissions.
- let rejectHosts = gLocSvc.pwd.getAllDisabledHosts();
+ let rejectHosts = Services.logins.getAllDisabledHosts();
for (let i = 0; i < rejectHosts.length; i++) {
if (gDomains.hostMatchesSelected(rejectHosts[i])) {
let permElem = document.createElement("richlistitem");
let rawHost = gDomains.getDomainFromHost(rejectHosts[i]);
permElem.setAttribute("type", "password");
permElem.setAttribute("host", rejectHosts[i]);
permElem.setAttribute("rawHost", rawHost);
permElem.setAttribute("displayHost",
@@ -1334,17 +1325,17 @@ var gPerms = {
let haveDomainPerms = false;
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext();
nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
if (domain == gDomains.getDomainFromHost(nextPermission.host.replace(/^\./, "")))
haveDomainPerms = true;
}
- let rejectHosts = gLocSvc.pwd.getAllDisabledHosts();
+ let rejectHosts = Services.logins.getAllDisabledHosts();
for (let i = 0; i < rejectHosts.length; i++) {
if (domain == gDomains.getDomainFromHost(rejectHosts[i]))
haveDomainPerms = true;
}
if (!haveDomainPerms)
gDomains.removeDomainOrFlag(domain, "hasPermissions");
}
}
@@ -1368,17 +1359,17 @@ var gPerms = {
}
}
else {
// aData: added, changed, deleted, cleared
// See http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIPermissionManager.idl
if (aData == "cleared") {
let domainList = [];
// Blocked passwords still belong in the list.
- let rejectHosts = gLocSvc.pwd.getAllDisabledHosts();
+ let rejectHosts = Services.logins.getAllDisabledHosts();
for (let i = 0; i < rejectHosts.length; i++) {
let dom = gDomains.getDomainFromHost(rejectHosts[i]);
if (domainList.indexOf(dom) == -1)
domainList.push(dom);
}
gDomains.resetFlagToDomains("hasPermissions", domainList);
return;
}
@@ -1406,17 +1397,17 @@ var gPerms = {
let haveDomainPerms = false;
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext();
nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
if (domain == gDomains.getDomainFromHost(nextPermission.host.replace(/^\./, "")))
haveDomainPerms = true;
}
- let rejectHosts = gLocSvc.pwd.getAllDisabledHosts();
+ let rejectHosts = Services.logins.getAllDisabledHosts();
for (let i = 0; i < rejectHosts.length; i++) {
if (domain == gDomains.getDomainFromHost(rejectHosts[i]))
haveDomainPerms = true;
}
if (!haveDomainPerms)
gDomains.removeDomainOrFlag(domain, "hasPermissions");
}
}
@@ -1456,20 +1447,20 @@ var gPerms = {
if (gDomains.hostMatchesSelected(host.replace(/^\./, ""))) {
delPerms.push({host: host, type: nextPermission.type});
}
}
for (let i = 0; i < delPerms.length; i++) {
Services.perms.remove(delPerms[i].host, delPerms[i].type);
}
// Also remove all password rejects.
- let rejectHosts = gLocSvc.pwd.getAllDisabledHosts();
+ let rejectHosts = Services.logins.getAllDisabledHosts();
for (let i = 0; i < rejectHosts.length; i++) {
if (gDomains.hostMatchesSelected(rejectHosts[i])) {
- gLocSvc.pwd.setLoginSavingEnabled(rejectHosts[i], true);
+ Services.logins.setLoginSavingEnabled(rejectHosts[i], true);
}
}
gDomains.removeDomainOrFlag(gDomains.selectedDomain.title, "hasPermissions");
},
};
// :::::::::::::::::::: content prefs panel ::::::::::::::::::::
var gPrefs = {
@@ -1822,17 +1813,17 @@ var gPasswords = {
if (this.showPasswords)
this.togglePasswordVisible();
this.tree.view.selection.clearSelection();
this.tree.view = null;
this.displayedSignons = [];
},
loadList: function passwords_loadList() {
- this.allSignons = gLocSvc.pwd.getAllLogins();
+ this.allSignons = Services.logins.getAllLogins();
},
_getObjID: function passwords__getObjID(aIdx) {
var curSignon = gPasswords.displayedSignons[aIdx];
return curSignon.hostname + "|" + curSignon.httpRealm + "|" + curSignon.username;
},
select: function passwords_select() {
@@ -1927,17 +1918,17 @@ var gPasswords = {
this.tree.view.selection.clearSelection();
// Loop backwards so later indexes in the list don't change.
for (let i = selections.length - 1; i >= 0; i--) {
let delSignon = this.displayedSignons[selections[i]];
this.allSignons.splice(this.allSignons.indexOf(this.displayedSignons[selections[i]]), 1);
this.displayedSignons.splice(selections[i], 1);
this.tree.treeBoxObject.rowCountChanged(selections[i], -1);
- gLocSvc.pwd.removeLogin(delSignon);
+ Services.logins.removeLogin(delSignon);
}
if (!this.displayedSignons.length)
gDomains.removeDomainOrFlag(gDomains.selectedDomain.title, "hasPasswords");
// Select the entry after the first deleted one or the last of all entries.
if (selections.length && this.displayedSignons.length)
this.tree.view.selection.toggleSelect(selections[0] < this.displayedSignons.length ?
selections[0] :
this.displayedSignons.length - 1);
@@ -2109,17 +2100,17 @@ var gPasswords = {
}
}
}
},
forget: function passwords_forget() {
for (let i = 0; i < this.allSignons.length; i++) {
if (gDomains.hostMatchesSelected(this.allSignons[i].hostname)) {
- gLocSvc.pwd.removeLogin(this.allSignons[i]);
+ Services.logins.removeLogin(this.allSignons[i]);
this.allSignons.splice(i, 1);
}
}
gDomains.removeDomainOrFlag(gDomains.selectedDomain.title, "hasPasswords");
},
// nsITreeView
__proto__: gBaseTreeView,
--- a/suite/common/dataman/tests/browser_dataman_basics.js
+++ b/suite/common/dataman/tests/browser_dataman_basics.js
@@ -3,22 +3,18 @@
*/
// Test basic functionality of the data manager.
Components.utils.import("resource://gre/modules/Services.jsm");
// Happens to match what's used in Data Manager itself.
var gLocSvc = {
- cookie: Components.classes["@mozilla.org/cookiemanager;1"]
- .getService(Components.interfaces.nsICookieManager2),
fhist: Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory2),
- pwd: Components.classes["@mozilla.org/login-manager;1"]
- .getService(Components.interfaces.nsILoginManager),
idn: Components.classes["@mozilla.org/network/idn-service;1"]
.getService(Components.interfaces.nsIIDNService),
};
const DATAMAN_LOADED = "dataman-loaded";
const TEST_DONE = "dataman-test-done";
var gPreexistingDomains = 10;
@@ -32,47 +28,47 @@ function test() {
// bank2.com, example.com, example.org, mochi.test, mozilla.com, test,
// xn--exmple-cua.test, xn--hxajbheg2az3al.xn--jxalpdlp
// We should not touch those permissions so other tests can run, which means
// we should avoid using those domains altogether as we can't remove them.
let now_epoch = parseInt(Date.now() / 1000);
// Add cookie: not secure, non-HTTPOnly, session
- gLocSvc.cookie.add("bar.geckoisgecko.org", "", "name0", "value0",
- false, false, true, now_epoch + 600);
+ Services.cookies.add("bar.geckoisgecko.org", "", "name0", "value0",
+ false, false, true, now_epoch + 600);
// Add cookie: not secure, HTTPOnly, session
- gLocSvc.cookie.add("foo.geckoisgecko.org", "", "name1", "value1",
- false, true, true, now_epoch + 600);
+ Services.cookies.add("foo.geckoisgecko.org", "", "name1", "value1",
+ false, true, true, now_epoch + 600);
// Add cookie: secure, HTTPOnly, session
- gLocSvc.cookie.add("secure.geckoisgecko.org", "", "name2", "value2",
- true, true, true, now_epoch + 600);
+ Services.cookies.add("secure.geckoisgecko.org", "", "name2", "value2",
+ true, true, true, now_epoch + 600);
// Add cookie: secure, non-HTTPOnly, expiry in an hour
- gLocSvc.cookie.add("drumbeat.org", "", "name3", "value3",
- true, false, false, now_epoch + 3600);
+ Services.cookies.add("drumbeat.org", "", "name3", "value3",
+ true, false, false, now_epoch + 3600);
// Add a few form history entries
gLocSvc.fhist.addEntry("akey", "value0");
gLocSvc.fhist.addEntry("ekey", "value1");
gLocSvc.fhist.addEntry("ekey", "value2");
gLocSvc.fhist.addEntry("bkey", "value3");
gLocSvc.fhist.addEntry("bkey", "value4");
gLocSvc.fhist.addEntry("ckey", "value5");
// Add a few passwords
let loginInfo1 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
.createInstance(Components.interfaces.nsILoginInfo);
loginInfo1.init("http://www.geckoisgecko.org", "http://www.geckoisgecko.org", null,
"dataman", "mysecret", "user", "pwd");
- gLocSvc.pwd.addLogin(loginInfo1);
+ Services.logins.addLogin(loginInfo1);
let loginInfo2 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
.createInstance(Components.interfaces.nsILoginInfo);
loginInfo2.init("gopher://geckoisgecko.org:4711", null, "foo",
"dataman", "mysecret", "", "");
- gLocSvc.pwd.addLogin(loginInfo2);
+ Services.logins.addLogin(loginInfo2);
//Services.prefs.setBoolPref("data_manager.debug", true);
gBrowser.addTab();
// Open the Data Manager, testing the menu item.
document.getElementById("tasksDataman").click();
var testIndex = 0;
@@ -93,17 +89,17 @@ function test() {
// TEST_DONE triggered, run next test
info("run test #" + (testIndex + 1) + " of " + testFuncs.length +
" (" + testFuncs[testIndex].name + ")");
testFuncs[testIndex++](win);
if (testIndex >= testFuncs.length) {
// Finish this up!
Services.obs.removeObserver(testObs, TEST_DONE);
- gLocSvc.cookie.removeAll();
+ Services.cookies.removeAll();
gLocSvc.fhist.removeAllEntries();
finish();
}
}
}
};
waitForExplicitFinish();
Services.obs.addObserver(testObs, DATAMAN_LOADED, false);
@@ -299,17 +295,17 @@ function test_permissions_panel(aWin) {
Services.perms.add(Services.io.newURI("http://install.getpersonas.com/", null, null),
"install", Services.perms.ALLOW_ACTION);
Services.perms.add(Services.io.newURI("http://popup.getpersonas.com/", null, null),
"popup", Services.perms.ALLOW_ACTION);
Services.perms.add(Services.io.newURI("http://test.getpersonas.com/", null, null),
"test", Services.perms.DENY_ACTION);
Services.perms.add(Services.io.newURI("http://xul.getpersonas.com/", null, null),
"allowXULXBL", Services.perms.ALLOW_ACTION);
- gLocSvc.pwd.setLoginSavingEnabled("password.getpersonas.com", false);
+ Services.logins.setLoginSavingEnabled("password.getpersonas.com", false);
is(aWin.gPerms.list.children.length, 10,
"The correct number of permissions is displayed in the list");
for (let i = 1; i < aWin.gPerms.list.children.length; i++) {
let perm = aWin.gPerms.list.children[i];
switch (perm.type) {
case "allowXULXBL":
is(perm.getAttribute("label"), "Use XUL/XBL Markup",
"Correct label for type: " + perm.type);
@@ -613,18 +609,18 @@ function test_passwords_panel(aWin) {
},
function test_idn(aWin) {
// Use a domain with an existing permission.
let testDomain = "xn--hxajbheg2az3al.xn--jxalpdlp";
let idnDomain = gLocSvc.idn.convertToDisplayIDN(testDomain, {});
isnot(testDomain, idnDomain, "Using a valid IDN domain");
// Add IDN cookie.
- gLocSvc.cookie.add(testDomain, "", "name0", "value0",
- false, false, true, parseInt(Date.now() / 1000) + 600);
+ Services.cookies.add(testDomain, "", "name0", "value0",
+ false, false, true, parseInt(Date.now() / 1000) + 600);
aWin.document.getElementById("domainSearch").value = "xn--";
aWin.document.getElementById("domainSearch").doCommand();
is(aWin.gDomains.tree.view.rowCount, 1,
"Search for 'xn--' returns one result");
is(aWin.gDomains.displayedDomains.map(function(aDom) { return aDom.title; })
.join(","),
"xn--exmple-cua.test", "In xn-- search, only the non-decodable domain is listed");
@@ -678,17 +674,17 @@ function test_idn(aWin) {
is(aWin.gTabs.activePanel, "permissionsPanel",
"After deleting, correctly switched back to permissions panel");
// Add IDN password (usually have encoded names)
let loginInfo1 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
.createInstance(Components.interfaces.nsILoginInfo);
loginInfo1.init("http://" + idnDomain, "http://" + idnDomain, null,
"dataman", "mysecret", "user", "pwd");
- gLocSvc.pwd.addLogin(loginInfo1);
+ Services.logins.addLogin(loginInfo1);
aWin.gTabs.tabbox.selectedTab = aWin.document.getElementById("passwordsTab");
is(aWin.gTabs.activePanel, "passwordsPanel",
"Successfully switched to passwords panel for IDN tests");
is(aWin.gPasswords.tree.view.getCellText(0, aWin.gPasswords.tree.columns["pwdHostCol"]),
"http://" + idnDomain,
"Correct domain displayed for IDN password");
aWin.gPasswords.tree.view.selection.select(0);
aWin.document.getElementById("pwdRemove").click();
--- a/suite/common/dataman/tests/browser_dataman_callviews.js
+++ b/suite/common/dataman/tests/browser_dataman_callviews.js
@@ -1,35 +1,29 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test loading views in data manager.
Components.utils.import("resource://gre/modules/Services.jsm");
-// Happens to match what's used in Data Manager itself.
-var gLocSvc = {
- cookie: Components.classes["@mozilla.org/cookiemanager;1"]
- .getService(Components.interfaces.nsICookieManager2),
-};
-
const DATAMAN_LOADED = "dataman-loaded";
// See browser_dataman_basics.js.
const kPreexistingDomains = 10;
var testIndex = 0;
function test() {
// Add cookies.
- gLocSvc.cookie.add("getpersonas.com", "", "name0", "value0",
- false, false, true, parseInt(Date.now() / 1000) + 600);
- gLocSvc.cookie.add("drumbeat.org", "", "name1", "value1",
- false, false, true, parseInt(Date.now() / 1000) + 600);
+ Services.cookies.add("getpersonas.com", "", "name0", "value0",
+ false, false, true, parseInt(Date.now() / 1000) + 600);
+ Services.cookies.add("drumbeat.org", "", "name1", "value1",
+ false, false, true, parseInt(Date.now() / 1000) + 600);
//Services.prefs.setBoolPref("data_manager.debug", true);
var win;
gBrowser.addTab();
toDataManager("example.org");
@@ -43,18 +37,18 @@ function test() {
ok(true, "Step " + (testIndex + 1) + ": Data Manager is loaded");
win = content.wrappedJSObject;
testFuncs[testIndex++](win);
if (testIndex >= testFuncs.length) {
// Finish this up!
Services.obs.removeObserver(testObs, DATAMAN_LOADED);
- gLocSvc.cookie.remove("getpersonas.com", "name0", "value0", false);
- gLocSvc.cookie.remove("drumbeat.org", "name1", "value1", false);
+ Services.cookies.remove("getpersonas.com", "name0", "value0", false);
+ Services.cookies.remove("drumbeat.org", "name1", "value1", false);
finish();
}
}
}
};
waitForExplicitFinish();
Services.obs.addObserver(testObs, DATAMAN_LOADED, false);
}
--- a/suite/common/history/history.js
+++ b/suite/common/history/history.js
@@ -40,17 +40,16 @@
* ***** END LICENSE BLOCK ***** */
var gHistoryTree;
var gLastHostname;
var gLastDomain;
var gSearchBox;
var gPrefService;
var gIOService;
-var gETLDService;
var gDeleteByHostname;
var gDeleteByDomain;
var gHistoryStatus;
var gHistoryGrouping = "day";
function HistoryCommonInit()
{
gHistoryTree = document.getElementById("historyTree");
@@ -103,21 +102,17 @@ function historyOnSelect()
.getService(Components.interfaces.nsIIOService);
gLastHostname = gIOService.newURI(url, null, null).host;
} catch (e) {}
} else if (PlacesUtils.nodeIsHost(selectedNode)) {
gLastHostname = selectedNode.title;
}
if (gLastHostname) {
try {
- if (!gETLDService)
- gETLDService =
- Components.classes["@mozilla.org/network/effective-tld-service;1"]
- .getService(Components.interfaces.nsIEffectiveTLDService);
- gLastDomain = gETLDService.getBaseDomainFromHost(gLastHostname);
+ gLastDomain = Services.eTLD.getBaseDomainFromHost(gLastHostname);
} catch (e) {}
}
}
if (gHistoryStatus)
gHistoryStatus.label = url;
updateHistoryCommands();
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -124,19 +124,16 @@ const TAB_EVENTS = ["TabOpen", "TabClose
#ifndef XP_WIN
#define BROKEN_WM_Z_ORDER
#endif
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
-XPCOMUtils.defineLazyServiceGetter(this, "cm",
- "@mozilla.org/cookiemanager;1", "nsICookieManager2");
-
#ifdef MOZ_CRASH_REPORTER
XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
"@mozilla.org/xre/app-info;1", "nsICrashReporter");
#endif
XPCOMUtils.defineLazyServiceGetter(this, "SecMan",
"@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager");
@@ -2018,17 +2015,17 @@ SessionStoreService.prototype = {
var jscookies = {};
var _this = this;
// MAX_EXPIRY should be 2^63-1, but JavaScript can't handle that precision
var MAX_EXPIRY = Math.pow(2, 62);
aWindows.forEach(function(aWindow) {
if (!aWindow._hosts)
return;
for (var [host, isPinned] in Iterator(aWindow._hosts)) {
- var list = cm.getCookiesFromHost(host);
+ var list = Services.cookies.getCookiesFromHost(host);
while (list.hasMoreElements()) {
var cookie = list.getNext().QueryInterface(Components.interfaces.nsICookie2);
// aWindow._hosts will only have hosts with the right privacy rules,
// so there is no need to do anything special with this call to
// _checkPrivacyLevel.
if (cookie.isSession && _this._checkPrivacyLevel(cookie.isSecure, isPinned)) {
// use the cookie's host, path, and name as keys into a hash,
// to make sure we serialize each cookie only once
@@ -3073,19 +3070,20 @@ SessionStoreService.prototype = {
* Array of cookie objects
*/
restoreCookies: function sss_restoreCookies(aCookies) {
// MAX_EXPIRY should be 2^63-1, but JavaScript can't handle that precision
var MAX_EXPIRY = Math.pow(2, 62);
for (let i = 0; i < aCookies.length; i++) {
var cookie = aCookies[i];
try {
- cm.add(cookie.host, cookie.path || "", cookie.name || "",
- cookie.value, !!cookie.secure, !!cookie.httponly, true,
- "expiry" in cookie ? cookie.expiry : MAX_EXPIRY);
+ Services.cookies.add(cookie.host, cookie.path || "", cookie.name || "",
+ cookie.value, !!cookie.secure, !!cookie.httponly,
+ true,
+ "expiry" in cookie ? cookie.expiry : MAX_EXPIRY);
}
catch (ex) { Components.utils.reportError(ex); } // don't let a single cookie stop recovering
}
},
/* ........ Disk Access .............. */
/**