angular-local-storage icon indicating copy to clipboard operation
angular-local-storage copied to clipboard

getFromCookies returns inconsistent value when not supported

Open kyprous opened this issue 9 years ago • 0 comments

This is something I came across when trying to use Local Storage which eventually fallbacks to also unsupported/blocked cookie storage. Repro steps:

  • Call LocalStorageService.get('dummyKey')
  • Local Storage is not supported, so we fallback to cookie retrieval.
  • So this is executed: getFromCookies('dummyKey')
  • Cookies are not supported either.

Expected result: return null Actual result: return false

So I guess this is debatable, but I would expect that if cookies are not supported, it would return the same value as if the cookie did not exist, which is null.

As of time of writing, getFromCookies is the method with this logic.

kyprous avatar Jun 28 '16 10:06 kyprous