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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 }); | 65 }); |
66 return result; | 66 return result; |
67 } | 67 } |
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 non-strict mode | 75 obj[name] = val; // bad behavior when set fails in sloppy mode |
76 return true; | 76 return true; |
77 }, | 77 }, |
78 enumerate: function() { | 78 enumerate: function() { |
79 var result = []; | 79 var result = []; |
80 for (var name in obj) { result.push(name); }; | 80 for (var name in obj) { result.push(name); }; |
81 return result; | 81 return result; |
82 }, | 82 }, |
83 keys: function() { return Object.keys(obj); } | 83 keys: function() { return Object.keys(obj); } |
84 }; | 84 }; |
85 } | 85 } |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 assertThrows(function() { w[1] }, Error) | 503 assertThrows(function() { w[1] }, Error) |
504 assertThrows(function() { w.c }, Error) | 504 assertThrows(function() { w.c }, Error) |
505 assertThrows(function() { wb.bb }, Error) | 505 assertThrows(function() { wb.bb }, Error) |
506 assertEquals(3, wr.a) | 506 assertEquals(3, wr.a) |
507 assertThrows(function() { wf(4) }, Error) | 507 assertThrows(function() { wf(4) }, Error) |
508 assertEquals(6, wfx.a) | 508 assertEquals(6, wfx.a) |
509 assertEquals(7, wgx.aa) | 509 assertEquals(7, wgx.aa) |
510 assertThrows(function() { wh4.q }, Error) | 510 assertThrows(function() { wh4.q }, Error) |
511 assertThrows(function() { ws5.x }, Error) | 511 assertThrows(function() { ws5.x }, Error) |
512 assertThrows(function() { ws5x.y }, Error) | 512 assertThrows(function() { ws5x.y }, Error) |
OLD | NEW |