Bug 129890 - localStorage keys are not enumerable
Summary: localStorage keys are not enumerable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-07 10:14 PST by Mariusz Nowak
Modified: 2021-01-04 10:57 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mariusz Nowak 2014-03-07 10:14:40 PST
localStorage.foo = 'bar';
localStorage.foo; // 'bar'
Object.keys(localStorage); // ['foo']
localStorage.propertyIsEnumerable('foo'); // false (should be true)

Strictly Webkit bug, all other engines behave ok.
Comment 1 Alexey Shvayka 2021-01-04 10:57:33 PST
(In reply to Mariusz Nowak from comment #0)
> Strictly Webkit bug, all other engines behave ok.

Thank you for the report!

WebKit's getOwnPropertySlot() used to unconditionally set PropertyAttribute::DontEnum for named getter properties, causing this bug.
This was fixed in r210667.

WPT coverage: https://github.com/web-platform-tests/wpt/blob/dbc7edfaa96e559b9aa34a9c898a1ad54d877b58/webstorage/storage_enumerate.html#L53.