From bc9504f039d012fc5a6bb4374f596eac5f176a24 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 6 Jun 2017 08:48:05 -0400 Subject: [PATCH] do not set undefined properties --- src/services/cryptoService.js | 10 ++++++++++ src/services/syncService.js | 2 +- src/services/userService.js | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/services/cryptoService.js b/src/services/cryptoService.js index 3d0e94abc5..b53c2d22da 100644 --- a/src/services/cryptoService.js +++ b/src/services/cryptoService.js @@ -51,6 +51,11 @@ function initCryptoService(constantsService) { CryptoService.prototype.setEncKey = function (encKey) { var deferred = Q.defer(); + if (encKey === undefined) { + deferred.resolve(); + return deferred.promise; + } + chrome.storage.local.set({ 'encKey': encKey }, function () { @@ -64,6 +69,11 @@ function initCryptoService(constantsService) { CryptoService.prototype.setEncPrivateKey = function (encPrivateKey) { var deferred = Q.defer(); + if (encPrivateKey === undefined) { + deferred.resolve(); + return deferred.promise; + } + chrome.storage.local.set({ 'encPrivateKey': encPrivateKey }, function () { diff --git a/src/services/syncService.js b/src/services/syncService.js index 7b36b6f6da..a027c4264d 100644 --- a/src/services/syncService.js +++ b/src/services/syncService.js @@ -87,7 +87,7 @@ function initSyncService() { self.apiService.getProfile(function (response) { self.userService.getSecurityStamp().then(function (stamp) { - if (stamp && stamp != response.securityStamp) { + if (stamp && stamp !== response.securityStamp) { if (self.logoutCallback) { self.logoutCallback(true, function () { }); } diff --git a/src/services/userService.js b/src/services/userService.js index 72834e6ec1..075dbd7f2d 100644 --- a/src/services/userService.js +++ b/src/services/userService.js @@ -38,6 +38,11 @@ function initUserService() { UserService.prototype.setSecurityStamp = function (stamp) { var deferred = Q.defer(); + if (stamp === undefined) { + deferred.resolve(); + return deferred.promise; + } + _stamp = stamp; var stampObj = {}; stampObj[stampKey] = stamp;