| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
es6id: 19.1.2.1 |
| 5 |
description: Invoked with a source which does not have a descriptor for an own property |
| 6 |
info: | |
| 7 |
[...] |
| 8 |
5. For each element nextSource of sources, in ascending index order, |
| 9 |
[...] |
| 10 |
c. Repeat for each element nextKey of keys in List order, |
| 11 |
i. Let desc be from.[[GetOwnProperty]](nextKey). |
| 12 |
ii. ReturnIfAbrupt(desc). |
| 13 |
iii. if desc is not undefined and desc.[[Enumerable]] is true, then |
| 14 |
features: [Proxy] |
| 15 |
---*/ |
| 16 |
|
| 17 |
var callCount = 0; |
| 18 |
var target = {}; |
| 19 |
var result; |
| 20 |
var source = new Proxy({}, { |
| 21 |
ownKeys: function() { |
| 22 |
callCount += 1; |
| 23 |
return ['missing']; |
| 24 |
} |
| 25 |
}); |
| 26 |
|
| 27 |
result = Object.assign(target, source); |
| 28 |
|
| 29 |
assert.sameValue(callCount, 1, 'Proxy trap was invoked exactly once'); |
| 30 |
assert.sameValue( |
| 31 |
Object.hasOwnProperty.call(target, 'missing'), |
| 32 |
false, |
| 33 |
'An own property was not created for a property without a property descriptor' |
| 34 |
); |
| 35 |
assert.sameValue(result, target); |