OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // As long as obj is not frozen, the proxy won't allow itself to be fixed | 68 // As long as obj is not frozen, the proxy won't allow itself to be fixed |
69 return undefined; // will cause a TypeError to be thrown | 69 return undefined; // will cause a TypeError to be thrown |
70 }, | 70 }, |
71 has: function(name) { return name in obj; }, | 71 has: function(name) { return name in obj; }, |
72 hasOwn: function(name) { return ({}).hasOwnProperty.call(obj, name); }, | 72 hasOwn: function(name) { return ({}).hasOwnProperty.call(obj, name); }, |
73 get: function(receiver, name) { return obj[name]; }, | 73 get: function(receiver, name) { return obj[name]; }, |
74 set: function(receiver, name, val) { | 74 set: function(receiver, name, val) { |
75 obj[name] = val; // bad behavior when set fails in sloppy mode | 75 obj[name] = val; // bad behavior when set fails in sloppy mode |
76 return true; | 76 return true; |
77 }, | 77 }, |
78 enumerate: function() { | |
79 var result = []; | |
80 for (var name in obj) { result.push(name); }; | |
81 return result; | |
82 }, | |
83 keys: function() { return Object.keys(obj); } | 78 keys: function() { return Object.keys(obj); } |
84 }; | 79 }; |
85 } | 80 } |
86 | 81 |
87 | 82 |
88 | 83 |
89 // Auxiliary definitions enabling tracking of object identity in output. | 84 // Auxiliary definitions enabling tracking of object identity in output. |
90 | 85 |
91 var objectMap = new WeakMap; | 86 var objectMap = new WeakMap; |
92 var objectCounter = 0; | 87 var objectCounter = 0; |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 assertThrows(function() { w[1] }, Error) | 498 assertThrows(function() { w[1] }, Error) |
504 assertThrows(function() { w.c }, Error) | 499 assertThrows(function() { w.c }, Error) |
505 assertThrows(function() { wb.bb }, Error) | 500 assertThrows(function() { wb.bb }, Error) |
506 assertEquals(3, wr.a) | 501 assertEquals(3, wr.a) |
507 assertThrows(function() { wf(4) }, Error) | 502 assertThrows(function() { wf(4) }, Error) |
508 assertEquals(6, wfx.a) | 503 assertEquals(6, wfx.a) |
509 assertEquals(7, wgx.aa) | 504 assertEquals(7, wgx.aa) |
510 assertThrows(function() { wh4.q }, Error) | 505 assertThrows(function() { wh4.q }, Error) |
511 assertThrows(function() { ws5.x }, Error) | 506 assertThrows(function() { ws5.x }, Error) |
512 assertThrows(function() { ws5x.y }, Error) | 507 assertThrows(function() { ws5x.y }, Error) |
OLD | NEW |