Issue metadata
Sign in to add a comment
|
localStorage.hasOwnProperty(key) returns false though the key is present in the local storage
Reported by
harihara...@gmail.com,
Jun 20 2017
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Steps to reproduce the problem: 1.Store some json in local storage 2. call a javascript function that returns localStorage.hasOwnProperty(key) 3. What is the expected behavior? It must return true What went wrong? The function returns false though the key is present in localstorage Did this work before? N/A Chrome version: 60.0.3107.4 Channel: n/a OS Version: 14.04 Flash Version: Shockwave Flash 26.0 r0
,
Jun 22 2017
,
Jun 22 2017
Please provide sample script demonstrating the problem.
,
Jun 23 2017
I can see this issue consistently Using Chrome Version 60.0.3112.40 (Official Build) beta (64-bit), Mac OS 10.12.5 and the repro below.
//PART 1: clear local storage, add 100 testing keys
localStorage.clear();
for (var i = 0; i < 100; i++) {
let propName = 'item' + i;
localStorage.setItem(propName, 'value' + i);
}
//PART 2: check hasOwnProperty, getItem results
for (var i = 0; i < 100; i++) {
let propName = 'item' + i;
console.log(propName + ', hasOwnProperty: '+ localStorage.hasOwnProperty(propName) + ', getItem result:' + localStorage.getItem(propName));
}
The console log will output results like this (hasOwnProperty is false, but getItem has a valid result)
item0, hasOwnProperty: false, getItem result:value0
item1, hasOwnProperty: false, getItem result:value1
item2, hasOwnProperty: false, getItem result:value2
If chrome is then completely closed and re-started and only part 2 is run, the results will be the same.
I believe this is the same issue that has also been logged here: https://bugs.chromium.org/p/chromium/issues/detail?id=735990
,
Jun 23 2017
Yep, same issue. I'm going to mark this one as a duplicate since the other has more context. Thanks!
,
Jun 29 2017
The NextAction date has arrived: 2017-06-29 |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by harihara...@gmail.com
, Jun 20 2017