Bug 1300297 - Ensure FxA device id is cleared on password change. r=markh a=lizzard
authorPhil Booth <pmbooth@gmail.com>
Sat, 03 Sep 2016 06:17:00 +0200
changeset 340605 76be57211b9bbef53e7a45f2cb0c304bf4763f69
parent 340604 9f839de0688c9c8b9f4d4c831b599169057aa9e9
child 340606 b8ea232286b18d1ab5694226ab44fd05052c5bd4
push id6382
push userkwierso@gmail.com
push dateTue, 06 Sep 2016 21:49:37 +0000
treeherdermozilla-beta@76be57211b9b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh, lizzard
bugs1300297
milestone49.0
Bug 1300297 - Ensure FxA device id is cleared on password change. r=markh a=lizzard CLOSED TREE
services/fxaccounts/FxAccountsWebChannel.jsm
services/fxaccounts/tests/xpcshell/test_web_channel.js
--- a/services/fxaccounts/FxAccountsWebChannel.jsm
+++ b/services/fxaccounts/FxAccountsWebChannel.jsm
@@ -328,17 +328,19 @@ this.FxAccountsWebChannelHelpers.prototy
     // updateUserAccountData will throw - mainly to prevent errors in code
     // that hard-codes field names.
     // However, in this case the field names aren't really in our control.
     // We *could* still insist the server know what fields names are valid,
     // but that makes life difficult for the server when Firefox adds new
     // features (ie, new fields) - forcing the server to track a map of
     // versions to supported field names doesn't buy us much.
     // So we just remove field names we know aren't handled.
-    let newCredentials = {};
+    let newCredentials = {
+      deviceId: null
+    };
     for (let name of Object.keys(credentials)) {
       if (name == "email" || name == "uid" || FxAccountsStorageManagerCanStoreField(name)) {
         newCredentials[name] = credentials[name];
       } else {
         log.info("changePassword ignoring unsupported field", name);
       }
     }
     return this._fxAccounts.updateUserAccountData(newCredentials)
--- a/services/fxaccounts/tests/xpcshell/test_web_channel.js
+++ b/services/fxaccounts/tests/xpcshell/test_web_channel.js
@@ -409,16 +409,18 @@ add_task(function* test_helpers_change_p
   };
   let helpers = new FxAccountsWebChannelHelpers({
     fxAccounts: {
       updateUserAccountData(credentials) {
         return new Promise(resolve => {
           do_check_true(credentials.hasOwnProperty("email"));
           do_check_true(credentials.hasOwnProperty("uid"));
           do_check_true(credentials.hasOwnProperty("kA"));
+          do_check_true(credentials.hasOwnProperty("deviceId"));
+          do_check_null(credentials.deviceId);
           // "foo" isn't a field known by storage, so should be dropped.
           do_check_false(credentials.hasOwnProperty("foo"));
           wasCalled.updateUserAccountData = true;
 
           resolve();
         });
       },