[Webkit-unassigned] [Bug 176810] New: for..in on a Proxy loops over non enumerable properties
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Sep 12 14:55:11 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=176810
Bug ID: 176810
Summary: for..in on a Proxy loops over non enumerable
properties
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jparadis at salesforce.com
* Steps to reproduce:
var foo = new Proxy(['a', 'b'],{
ownKeys: function(target) { return Reflect.ownKeys(target); }
});
for (var p in foo) console.log(p);
* Actual results (nightly):
// 0
// 1
// length
* Expected results:
// 0
// 1
This works as expected in Chrome and FF.
* Discussion:
The getOwnPropertyDescriptor trap is called, but it seems like the results are ignored (we loop even if enumerable is forced to false):
var foo = new Proxy(["a", "b"],{
getOwnPropertyDescriptor: function(target, prop) { var desc = Reflect.getOwnPropertyDescriptor(target, prop); desc.enumerable=false; return desc; },
ownKeys: function(target) { return Reflect.ownKeys(target); }
})
This is correct:
Object.keys(foo)
// []
This is incorrect:
for (var p in foo) console.log(p)
// 0
// 1
// length
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170912/d8e03c9e/attachment-0001.html>
More information about the webkit-unassigned
mailing list