зеркало из https://github.com/mozilla/gecko-dev.git
Bug 648364 - Replace custom helpers with Services.jsm. r=rnewman
This commit is contained in:
Родитель
0f688c35f5
Коммит
a85e5bfc44
|
@ -867,7 +867,7 @@ var gSyncSetup = {
|
|||
}
|
||||
|
||||
if (Weave.Engines.get("passwords").enabled) {
|
||||
let logins = Weave.Svc.Login.getAllLogins({});
|
||||
let logins = Services.logins.getAllLogins({});
|
||||
// Support %S for historical reasons (see bug 600141)
|
||||
document.getElementById("passwordCount").value =
|
||||
PluralForm.get(logins.length,
|
||||
|
|
|
@ -55,8 +55,8 @@ let gSyncUtils = {
|
|||
else if (thisDocEl.id == "BrowserPreferences" && !thisDocEl.instantApply)
|
||||
openUILinkIn(url, "window");
|
||||
else if (document.documentElement.id == "change-dialog")
|
||||
Weave.Svc.WinMediator.getMostRecentWindow("navigator:browser")
|
||||
.openUILinkIn(url, "tab");
|
||||
Services.wm.getMostRecentWindow("navigator:browser")
|
||||
.openUILinkIn(url, "tab");
|
||||
else
|
||||
openUILinkIn(url, "tab");
|
||||
},
|
||||
|
@ -69,7 +69,7 @@ let gSyncUtils = {
|
|||
|
||||
openChange: function openChange(type, duringSetup) {
|
||||
// Just re-show the dialog if it's already open
|
||||
let openedDialog = Weave.Svc.WinMediator.getMostRecentWindow("Sync:" + type);
|
||||
let openedDialog = Services.wm.getMostRecentWindow("Sync:" + type);
|
||||
if (openedDialog != null) {
|
||||
openedDialog.focus();
|
||||
return;
|
||||
|
@ -78,8 +78,8 @@ let gSyncUtils = {
|
|||
// Open up the change dialog
|
||||
let changeXUL = "chrome://browser/content/syncGenericChange.xul";
|
||||
let changeOpt = "centerscreen,chrome,resizable=no";
|
||||
Weave.Svc.WinWatcher.activeWindow.openDialog(changeXUL, "", changeOpt,
|
||||
type, duringSetup);
|
||||
Services.ww.activeWindow.openDialog(changeXUL, "", changeOpt,
|
||||
type, duringSetup);
|
||||
},
|
||||
|
||||
changePassword: function () {
|
||||
|
|
|
@ -77,8 +77,10 @@ PasswordEngine.prototype = {
|
|||
// Delete the weave credentials from the server once
|
||||
if (!Svc.Prefs.get("deletePwd", false)) {
|
||||
try {
|
||||
let ids = Svc.Login.findLogins({}, PWDMGR_HOST, "", "").map(function(info)
|
||||
info.QueryInterface(Components.interfaces.nsILoginMetaInfo).guid);
|
||||
let ids = Services.logins.findLogins({}, PWDMGR_HOST, "", "")
|
||||
.map(function(info) {
|
||||
return info.QueryInterface(Components.interfaces.nsILoginMetaInfo).guid;
|
||||
});
|
||||
let coll = new Collection(this.engineURL);
|
||||
coll.ids = ids;
|
||||
let ret = coll.delete();
|
||||
|
@ -97,8 +99,8 @@ PasswordEngine.prototype = {
|
|||
if (!login)
|
||||
return;
|
||||
|
||||
let logins = Svc.Login.findLogins({}, login.hostname, login.formSubmitURL,
|
||||
login.httpRealm);
|
||||
let logins = Services.logins.findLogins(
|
||||
{}, login.hostname, login.formSubmitURL, login.httpRealm);
|
||||
this._store._sleep(0); // Yield back to main thread after synchronous operation.
|
||||
|
||||
// Look for existing logins that match the hostname but ignore the password
|
||||
|
@ -114,8 +116,8 @@ function PasswordStore(name) {
|
|||
"@mozilla.org/login-manager/loginInfo;1", Ci.nsILoginInfo, "init");
|
||||
|
||||
Utils.lazy2(this, "DBConnection", function() {
|
||||
return Svc.Login.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.mozIStorageConnection);
|
||||
return Services.logins.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.mozIStorageConnection);
|
||||
});
|
||||
}
|
||||
PasswordStore.prototype = {
|
||||
|
@ -150,7 +152,7 @@ PasswordStore.prototype = {
|
|||
createInstance(Ci.nsIWritablePropertyBag2);
|
||||
prop.setPropertyAsAUTF8String("guid", id);
|
||||
|
||||
let logins = Svc.Login.searchLogins({}, prop);
|
||||
let logins = Services.logins.searchLogins({}, prop);
|
||||
this._sleep(0); // Yield back to main thread after synchronous operation.
|
||||
if (logins.length > 0) {
|
||||
this._log.trace(logins.length + " items matching " + id + " found.");
|
||||
|
@ -178,7 +180,7 @@ PasswordStore.prototype = {
|
|||
|
||||
getAllIDs: function PasswordStore__getAllIDs() {
|
||||
let items = {};
|
||||
let logins = Svc.Login.getAllLogins({});
|
||||
let logins = Services.logins.getAllLogins({});
|
||||
|
||||
for (let i = 0; i < logins.length; i++) {
|
||||
// Skip over Weave password/passphrase entries
|
||||
|
@ -209,7 +211,7 @@ PasswordStore.prototype = {
|
|||
createInstance(Ci.nsIWritablePropertyBag2);
|
||||
prop.setPropertyAsAUTF8String("guid", newID);
|
||||
|
||||
Svc.Login.modifyLogin(oldLogin, prop);
|
||||
Services.logins.modifyLogin(oldLogin, prop);
|
||||
},
|
||||
|
||||
itemExists: function PasswordStore__itemExists(id) {
|
||||
|
@ -244,7 +246,7 @@ PasswordStore.prototype = {
|
|||
this._log.trace("httpRealm: " + JSON.stringify(login.httpRealm) + "; " +
|
||||
"formSubmitURL: " + JSON.stringify(login.formSubmitURL));
|
||||
try {
|
||||
Svc.Login.addLogin(login);
|
||||
Services.logins.addLogin(login);
|
||||
} catch(ex) {
|
||||
this._log.debug("Adding record " + record.id +
|
||||
" resulted in exception " + Utils.exceptionStr(ex));
|
||||
|
@ -260,7 +262,7 @@ PasswordStore.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
Svc.Login.removeLogin(loginItem);
|
||||
Services.logins.removeLogin(loginItem);
|
||||
},
|
||||
|
||||
update: function PasswordStore__update(record) {
|
||||
|
@ -275,7 +277,7 @@ PasswordStore.prototype = {
|
|||
if (!newinfo)
|
||||
return;
|
||||
try {
|
||||
Svc.Login.modifyLogin(loginItem, newinfo);
|
||||
Services.logins.modifyLogin(loginItem, newinfo);
|
||||
} catch(ex) {
|
||||
this._log.debug("Modifying record " + record.id +
|
||||
" resulted in exception " + Utils.exceptionStr(ex) +
|
||||
|
@ -284,7 +286,7 @@ PasswordStore.prototype = {
|
|||
},
|
||||
|
||||
wipe: function PasswordStore_wipe() {
|
||||
Svc.Login.removeAllLogins();
|
||||
Services.logins.removeAllLogins();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ Cu.import("resource://services-sync/util.js");
|
|||
Cu.import("resource://services-sync/ext/Preferences.js");
|
||||
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
|
||||
|
||||
const PREFS_GUID = Utils.encodeBase64url(Svc.AppInfo.ID);
|
||||
const PREFS_GUID = Utils.encodeBase64url(Services.appinfo.ID);
|
||||
|
||||
function PrefRec(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
|
|
|
@ -301,7 +301,7 @@ TabTracker.prototype = {
|
|||
if (!this._enabled) {
|
||||
Svc.Obs.add("private-browsing", this);
|
||||
Svc.Obs.add("domwindowopened", this);
|
||||
let wins = Svc.WinMediator.getEnumerator("navigator:browser");
|
||||
let wins = Services.wm.getEnumerator("navigator:browser");
|
||||
while (wins.hasMoreElements())
|
||||
this._registerListenersForWindow(wins.getNext());
|
||||
this._enabled = true;
|
||||
|
@ -311,7 +311,7 @@ TabTracker.prototype = {
|
|||
if (this._enabled) {
|
||||
Svc.Obs.remove("private-browsing", this);
|
||||
Svc.Obs.remove("domwindowopened", this);
|
||||
let wins = Svc.WinMediator.getEnumerator("navigator:browser");
|
||||
let wins = Services.wm.getEnumerator("navigator:browser");
|
||||
while (wins.hasMoreElements())
|
||||
this._unregisterListenersForWindow(wins.getNext());
|
||||
this._enabled = false;
|
||||
|
|
|
@ -118,7 +118,7 @@ Identity.prototype = {
|
|||
if (login.username == this.username && login.password == this._password)
|
||||
exists = true;
|
||||
else
|
||||
Svc.Login.removeLogin(login);
|
||||
Services.logins.removeLogin(login);
|
||||
}
|
||||
|
||||
// No need to create the login after clearing out the other ones
|
||||
|
@ -134,8 +134,8 @@ Identity.prototype = {
|
|||
"@mozilla.org/login-manager/loginInfo;1", Ci.nsILoginInfo, "init");
|
||||
let newLogin = new nsLoginInfo(PWDMGR_HOST, null, this.realm,
|
||||
this.username, this.password, "", "");
|
||||
Svc.Login.addLogin(newLogin);
|
||||
Services.logins.addLogin(newLogin);
|
||||
},
|
||||
|
||||
get _logins() Svc.Login.findLogins({}, PWDMGR_HOST, null, this.realm)
|
||||
get _logins() Services.logins.findLogins({}, PWDMGR_HOST, null, this.realm)
|
||||
};
|
||||
|
|
|
@ -152,9 +152,9 @@ AsyncResource.prototype = {
|
|||
// Firefox Aurora/5.0a1 FxSync/1.9.0.20110409.desktop
|
||||
//
|
||||
_userAgent:
|
||||
Svc.AppInfo.name + "/" + Svc.AppInfo.version + // Product.
|
||||
" FxSync/" + WEAVE_VERSION + "." + // Sync.
|
||||
Svc.AppInfo.appBuildID + ".", // Build.
|
||||
Services.appinfo.name + "/" + Services.appinfo.version + // Product.
|
||||
" FxSync/" + WEAVE_VERSION + "." + // Sync.
|
||||
Services.appinfo.appBuildID + ".", // Build.
|
||||
|
||||
// Wait 5 minutes before killing a request.
|
||||
ABORT_TIMEOUT: 300000,
|
||||
|
@ -228,8 +228,9 @@ AsyncResource.prototype = {
|
|||
// to obtain a request channel.
|
||||
//
|
||||
_createRequest: function Res__createRequest() {
|
||||
let channel = Svc.IO.newChannel(this.spec, null, null).
|
||||
QueryInterface(Ci.nsIRequest).QueryInterface(Ci.nsIHttpChannel);
|
||||
let channel = Services.io.newChannel(this.spec, null, null)
|
||||
.QueryInterface(Ci.nsIRequest)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
// Always validate the cache:
|
||||
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||
|
|
|
@ -492,7 +492,7 @@ WeaveSvc.prototype = {
|
|||
|
||||
let enabled = Svc.Prefs.get("log.appender.debugLog.enabled", false);
|
||||
if (enabled) {
|
||||
let verbose = Svc.Directory.get("ProfD", Ci.nsIFile);
|
||||
let verbose = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
verbose.QueryInterface(Ci.nsILocalFile);
|
||||
verbose.append("weave");
|
||||
verbose.append("logs");
|
||||
|
@ -551,7 +551,8 @@ WeaveSvc.prototype = {
|
|||
this._checkSyncStatus();
|
||||
break;
|
||||
case "weave:service:login:error":
|
||||
if (Status.login == LOGIN_FAILED_NETWORK_ERROR && !Svc.IO.offline) {
|
||||
if (Status.login == LOGIN_FAILED_NETWORK_ERROR &&
|
||||
!Services.io.offline) {
|
||||
this._ignorableErrorCount += 1;
|
||||
}
|
||||
break;
|
||||
|
@ -559,7 +560,7 @@ WeaveSvc.prototype = {
|
|||
this._handleSyncError();
|
||||
switch (Status.sync) {
|
||||
case LOGIN_FAILED_NETWORK_ERROR:
|
||||
if (!Svc.IO.offline) {
|
||||
if (!Services.io.offline) {
|
||||
this._ignorableErrorCount += 1;
|
||||
}
|
||||
break;
|
||||
|
@ -1087,8 +1088,8 @@ WeaveSvc.prototype = {
|
|||
// Find weave logins and remove them.
|
||||
this.password = "";
|
||||
this.passphrase = "";
|
||||
Svc.Login.findLogins({}, PWDMGR_HOST, "", "").map(function(login) {
|
||||
Svc.Login.removeLogin(login);
|
||||
Services.logins.findLogins({}, PWDMGR_HOST, "", "").map(function(login) {
|
||||
Services.logins.removeLogin(login);
|
||||
});
|
||||
Svc.Obs.notify("weave:service:start-over");
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
|
@ -1152,7 +1153,7 @@ WeaveSvc.prototype = {
|
|||
this._catch(this._lock("service.js: login",
|
||||
this._notify("login", "", function() {
|
||||
this._loggedIn = false;
|
||||
if (Svc.IO.offline) {
|
||||
if (Services.io.offline) {
|
||||
Status.login = LOGIN_FAILED_NETWORK_ERROR;
|
||||
throw "Application is offline, login should not be called";
|
||||
}
|
||||
|
@ -1443,7 +1444,7 @@ WeaveSvc.prototype = {
|
|||
*/
|
||||
_shouldLogin: function _shouldLogin() {
|
||||
return this.enabled &&
|
||||
!Svc.IO.offline &&
|
||||
!Services.io.offline &&
|
||||
!this.isLoggedIn;
|
||||
},
|
||||
|
||||
|
@ -1459,7 +1460,7 @@ WeaveSvc.prototype = {
|
|||
let reason = "";
|
||||
if (!this.enabled)
|
||||
reason = kSyncWeaveDisabled;
|
||||
else if (Svc.IO.offline)
|
||||
else if (Services.io.offline)
|
||||
reason = kSyncNetworkOffline;
|
||||
else if (Status.minimumNextSync > Date.now())
|
||||
reason = kSyncBackoffNotMet;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const EXPORTED_SYMBOLS = ['Utils', 'Svc', 'Str'];
|
||||
const EXPORTED_SYMBOLS = ['Utils', 'Svc', 'Services', 'Str'];
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -47,6 +47,7 @@ Cu.import("resource://services-sync/ext/Observers.js");
|
|||
Cu.import("resource://services-sync/ext/Preferences.js");
|
||||
Cu.import("resource://services-sync/ext/StringBundle.js");
|
||||
Cu.import("resource://services-sync/log4moz.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
// Constants for makeSyncCallback, waitForSyncCallback
|
||||
|
@ -334,7 +335,7 @@ let Utils = {
|
|||
arg = {path: arg};
|
||||
|
||||
let pathParts = arg.path.split("/");
|
||||
let file = Svc.Directory.get("ProfD", Ci.nsIFile);
|
||||
let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
file.QueryInterface(Ci.nsILocalFile);
|
||||
for (let i = 0; i < pathParts.length; i++)
|
||||
file.append(pathParts[i]);
|
||||
|
@ -1001,7 +1002,7 @@ let Utils = {
|
|||
if (!URIString)
|
||||
return null;
|
||||
try {
|
||||
return Svc.IO.newURI(URIString, null, null);
|
||||
return Services.io.newURI(URIString, null, null);
|
||||
} catch (e) {
|
||||
let log = Log4Moz.repository.getLogger("Service.Util");
|
||||
log.debug("Could not create URI: " + Utils.exceptionStr(e));
|
||||
|
@ -1025,7 +1026,7 @@ let Utils = {
|
|||
},
|
||||
|
||||
getTmp: function Weave_getTmp(name) {
|
||||
let tmp = Svc.Directory.get("ProfD", Ci.nsIFile);
|
||||
let tmp = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
tmp.QueryInterface(Ci.nsILocalFile);
|
||||
|
||||
tmp.append("weave");
|
||||
|
@ -1481,7 +1482,7 @@ let FakeSvc = {
|
|||
getBrowserState: function() {
|
||||
// Fennec should have only one window. Not more, not less.
|
||||
let state = { windows: [{ tabs: [] }] };
|
||||
let window = Svc.WinMediator.getMostRecentWindow("navigator:browser");
|
||||
let window = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
// Extract various pieces of tab data
|
||||
window.Browser._tabs.forEach(function(tab) {
|
||||
|
@ -1543,32 +1544,23 @@ Svc.DefaultPrefs = new Preferences({branch: PREFS_BRANCH, defaultBranch: true});
|
|||
Svc.Obs = Observers;
|
||||
|
||||
this.__defineGetter__("_sessionCID", function() {
|
||||
//sets session CID based on browser type
|
||||
let appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
|
||||
return appInfo.ID == SEAMONKEY_ID ? "@mozilla.org/suite/sessionstore;1"
|
||||
let appinfo_id = Services.appinfo.ID;
|
||||
return appinfo_id == SEAMONKEY_ID ? "@mozilla.org/suite/sessionstore;1"
|
||||
: "@mozilla.org/browser/sessionstore;1";
|
||||
});
|
||||
[["Annos", "@mozilla.org/browser/annotation-service;1", "nsIAnnotationService"],
|
||||
["AppInfo", "@mozilla.org/xre/app-info;1", "nsIXULAppInfo"],
|
||||
["Bookmark", "@mozilla.org/browser/nav-bookmarks-service;1", "nsINavBookmarksService"],
|
||||
["Directory", "@mozilla.org/file/directory_service;1", "nsIProperties"],
|
||||
["Env", "@mozilla.org/process/environment;1", "nsIEnvironment"],
|
||||
["Favicon", "@mozilla.org/browser/favicon-service;1", "nsIFaviconService"],
|
||||
["Form", "@mozilla.org/satchel/form-history;1", "nsIFormHistory2"],
|
||||
["History", "@mozilla.org/browser/nav-history-service;1", "nsPIPlacesDatabase"],
|
||||
["Idle", "@mozilla.org/widget/idleservice;1", "nsIIdleService"],
|
||||
["IO", "@mozilla.org/network/io-service;1", "nsIIOService"],
|
||||
["KeyFactory", "@mozilla.org/security/keyobjectfactory;1", "nsIKeyObjectFactory"],
|
||||
["Login", "@mozilla.org/login-manager;1", "nsILoginManager"],
|
||||
["Memory", "@mozilla.org/xpcom/memory-service;1", "nsIMemory"],
|
||||
["Private", "@mozilla.org/privatebrowsing;1", "nsIPrivateBrowsingService"],
|
||||
["Profiles", "@mozilla.org/toolkit/profile-service;1", "nsIToolkitProfileService"],
|
||||
["Prompt", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"],
|
||||
["Script", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"],
|
||||
["SysInfo", "@mozilla.org/system-info;1", "nsIPropertyBag2"],
|
||||
["Version", "@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator"],
|
||||
["WinMediator", "@mozilla.org/appshell/window-mediator;1", "nsIWindowMediator"],
|
||||
["WinWatcher", "@mozilla.org/embedcomp/window-watcher;1", "nsIWindowWatcher"],
|
||||
["Session", this._sessionCID, "nsISessionStore"],
|
||||
].forEach(function(lazy) Utils.lazySvc(Svc, lazy[0], lazy[1], lazy[2]));
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ function FakeLoginManager(fakeLogins) {
|
|||
let self = this;
|
||||
|
||||
// Use a fake nsILoginManager object.
|
||||
delete Svc.Login;
|
||||
Svc.Login = {
|
||||
delete Services.logins;
|
||||
Services.logins = {
|
||||
removeAllLogins: function() { self.fakeLogins = []; },
|
||||
getAllLogins: function() { return self.fakeLogins; },
|
||||
addLogin: function(login) {
|
||||
|
|
|
@ -33,14 +33,14 @@ function run_test() {
|
|||
try {
|
||||
applyEnsureNoFailures([recordA, recordB]);
|
||||
|
||||
// Only the good record makes it to Svc.Login.
|
||||
// Only the good record makes it to Services.logins.
|
||||
let badCount = {};
|
||||
let goodCount = {};
|
||||
let badLogins = Svc.Login.findLogins(badCount, recordA.hostname,
|
||||
recordA.formSubmitURL,
|
||||
recordA.httpRealm);
|
||||
let goodLogins = Svc.Login.findLogins(goodCount, recordB.hostname,
|
||||
recordB.formSubmitURL, null);
|
||||
let badLogins = Services.logins.findLogins(badCount, recordA.hostname,
|
||||
recordA.formSubmitURL,
|
||||
recordA.httpRealm);
|
||||
let goodLogins = Services.logins.findLogins(goodCount, recordB.hostname,
|
||||
recordB.formSubmitURL, null);
|
||||
|
||||
_("Bad: " + JSON.stringify(badLogins));
|
||||
_("Good: " + JSON.stringify(goodLogins));
|
||||
|
|
|
@ -4,7 +4,7 @@ Cu.import("resource://services-sync/ext/Preferences.js");
|
|||
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PREFS_GUID = Utils.encodeBase64url(Svc.AppInfo.ID);
|
||||
const PREFS_GUID = Utils.encodeBase64url(Services.appinfo.ID);
|
||||
|
||||
function makePersona(id) {
|
||||
return {
|
||||
|
|
|
@ -21,7 +21,7 @@ function run_test() {
|
|||
let changedIDs = engine.getChangedIDs();
|
||||
let ids = [id for (id in changedIDs)];
|
||||
do_check_eq(ids.length, 1);
|
||||
do_check_eq(ids[0], Utils.encodeBase64url(Svc.AppInfo.ID));
|
||||
do_check_eq(ids[0], Utils.encodeBase64url(Services.appinfo.ID));
|
||||
|
||||
Svc.Prefs.set("engine.prefs.modified", false);
|
||||
do_check_false(tracker.modified);
|
||||
|
|
|
@ -430,7 +430,7 @@ function run_test() {
|
|||
let res18 = new Resource("http://localhost:8080/json");
|
||||
let onProgress = function(rec) {
|
||||
// Provoke an XPC exception without a Javascript wrapper.
|
||||
Svc.IO.newURI("::::::::", null, null);
|
||||
Services.io.newURI("::::::::", null, null);
|
||||
};
|
||||
res18._onProgress = onProgress;
|
||||
let oldWarn = res18._log.warn;
|
||||
|
|
|
@ -633,7 +633,7 @@ function run_test() {
|
|||
let res14 = new AsyncResource("http://localhost:8080/json");
|
||||
res14._onProgress = function(rec) {
|
||||
// Provoke an XPC exception without a Javascript wrapper.
|
||||
Svc.IO.newURI("::::::::", null, null);
|
||||
Services.io.newURI("::::::::", null, null);
|
||||
};
|
||||
let warnings = [];
|
||||
res14._log.warn = function(msg) { warnings.push(msg) };
|
||||
|
|
|
@ -28,8 +28,9 @@ function test_resource_user_agent() {
|
|||
Weave.Service.username = "johndoe";
|
||||
Weave.Service.password = "ilovejane";
|
||||
|
||||
let expectedUA = Svc.AppInfo.name + "/" + Svc.AppInfo.version +
|
||||
" FxSync/" + WEAVE_VERSION + "." + Svc.AppInfo.appBuildID;
|
||||
let expectedUA = Services.appinfo.name + "/" + Services.appinfo.version +
|
||||
" FxSync/" + WEAVE_VERSION + "." +
|
||||
Services.appinfo.appBuildID;
|
||||
|
||||
function test_fetchInfo(next) {
|
||||
_("Testing _fetchInfo.");
|
||||
|
|
|
@ -38,7 +38,7 @@ function run_test() {
|
|||
do_check_eq(requestBody, "ILoveJane83");
|
||||
|
||||
_("Make sure the password has been persisted in the login manager.");
|
||||
let logins = Weave.Svc.Login.findLogins({}, PWDMGR_HOST, null,
|
||||
let logins = Services.logins.findLogins({}, PWDMGR_HOST, null,
|
||||
PWDMGR_PASSWORD_REALM);
|
||||
do_check_eq(logins[0].password, "ILoveJane83");
|
||||
|
||||
|
@ -50,7 +50,7 @@ function run_test() {
|
|||
do_check_eq(requestBody, Utils.encodeUTF8(moneyPassword));
|
||||
|
||||
_("changePassword() returns false for a server error, the password won't change.");
|
||||
Weave.Svc.Login.removeAllLogins();
|
||||
Services.logins.removeAllLogins();
|
||||
Weave.Service.username = "janedoe";
|
||||
Weave.Service.password = "ilovejohn";
|
||||
res = Weave.Service.changePassword("ILoveJohn86");
|
||||
|
@ -59,7 +59,7 @@ function run_test() {
|
|||
|
||||
} finally {
|
||||
Weave.Svc.Prefs.resetBranch("");
|
||||
Weave.Svc.Login.removeAllLogins();
|
||||
Services.logins.removeAllLogins();
|
||||
if (server) {
|
||||
server.stop(do_test_finished);
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@ function run_test() {
|
|||
|
||||
try {
|
||||
_("The right bits are set when we're offline.");
|
||||
Svc.IO.offline = true;
|
||||
Services.io.offline = true;
|
||||
do_check_eq(Service._ignorableErrorCount, 0);
|
||||
do_check_false(!!Service.login());
|
||||
do_check_eq(Status.login, LOGIN_FAILED_NETWORK_ERROR);
|
||||
do_check_eq(Service._ignorableErrorCount, 0);
|
||||
Svc.IO.offline = false;
|
||||
Services.io.offline = false;
|
||||
} finally {
|
||||
Svc.Prefs.resetBranch("");
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ function run_test() {
|
|||
|
||||
_("We're ready to sync if locked.");
|
||||
Service.enabled = true;
|
||||
Svc.IO.offline = false;
|
||||
Services.io.offline = false;
|
||||
Service._checkSyncStatus();
|
||||
do_check_true(scheduleCalled);
|
||||
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
Cu.import("resource://services-sync/main.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
|
||||
function run_test() {
|
||||
try {
|
||||
// Ensure we have a blank slate to start.
|
||||
Weave.Svc.Login.removeAllLogins();
|
||||
Services.logins.removeAllLogins();
|
||||
|
||||
Weave.Service.username = "johndoe";
|
||||
Weave.Service.password = "ilovejane";
|
||||
Weave.Service.passphrase = "abbbbbcccccdddddeeeeefffff";
|
||||
|
||||
_("Confirm initial environment is empty.");
|
||||
let logins = Weave.Svc.Login.findLogins({}, PWDMGR_HOST, null,
|
||||
let logins = Services.logins.findLogins({}, PWDMGR_HOST, null,
|
||||
PWDMGR_PASSWORD_REALM);
|
||||
do_check_eq(logins.length, 0);
|
||||
logins = Weave.Svc.Login.findLogins({}, PWDMGR_HOST, null,
|
||||
logins = Services.logins.findLogins({}, PWDMGR_HOST, null,
|
||||
PWDMGR_PASSPHRASE_REALM);
|
||||
do_check_eq(logins.length, 0);
|
||||
|
||||
|
@ -22,14 +23,14 @@ function run_test() {
|
|||
Weave.Service.persistLogin();
|
||||
|
||||
_("The password has been persisted in the login service.");
|
||||
logins = Weave.Svc.Login.findLogins({}, PWDMGR_HOST, null,
|
||||
logins = Services.logins.findLogins({}, PWDMGR_HOST, null,
|
||||
PWDMGR_PASSWORD_REALM);
|
||||
do_check_eq(logins.length, 1);
|
||||
do_check_eq(logins[0].username, "johndoe");
|
||||
do_check_eq(logins[0].password, "ilovejane");
|
||||
|
||||
_("The passphrase has been persisted in the login service.");
|
||||
logins = Weave.Svc.Login.findLogins({}, PWDMGR_HOST, null,
|
||||
logins = Services.logins.findLogins({}, PWDMGR_HOST, null,
|
||||
PWDMGR_PASSPHRASE_REALM);
|
||||
do_check_eq(logins.length, 1);
|
||||
do_check_eq(logins[0].username, "johndoe");
|
||||
|
@ -37,6 +38,6 @@ function run_test() {
|
|||
|
||||
} finally {
|
||||
Weave.Svc.Prefs.resetBranch("");
|
||||
Weave.Svc.Login.removeAllLogins();
|
||||
Services.logins.removeAllLogins();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ add_test(function test_service_networkError() {
|
|||
add_test(function test_service_offline() {
|
||||
_("Test: Wanting to sync in offline mode leads to the right status code but does not increment the ignorable error count.");
|
||||
setUp();
|
||||
Svc.IO.offline = true;
|
||||
Services.io.offline = true;
|
||||
Service._ignorableErrorCount = 0;
|
||||
|
||||
try {
|
||||
|
@ -188,7 +188,7 @@ add_test(function test_service_offline() {
|
|||
Status.resetSync();
|
||||
Service.startOver();
|
||||
}
|
||||
Svc.IO.offline = false;
|
||||
Services.io.offline = false;
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ function run_test() {
|
|||
Log4Moz.repository.rootLogger.addAppender(new Log4Moz.DumpAppender());
|
||||
|
||||
// This test expects a clean slate -- no saved passphrase.
|
||||
Weave.Svc.Login.removeAllLogins();
|
||||
Services.logins.removeAllLogins();
|
||||
let johnHelper = track_collections_helper();
|
||||
let johnU = johnHelper.with_updated_collection;
|
||||
let johnColls = johnHelper.collections;
|
||||
|
|
|
@ -5,8 +5,8 @@ Cu.import("resource://services-sync/util.js");
|
|||
function fakeSvcWinMediator() {
|
||||
// actions on windows are captured in logs
|
||||
let logs = [];
|
||||
delete Svc.WinMediator;
|
||||
Svc.WinMediator = {
|
||||
delete Services.wm;
|
||||
Services.wm = {
|
||||
getEnumerator: function() {
|
||||
return {
|
||||
cnt: 2,
|
||||
|
|
Загрузка…
Ссылка в новой задаче