New issue
Advanced search Search tips

Issue 734929 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 735990
Owner: ----
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: 2017-06-29
OS: Linux
Pri: 2
Type: Bug



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 description

UserAgent: 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
 
Issue is reproduced in chrome Version 60.0.3107.4 (Official Build) dev (64-bit)

Comment 2 by bokan@chromium.org, Jun 22 2017

Components: -Blink Blink>Storage>DOMStorage

Comment 3 Deleted

Comment 4 by jsb...@chromium.org, Jun 22 2017

Labels: Needs-Feedback
NextAction: 2017-06-29
Please provide sample script demonstrating the problem.
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
hasOwnProperty_repro.js
337 bytes View Download

Comment 6 by jsb...@chromium.org, Jun 23 2017

Mergedinto: 735990
Status: Duplicate (was: Unconfirmed)
Yep, same issue. I'm going to mark this one as a duplicate since the other has more context. Thanks!

The NextAction date has arrived: 2017-06-29

Sign in to add a comment