From ba8a0784fc40b1ab3b91905074249549b0b86db0 Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 2 May 2017 22:25:57 -0700 Subject: [PATCH] D2NOVA Stephen Chen In latest Chrome on MacOS (Version 60.0.3080.5) the angular-locker 2.0.4 will fail to read from localStorage. i.e. locker.get(mykey) will return undefined even there is data stored with the key 'mykey' the root cause is that in _exists() method this._driver.hasOwnProperty(this._getPrefix(_value(key))) is not working for this Chrome. so the fix to that is to change to : this._driver.hasOwnProperty(this._getPrefix(_value(key))) || this._getItem(key) --- src/angular-locker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/angular-locker.js b/src/angular-locker.js index 4ef649d..a949902 100644 --- a/src/angular-locker.js +++ b/src/angular-locker.js @@ -1,4 +1,4 @@ -/** +/** * angular-locker * * A simple & configurable abstraction for local/session storage in angular projects. @@ -341,8 +341,8 @@ if (! this._checkSupport()) { _error('The browser does not support the "' + options.driver + '" driver'); } - - return this._driver.hasOwnProperty(this._getPrefix(_value(key))); + /*D2NOVA Stephen Chen: hasOwnProperty() method doesn't work on MacOS latest Chrome Version v60.0.3080.5 */ + return this._driver.hasOwnProperty(this._getPrefix(_value(key))) || this._getItem(key); }; /**