Bug 129890

Summary: localStorage keys are not enumerable
Product: WebKit Reporter: Mariusz Nowak <medikoo+webkit.org>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ashvayka
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=166835

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.