diff --git a/test/built-ins/Proxy/enumerate/call-parameters.js b/test/built-ins/Proxy/enumerate/call-parameters.js deleted file mode 100644 index b87cbace43ff681d19af314507f1b8973470a202..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/call-parameters.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - Trap called as trap.call(handler, target) -info: > - [[Enumerate]] () - - 8. Let trapResult be Call(trap, handler, «target»). ----*/ - -var x, _target, _handler; -var target = { - attr: 1 -}; -var handler = { - enumerate: function(t) { - _target = t; - _handler = this; - } -}; -var p = new Proxy(target, handler); - -try { - for (x in p) {} -} catch(e) {} - -assert.sameValue(_handler, handler); -assert.sameValue(_target, target); diff --git a/test/built-ins/Proxy/enumerate/null-handler.js b/test/built-ins/Proxy/enumerate/null-handler.js deleted file mode 100644 index de38e6622906b2eb084888cce9b43d6334ddcc14..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/null-handler.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - 2. If handler is null, throw a TypeError exception. ----*/ - -var x; -var p = Proxy.revocable({}, {}); - -p.revoke(); - -assert.throws(TypeError, function() { - for (x in p.proxy) { - x; - } -}); diff --git a/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js b/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js new file mode 100644 index 0000000000000000000000000000000000000000..d4e32e402aef0ea9f077def8eb069351249cb762 --- /dev/null +++ b/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +id: sec-proxy-object-internal-methods-and-internal-slots +description: > + Enumerate trap was removed and it should not be triggered anymore. +includes: [compareArray.js] +features: [Symbol.iterator] +---*/ + +var x; +var target = [1, 2, 3]; +var p = new Proxy(target, { + enumerate: function() { + throw new Test262Error( + "An enumerate property on handler object shouldn't trigger a Proxy trap" + ); + } +}); + +var forInResults = []; +for (x in p) { + forInResults.push(x); +} + +assert(compareArray(forInResults, ["0", "1", "2"])); + +var forOfResults = []; +for (x of p) { + forOfResults.push(x); +} + +assert(compareArray(forOfResults, [1, 2, 3])); + +var itor = p[Symbol.iterator](); +var next = itor.next(); +assert.sameValue(next.value, 1); +assert.sameValue(next.done, false); +next = itor.next(); +assert.sameValue(next.value, 2); +assert.sameValue(next.done, false); +next = itor.next(); +assert.sameValue(next.value, 3); +assert.sameValue(next.done, false); +next = itor.next(); +assert.sameValue(next.value, undefined); +assert.sameValue(next.done, true); diff --git a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-boolean.js b/test/built-ins/Proxy/enumerate/result-not-an-object-throws-boolean.js deleted file mode 100644 index 05fcd28b9b8dea2312881b45e626ae1c800e54cf..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-boolean.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - The result must be an Object ----*/ - -var x; -var target = { - attr: 1 -}; -var p = new Proxy(target, { - enumerate: function() { - return true; - } -}); - -assert.throws(TypeError, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-number.js b/test/built-ins/Proxy/enumerate/result-not-an-object-throws-number.js deleted file mode 100644 index acd98fb004cc972d2688282c04a4dea5a955f071..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-number.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - The result must be an Object ----*/ - -var x; -var target = { - attr: 1 -}; -var p = new Proxy(target, { - enumerate: function() { - return 1; - } -}); - -assert.throws(TypeError, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-string.js b/test/built-ins/Proxy/enumerate/result-not-an-object-throws-string.js deleted file mode 100644 index 71a63f9c7f00fe046f285660f99ec67415af99aa..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-string.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - The result must be an Object ----*/ - -var x; -var target = { - attr: 1 -}; -var p = new Proxy(target, { - enumerate: function() { - return ""; - } -}); - -assert.throws(TypeError, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-symbol.js b/test/built-ins/Proxy/enumerate/result-not-an-object-throws-symbol.js deleted file mode 100644 index f17559d24b8ab2611a6bca279c07801b22d6b5bc..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-symbol.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - The result must be an Object -features: [Symbol] ----*/ - -var x; -var target = { - attr: 1 -}; -var p = new Proxy(target, { - enumerate: function() { - return Symbol(); - } -}); - -assert.throws(TypeError, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-undefined.js b/test/built-ins/Proxy/enumerate/result-not-an-object-throws-undefined.js deleted file mode 100644 index 6e0651ce984fd14e5e3460c033c642a8c0ad6296..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/result-not-an-object-throws-undefined.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - The result must be an Object ----*/ - -var x; -var target = { - attr: 1 -}; -var p = new Proxy(target, { - enumerate: function() { - return undefined; - } -}); - -assert.throws(TypeError, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/return-is-abrupt.js b/test/built-ins/Proxy/enumerate/return-is-abrupt.js deleted file mode 100644 index e669e178869b0fdfd2ac03bc6e4eda3f97555895..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/return-is-abrupt.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - Trap returns abrupt. -info: > - [[Enumerate]] () - - 8. Let trapResult be Call(trap, handler, «target»). - 9. ReturnIfAbrupt(trapResult). ----*/ - -var x; -var p = new Proxy({}, { - enumerate: function(t) { - throw new Test262Error(); - } -}); - -assert.throws(Test262Error, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/return-trap-result-no-value.js b/test/built-ins/Proxy/enumerate/return-trap-result-no-value.js deleted file mode 100644 index 208150d55dc4dda2e615da636a0c30e494ab1571..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/return-trap-result-no-value.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - Trap returns an iterator whose IteratorResult does not contain a value - property. -info: > - [[Enumerate]] () - - 11. Return trapResult ----*/ - -var x; -var p = new Proxy([1,2,3], { - enumerate: function(t) { - return {next: function() { return { done:true }; } }; - } -}); - -for (x in p) { - $ERROR("returned iterable interface from trap is flagged as done."); -} diff --git a/test/built-ins/Proxy/enumerate/return-trap-result.js b/test/built-ins/Proxy/enumerate/return-trap-result.js deleted file mode 100644 index 7d4678def2373c943f69d340893ad942c22fa093..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/return-trap-result.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - Trap returns a iterable result. -info: > - [[Enumerate]] () - - 11. Return trapResult -includes: [compareArray.js] ----*/ - -var x; -var iter = [ - {done: false, value: 1}, - {done: false, value: 2}, - {done: false, value: 3}, - {done: true, value: 42} -]; -var target = { - attr: 1 -}; -var foo = { bar: 1 }; -var p = new Proxy(target, { - enumerate: function() { - return { next: function() { return iter.shift(); } }; - } -}); - -var results = []; -for (x in p) { - results.push(x); -} - -assert(compareArray(results, [1,2,3])); diff --git a/test/built-ins/Proxy/enumerate/trap-is-not-callable.js b/test/built-ins/Proxy/enumerate/trap-is-not-callable.js deleted file mode 100644 index 1af02ef4c229f5c837126542023284afef7a2b90..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/trap-is-not-callable.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - Trap is not callable. -info: > - [[Enumerate]] () - - 5. Let trap be GetMethod(handler, "enumerate"). - ... - - 7.3.9 GetMethod (O, P) - - 5. If IsCallable(func) is false, throw a TypeError exception. ----*/ - -var x; -var p = new Proxy({attr:1}, { - enumerate: {} -}); - -assert.throws(TypeError, function() { - for (x in p) {} -}); diff --git a/test/built-ins/Proxy/enumerate/trap-is-undefined.js b/test/built-ins/Proxy/enumerate/trap-is-undefined.js deleted file mode 100644 index 71efad48d20b68cc69cc78a5be840f6f1c2e221f..0000000000000000000000000000000000000000 --- a/test/built-ins/Proxy/enumerate/trap-is-undefined.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 9.5.11 -description: > - [[Enumerate]] () - - 7. If trap is undefined, then Return target.[[Enumerate]](). ----*/ - -var x; -var target = { - attr: 1 -}; -var p = new Proxy(target, {}); - -var count = 0; -for (x in p) { - count++; -} - -assert.sameValue(count, 1); diff --git a/test/built-ins/Reflect/enumerate/does-not-iterate-over-symbol-properties.js b/test/built-ins/Reflect/enumerate/does-not-iterate-over-symbol-properties.js deleted file mode 100644 index 95d038ee5d1b663e1253d43a17b60d1ab77b3813..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/does-not-iterate-over-symbol-properties.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2015 Leonardo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Returned iterator does not iterate over symbol properties. -info: > - 26.1.5 Reflect.enumerate ( target ) - - ... - 2. Return target.[[Enumerate]](). -features: [Symbol] ----*/ - -var iter, step; -var s = Symbol('1'); - -var o = { - 'a': 1, - 'b': 1 -}; - -o[s] = 1; - -iter = Reflect.enumerate(o); - -step = iter.next(); -assert.sameValue(step.value, 'a'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, 'b'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, undefined); -assert.sameValue(step.done, true); diff --git a/test/built-ins/Reflect/enumerate/enumerate.js b/test/built-ins/Reflect/enumerate/enumerate.js deleted file mode 100644 index 845084e5a21124fab14595d62f92cbea29d7405d..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/enumerate.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Reflect.enumerate is configurable, writable and not enumerable. -info: > - 26.1.5 Reflect.enumerate ( target ) - - 17 ECMAScript Standard Built-in Objects - -includes: [propertyHelper.js] ----*/ - -verifyNotEnumerable(Reflect, 'enumerate'); -verifyWritable(Reflect, 'enumerate'); -verifyConfigurable(Reflect, 'enumerate'); diff --git a/test/built-ins/Reflect/enumerate/length.js b/test/built-ins/Reflect/enumerate/length.js deleted file mode 100644 index 66c9361662607c4ae2458df8f3da350304367884..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/length.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Reflect.enumerate.length value and property descriptor -includes: [propertyHelper.js] ----*/ - -assert.sameValue( - Reflect.enumerate.length, 1, - 'The value of `Reflect.enumerate.length` is `1`' -); - -verifyNotEnumerable(Reflect.enumerate, 'length'); -verifyNotWritable(Reflect.enumerate, 'length'); -verifyConfigurable(Reflect.enumerate, 'length'); diff --git a/test/built-ins/Reflect/enumerate/name.js b/test/built-ins/Reflect/enumerate/name.js deleted file mode 100644 index 2f210a14c9519a34170aee0e06ee03a4fd255c4f..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/name.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Reflect.enumerate.name value and property descriptor -info: > - 26.1.5 Reflect.enumerate ( target ) - - 17 ECMAScript Standard Built-in Objects - -includes: [propertyHelper.js] ----*/ - -assert.sameValue( - Reflect.enumerate.name, 'enumerate', - 'The value of `Reflect.enumerate.name` is `"enumerate"`' -); - -verifyNotEnumerable(Reflect.enumerate, 'name'); -verifyNotWritable(Reflect.enumerate, 'name'); -verifyConfigurable(Reflect.enumerate, 'name'); diff --git a/test/built-ins/Reflect/enumerate/return-abrupt-from-result.js b/test/built-ins/Reflect/enumerate/return-abrupt-from-result.js deleted file mode 100644 index ce26191b151f6cb64bd9903d6eac2b2160966d96..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/return-abrupt-from-result.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Return abrupt result. -info: > - 26.1.5 Reflect.enumerate ( target ) - - ... - 2. Return target.[[Enumerate]](). -features: [Proxy] ----*/ - -var o = {}; -var p = new Proxy(o, { - enumerate: function() { - throw new Test262Error(); - } -}); - -assert.throws(Test262Error, function() { - Reflect.enumerate(p); -}); diff --git a/test/built-ins/Reflect/enumerate/return-iterator.js b/test/built-ins/Reflect/enumerate/return-iterator.js deleted file mode 100644 index 3d7c9f628864b44f7c042af25d16f40fbce92660..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/return-iterator.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Return an iterator. -info: > - 26.1.5 Reflect.enumerate ( target ) - - ... - 2. Return target.[[Enumerate]](). ----*/ - -var iter, step; -var arr = ['a', 'b', 'c']; - -iter = Reflect.enumerate(arr); - -step = iter.next(); -assert.sameValue(step.value, '0'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, '1'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, '2'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, undefined); -assert.sameValue(step.done, true); - -var o = { - 'a': 42, - 'b': 43, - 'c': 44 -}; - -Object.defineProperty(o, 'd', { - enumerable: false, - value: 45 -}); - -iter = Reflect.enumerate(o); - -step = iter.next(); -assert.sameValue(step.value, 'a'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, 'b'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, 'c'); -assert.sameValue(step.done, false); - -step = iter.next(); -assert.sameValue(step.value, undefined); -assert.sameValue(step.done, true); diff --git a/test/built-ins/Reflect/enumerate/target-is-not-object-throws.js b/test/built-ins/Reflect/enumerate/target-is-not-object-throws.js deleted file mode 100644 index 8c0dc61442ddab49b3cd89955cfa22fc9b55eed1..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/target-is-not-object-throws.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Throws a TypeError if target is not an Object. -info: > - 26.1.5 Reflect.enumerate ( target ) - - 1. If Type(target) is not Object, throw a TypeError exception. - ... ----*/ - -assert.throws(TypeError, function() { - Reflect.enumerate(1); -}); - -assert.throws(TypeError, function() { - Reflect.enumerate(null); -}); - -assert.throws(TypeError, function() { - Reflect.enumerate(undefined); -}); - -assert.throws(TypeError, function() { - Reflect.enumerate(''); -}); diff --git a/test/built-ins/Reflect/enumerate/target-is-symbol-throws.js b/test/built-ins/Reflect/enumerate/target-is-symbol-throws.js deleted file mode 100644 index f8377df5d3f7442fb83436b5c7339808f8a0c742..0000000000000000000000000000000000000000 --- a/test/built-ins/Reflect/enumerate/target-is-symbol-throws.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 26.1.5 -description: > - Throws a TypeError if target is a Symbol -info: > - 26.1.5 Reflect.enumerate ( target ) - - 1. If Type(target) is not Object, throw a TypeError exception. - ... -features: [Symbol] ----*/ - -assert.throws(TypeError, function() { - Reflect.enumerate(Symbol(1), 'p'); -}); diff --git a/test/built-ins/Reflect/enumerate/undefined.js b/test/built-ins/Reflect/enumerate/undefined.js new file mode 100644 index 0000000000000000000000000000000000000000..3d51c2453d20ba8b0df0374d96eaac745866fbd3 --- /dev/null +++ b/test/built-ins/Reflect/enumerate/undefined.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +id: sec-reflect-object +description: > + Reflect.enumerate was removed and it's not a function anymore +---*/ + +assert.sameValue(Reflect.hasOwnProperty("enumerate"), false); +assert.sameValue(Reflect.enumerate, undefined);