diff options
author | Moonchild <moonchild@palemoon.org> | 2019-04-18 15:49:19 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2019-04-18 15:49:19 +0000 |
commit | cdc962dca59f2d68b82bec99beb5d67ae163f24a (patch) | |
tree | 4ebeba312f6c5c09e27da7e7e2408c985065dcd5 /services/sync/tps/extensions | |
parent | 8a68832519ec37cc14f14367b83bfee34c88cde2 (diff) | |
download | UXP-cdc962dca59f2d68b82bec99beb5d67ae163f24a.tar UXP-cdc962dca59f2d68b82bec99beb5d67ae163f24a.tar.gz UXP-cdc962dca59f2d68b82bec99beb5d67ae163f24a.tar.lz UXP-cdc962dca59f2d68b82bec99beb5d67ae163f24a.tar.xz UXP-cdc962dca59f2d68b82bec99beb5d67ae163f24a.zip |
Remove various FxA tests
Diffstat (limited to 'services/sync/tps/extensions')
-rw-r--r-- | services/sync/tps/extensions/tps/resource/auth/fxaccounts.jsm | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/services/sync/tps/extensions/tps/resource/auth/fxaccounts.jsm b/services/sync/tps/extensions/tps/resource/auth/fxaccounts.jsm deleted file mode 100644 index f5daa14be..000000000 --- a/services/sync/tps/extensions/tps/resource/auth/fxaccounts.jsm +++ /dev/null @@ -1,96 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -this.EXPORTED_SYMBOLS = [ - "Authentication", -]; - -const {classes: Cc, interfaces: Ci, utils: Cu} = Components; - -Cu.import("resource://gre/modules/FxAccounts.jsm"); -Cu.import("resource://gre/modules/FxAccountsClient.jsm"); -Cu.import("resource://services-common/async.js"); -Cu.import("resource://services-sync/main.js"); -Cu.import("resource://tps/logger.jsm"); - - -/** - * Helper object for Firefox Accounts authentication - */ -var Authentication = { - - /** - * Check if an user has been logged in - */ - get isLoggedIn() { - return !!this.getSignedInUser(); - }, - - /** - * Wrapper to retrieve the currently signed in user - * - * @returns Information about the currently signed in user - */ - getSignedInUser: function getSignedInUser() { - let cb = Async.makeSpinningCallback(); - - fxAccounts.getSignedInUser().then(user => { - cb(null, user); - }, error => { - cb(error); - }) - - try { - return cb.wait(); - } catch (error) { - Logger.logError("getSignedInUser() failed with: " + JSON.stringify(error)); - throw error; - } - }, - - /** - * Wrapper to synchronize the login of a user - * - * @param account - * Account information of the user to login - * @param account.username - * The username for the account (utf8) - * @param account.password - * The user's password - */ - signIn: function signIn(account) { - let cb = Async.makeSpinningCallback(); - - Logger.AssertTrue(account["username"], "Username has been found"); - Logger.AssertTrue(account["password"], "Password has been found"); - - Logger.logInfo("Login user: " + account["username"] + '\n'); - - let client = new FxAccountsClient(); - client.signIn(account["username"], account["password"], true).then(credentials => { - return fxAccounts.setSignedInUser(credentials); - }).then(() => { - cb(null, true); - }, error => { - cb(error, false); - }); - - try { - cb.wait(); - - if (Weave.Status.login !== Weave.LOGIN_SUCCEEDED) { - Logger.logInfo("Logging into Weave."); - Weave.Service.login(); - Logger.AssertEqual(Weave.Status.login, Weave.LOGIN_SUCCEEDED, - "Weave logged in"); - } - - return true; - } catch (error) { - throw new Error("signIn() failed with: " + error.message); - } - } -}; |