OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 | 7 |
8 // Note in general that "arguments.foo" and "var o = arguments; o.foo" | 8 // Note in general that "arguments.foo" and "var o = arguments; o.foo" |
9 // are treated differently by full-codegen, and so both cases need to be | 9 // are treated differently by full-codegen, and so both cases need to be |
10 // tested. | 10 // tested. |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 o[Symbol.iterator] = 10; | 212 o[Symbol.iterator] = 10; |
213 assertTrue(o.hasOwnProperty(Symbol.iterator)); | 213 assertTrue(o.hasOwnProperty(Symbol.iterator)); |
214 assertEquals(10, o[Symbol.iterator]); | 214 assertEquals(10, o[Symbol.iterator]); |
215 assertSame([][Symbol.iterator], arguments[Symbol.iterator]); | 215 assertSame([][Symbol.iterator], arguments[Symbol.iterator]); |
216 | 216 |
217 // Frozen o. | 217 // Frozen o. |
218 o = Object.freeze({__proto__:arguments}); | 218 o = Object.freeze({__proto__:arguments}); |
219 assertSame([][Symbol.iterator], o[Symbol.iterator]); | 219 assertSame([][Symbol.iterator], o[Symbol.iterator]); |
220 assertFalse(o.hasOwnProperty(Symbol.iterator)); | 220 assertFalse(o.hasOwnProperty(Symbol.iterator)); |
221 assertSame([][Symbol.iterator], o[Symbol.iterator]); | 221 assertSame([][Symbol.iterator], o[Symbol.iterator]); |
222 // This should throw, but currently it doesn't, because | 222 assertThrows(function () { o[Symbol.iterator] = 10 }); |
223 // ExecutableAccessorInfo callbacks don't see the current strict mode. | |
224 // See note in accessors.cc:SetPropertyOnInstanceIfInherited. | |
225 o[Symbol.iterator] = 10; | |
226 assertFalse(o.hasOwnProperty(Symbol.iterator)); | 223 assertFalse(o.hasOwnProperty(Symbol.iterator)); |
227 assertEquals([][Symbol.iterator], o[Symbol.iterator]); | 224 assertEquals([][Symbol.iterator], o[Symbol.iterator]); |
228 assertSame([][Symbol.iterator], arguments[Symbol.iterator]); | 225 assertSame([][Symbol.iterator], arguments[Symbol.iterator]); |
229 } | 226 } |
230 TestArgumentsAsProto(); | 227 TestArgumentsAsProto(); |
OLD | NEW |