mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Backed out changeset 7520b940afc8 (bug 1267760) for eslint failure
This commit is contained in:
parent
670ef44c8b
commit
a7f3bc1ed9
@ -296,10 +296,6 @@ function copyObjectProperties(from, to, opts = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function urlsafeBase64Encode(key) {
|
||||
return ChromeUtils.base64URLEncode(new Uint8Array(key), { pad: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* The public API's constructor.
|
||||
*/
|
||||
@ -359,7 +355,7 @@ FxAccountsInternal.prototype = {
|
||||
VERIFICATION_POLL_TIMEOUT_SUBSEQUENT: 30000, // 30 seconds.
|
||||
// The current version of the device registration, we use this to re-register
|
||||
// devices after we update what we send on device registration.
|
||||
DEVICE_REGISTRATION_VERSION: 2,
|
||||
DEVICE_REGISTRATION_VERSION: 1,
|
||||
|
||||
_fxAccountsClient: null,
|
||||
|
||||
@ -1517,12 +1513,6 @@ FxAccountsInternal.prototype = {
|
||||
// if we were able to obtain a subscription
|
||||
if (subscription && subscription.endpoint) {
|
||||
deviceOptions.pushCallback = subscription.endpoint;
|
||||
let publicKey = subscription.getKey('p256dh');
|
||||
let authKey = subscription.getKey('auth');
|
||||
if (publicKey && authKey) {
|
||||
deviceOptions.pushPublicKey = urlsafeBase64Encode(publicKey);
|
||||
deviceOptions.pushAuthKey = urlsafeBase64Encode(authKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (signedInUser.deviceId) {
|
||||
|
@ -367,10 +367,6 @@ this.FxAccountsClient.prototype = {
|
||||
* Extra device options
|
||||
* @param [options.pushCallback]
|
||||
* `pushCallback` push endpoint callback
|
||||
* @param [options.pushPublicKey]
|
||||
* `pushPublicKey` push public key (URLSafe Base64 string)
|
||||
* @param [options.pushAuthKey]
|
||||
* `pushAuthKey` push auth secret (URLSafe Base64 string)
|
||||
* @return Promise
|
||||
* Resolves to an object:
|
||||
* {
|
||||
@ -389,10 +385,6 @@ this.FxAccountsClient.prototype = {
|
||||
if (options.pushCallback) {
|
||||
body.pushCallback = options.pushCallback;
|
||||
}
|
||||
if (options.pushPublicKey && options.pushAuthKey) {
|
||||
body.pushPublicKey = options.pushPublicKey;
|
||||
body.pushAuthKey = options.pushAuthKey;
|
||||
}
|
||||
|
||||
return this._request(path, "POST", creds, body);
|
||||
},
|
||||
@ -411,10 +403,6 @@ this.FxAccountsClient.prototype = {
|
||||
* Extra device options
|
||||
* @param [options.pushCallback]
|
||||
* `pushCallback` push endpoint callback
|
||||
* @param [options.pushPublicKey]
|
||||
* `pushPublicKey` push public key (URLSafe Base64 string)
|
||||
* @param [options.pushAuthKey]
|
||||
* `pushAuthKey` push auth secret (URLSafe Base64 string)
|
||||
* @return Promise
|
||||
* Resolves to an object:
|
||||
* {
|
||||
@ -430,10 +418,6 @@ this.FxAccountsClient.prototype = {
|
||||
if (options.pushCallback) {
|
||||
body.pushCallback = options.pushCallback;
|
||||
}
|
||||
if (options.pushPublicKey && options.pushAuthKey) {
|
||||
body.pushPublicKey = options.pushPublicKey;
|
||||
body.pushAuthKey = options.pushAuthKey;
|
||||
}
|
||||
|
||||
return this._request(path, "POST", creds, body);
|
||||
},
|
||||
|
@ -16,9 +16,6 @@ initTestLogging("Trace");
|
||||
var log = Log.repository.getLogger("Services.FxAccounts.test");
|
||||
log.level = Log.Level.Debug;
|
||||
|
||||
const BOGUS_PUBLICKEY = "BBXOKjUb84pzws1wionFpfCBjDuCh4-s_1b52WA46K5wYL2gCWEOmFKWn_NkS5nmJwTBuO8qxxdjAIDtNeklvQc";
|
||||
const BOGUS_AUTHKEY = "GSsIiaD2Mr83iPqwFNK4rw";
|
||||
|
||||
Services.prefs.setCharPref("identity.fxaccounts.loglevel", "Trace");
|
||||
Log.repository.getLogger("FirefoxAccounts").level = Log.Level.Trace;
|
||||
|
||||
@ -109,11 +106,7 @@ function MockFxAccounts(device = {}) {
|
||||
registerPushEndpoint() {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
endpoint: "http://mochi.test:8888",
|
||||
getKey: function(type) {
|
||||
return ChromeUtils.base64URLDecode(
|
||||
type === "auth" ? BOGUS_AUTHKEY : BOGUS_PUBLICKEY,
|
||||
{ padding: "ignore" });
|
||||
endpoint: "http://mochi.test:8888"
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -169,8 +162,6 @@ add_task(function* test_updateDeviceRegistration_with_new_device() {
|
||||
do_check_eq(spy.registerDevice.args[0][1], deviceName);
|
||||
do_check_eq(spy.registerDevice.args[0][2], "desktop");
|
||||
do_check_eq(spy.registerDevice.args[0][3].pushCallback, "http://mochi.test:8888");
|
||||
do_check_eq(spy.registerDevice.args[0][3].pushPublicKey, BOGUS_PUBLICKEY);
|
||||
do_check_eq(spy.registerDevice.args[0][3].pushAuthKey, BOGUS_AUTHKEY);
|
||||
|
||||
const state = fxa.internal.currentAccountState;
|
||||
const data = yield state.getUserAccountData();
|
||||
@ -222,8 +213,6 @@ add_task(function* test_updateDeviceRegistration_with_existing_device() {
|
||||
do_check_eq(spy.updateDevice.args[0][1], credentials.deviceId);
|
||||
do_check_eq(spy.updateDevice.args[0][2], deviceName);
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushCallback, "http://mochi.test:8888");
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushPublicKey, BOGUS_PUBLICKEY);
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushAuthKey, BOGUS_AUTHKEY);
|
||||
|
||||
const state = fxa.internal.currentAccountState;
|
||||
const data = yield state.getUserAccountData();
|
||||
@ -281,8 +270,6 @@ add_task(function* test_updateDeviceRegistration_with_unknown_device_error() {
|
||||
do_check_eq(spy.updateDevice.args[0][1], credentials.deviceId);
|
||||
do_check_eq(spy.updateDevice.args[0][2], deviceName);
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushCallback, "http://mochi.test:8888");
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushPublicKey, BOGUS_PUBLICKEY);
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushAuthKey, BOGUS_AUTHKEY);
|
||||
|
||||
|
||||
const state = fxa.internal.currentAccountState;
|
||||
@ -346,8 +333,6 @@ add_task(function* test_updateDeviceRegistration_with_device_session_conflict_er
|
||||
do_check_eq(spy.updateDevice.args[0][1], credentials.deviceId);
|
||||
do_check_eq(spy.updateDevice.args[0][2], deviceName);
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushCallback, "http://mochi.test:8888");
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushPublicKey, BOGUS_PUBLICKEY);
|
||||
do_check_eq(spy.updateDevice.args[0][3].pushAuthKey, BOGUS_AUTHKEY);
|
||||
do_check_eq(spy.getDeviceList.count, 1);
|
||||
do_check_eq(spy.getDeviceList.args[0].length, 1);
|
||||
do_check_eq(spy.getDeviceList.args[0][0], credentials.sessionToken);
|
||||
|
Loading…
Reference in New Issue
Block a user