OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 for (var i = 1; i < symbols.length; i += 2) { | 234 for (var i = 1; i < symbols.length; i += 2) { |
235 Object.defineProperty(obj, symbols[i], {value: i, configurable: true}) | 235 Object.defineProperty(obj, symbols[i], {value: i, configurable: true}) |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 | 239 |
240 function TestKeyGet(obj) { | 240 function TestKeyGet(obj) { |
241 var obj2 = Object.create(obj) | 241 var obj2 = Object.create(obj) |
242 for (var i in symbols) { | 242 for (var i in symbols) { |
243 assertEquals(i|0, obj[symbols[i]]) | 243 assertEquals(i|0, obj[symbols[i]]) |
244 assertEquals(i|0, obj2[symbols[i]]) | 244 // Private symbols key own-properties.. |
rossberg
2015/06/15 12:09:11
Nit: extra period
wingo
2015/06/16 07:09:45
Done.
| |
245 assertEquals(undefined, obj2[symbols[i]]) | |
245 } | 246 } |
246 } | 247 } |
247 | 248 |
248 | 249 |
249 function TestKeyHas() { | 250 function TestKeyHas() { |
250 for (var i in symbols) { | 251 for (var i in symbols) { |
251 assertTrue(symbols[i] in obj) | 252 assertTrue(symbols[i] in obj) |
252 assertTrue(Object.hasOwnProperty.call(obj, symbols[i])) | 253 assertTrue(Object.hasOwnProperty.call(obj, symbols[i])) |
253 } | 254 } |
254 } | 255 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 obj[sym] = 1 | 346 obj[sym] = 1 |
346 freeze(obj) | 347 freeze(obj) |
347 obj[sym] = 2 | 348 obj[sym] = 2 |
348 assertEquals(2, obj[sym]) | 349 assertEquals(2, obj[sym]) |
349 assertTrue(delete obj[sym]) | 350 assertTrue(delete obj[sym]) |
350 assertEquals(undefined, obj[sym]) | 351 assertEquals(undefined, obj[sym]) |
351 } | 352 } |
352 TestSealAndFreeze(Object.seal) | 353 TestSealAndFreeze(Object.seal) |
353 TestSealAndFreeze(Object.freeze) | 354 TestSealAndFreeze(Object.freeze) |
354 TestSealAndFreeze(Object.preventExtensions) | 355 TestSealAndFreeze(Object.preventExtensions) |
OLD | NEW |