do not set undefined properties

This commit is contained in:
Kyle Spearrin 2017-06-06 08:48:05 -04:00
parent c6533a961a
commit bc9504f039
3 changed files with 16 additions and 1 deletions

View File

@ -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 () {

View File

@ -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 () { });
}

View File

@ -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;