Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: test/mjsunit/harmony/private.js

Issue 355123006: Make freeze & friends ignore private properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-types.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 var publicSymbol = Symbol() 335 var publicSymbol = Symbol()
336 var publicSymbol2 = Symbol() 336 var publicSymbol2 = Symbol()
337 var obj = {} 337 var obj = {}
338 obj[publicSymbol] = 1 338 obj[publicSymbol] = 1
339 obj[privateSymbol] = 2 339 obj[privateSymbol] = 2
340 obj[publicSymbol2] = 3 340 obj[publicSymbol2] = 3
341 var syms = Object.getOwnPropertySymbols(obj) 341 var syms = Object.getOwnPropertySymbols(obj)
342 assertEquals(syms, [publicSymbol, publicSymbol2]) 342 assertEquals(syms, [publicSymbol, publicSymbol2])
343 } 343 }
344 TestGetOwnPropertySymbols() 344 TestGetOwnPropertySymbols()
345
346
347 function TestSealAndFreeze(freeze) {
348 var sym = %CreatePrivateSymbol("private")
349 var obj = {}
350 obj[sym] = 1
351 freeze(obj)
352 obj[sym] = 2
353 assertEquals(2, obj[sym])
354 assertTrue(delete obj[sym])
355 assertEquals(undefined, obj[sym])
356 }
357 TestSealAndFreeze(Object.seal)
358 TestSealAndFreeze(Object.freeze)
359 TestSealAndFreeze(Object.preventExtensions)
OLDNEW
« no previous file with comments | « test/cctest/test-types.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698