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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 assertFalse(Object.prototype.hasOwnProperty.call(o, "p_throw")); | 642 assertFalse(Object.prototype.hasOwnProperty.call(o, "p_throw")); |
643 | 643 |
644 assertThrows(function(){ o.p_setterthrow = 52 }, "myexn") | 644 assertThrows(function(){ o.p_setterthrow = 52 }, "myexn") |
645 assertEquals("p_setterthrow", key) | 645 assertEquals("p_setterthrow", key) |
646 assertFalse(Object.prototype.hasOwnProperty.call(o, "p_setterthrow")); | 646 assertFalse(Object.prototype.hasOwnProperty.call(o, "p_setterthrow")); |
647 } | 647 } |
648 | 648 |
649 | 649 |
650 TestSetForDerived( | 650 TestSetForDerived( |
651 function(k) { | 651 function(k) { |
| 652 // TODO(yangguo): issue 2398 - throwing an error causes formatting of |
| 653 // the message string, which can be observable through this handler. |
| 654 // We ignore keys that occur when formatting the message string. |
| 655 if (k == "toString" || k == "valueOf") return; |
| 656 |
652 key = k; | 657 key = k; |
653 switch (k) { | 658 switch (k) { |
654 case "p_writable": return {writable: true, configurable: true} | 659 case "p_writable": return {writable: true, configurable: true} |
655 case "p_nonwritable": return {writable: false, configurable: true} | 660 case "p_nonwritable": return {writable: false, configurable: true} |
656 case "p_setter": return { | 661 case "p_setter": return { |
657 set: function(x) { rec = this; val = x }, | 662 set: function(x) { rec = this; val = x }, |
658 configurable: true | 663 configurable: true |
659 } | 664 } |
660 case "p_nosetter": return { | 665 case "p_nosetter": return { |
661 get: function() { return 1 }, | 666 get: function() { return 1 }, |
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 function TestConstructorWithProxyPrototype2(create, handler) { | 2292 function TestConstructorWithProxyPrototype2(create, handler) { |
2288 function C() {}; | 2293 function C() {}; |
2289 C.prototype = create(handler); | 2294 C.prototype = create(handler); |
2290 | 2295 |
2291 var o = new C; | 2296 var o = new C; |
2292 assertSame(C.prototype, o.__proto__); | 2297 assertSame(C.prototype, o.__proto__); |
2293 assertSame(C.prototype, Object.getPrototypeOf(o)); | 2298 assertSame(C.prototype, Object.getPrototypeOf(o)); |
2294 } | 2299 } |
2295 | 2300 |
2296 TestConstructorWithProxyPrototype(); | 2301 TestConstructorWithProxyPrototype(); |
OLD | NEW |