Skip to content

Commit c542fd8

Browse files
committed
fix issue on duplicated ownKeys trap results. see spec change tc39/ecma262#594 for detail
1 parent 0ead88d commit c542fd8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

lib/Runtime/Library/JavascriptProxy.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,17 @@ namespace Js
178178
JavascriptConversion::ToPropertyKey(element, scriptContext, &propertyRecord);
179179
propertyId = propertyRecord->GetPropertyId();
180180

181-
if (propertyId != Constants::NoProperty)
181+
if (!targetToTrapResultMap.ContainsKey(propertyId))
182182
{
183-
targetToTrapResultMap.Add(propertyId, true);
184-
}
185-
186-
if (fn(propertyRecord))
187-
{
188-
trapResult->DirectSetItemAt(trapResultIndex++, element);
183+
if (propertyId != Constants::NoProperty)
184+
{
185+
targetToTrapResultMap.Add(propertyId, true);
186+
}
187+
188+
if (fn(propertyRecord))
189+
{
190+
trapResult->DirectSetItemAt(trapResultIndex++, element);
191+
}
189192
}
190193
}
191194
}

test/es6/proxyenumremoval.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ var proxy = new Proxy({b:1,a:2}, {
8484
for(var key in proxy){ keys += key;}
8585
passed &= keys==="a";
8686

87-
/* duplicate key does not work, assertion on inserting propertyId to dictionary. Waiting for spec clarification
8887
// check property descriptor trap
8988
var keys=""
9089
var already_non_enmerable = false;
@@ -115,7 +114,6 @@ var proxy = new Proxy({}, {
115114
for(var key in proxy){ keys += key;}
116115
passed &= keys==="b";
117116
passed &= getPrototypeOfCalled===1;
118-
*/
119117

120118
if (passed) {
121119
WScript.Echo("PASS");

0 commit comments

Comments
 (0)