| 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 var e = new Error(); | 28 var e = new Error(); |
| 29 assertFalse(e.hasOwnProperty('message')); | 29 assertFalse(e.hasOwnProperty('message')); |
| 30 Error.prototype.toString = Object.prototype.toString; | 30 Error.prototype.toString = Object.prototype.toString; |
| 31 assertEquals("[object Error]", Error.prototype.toString()); | 31 assertEquals("[object Error]", Error.prototype.toString()); |
| 32 assertEquals(Object.prototype, Error.prototype.__proto__); | 32 assertEquals(Object.prototype, Error.prototype.__proto__); |
| 33 | 33 |
| 34 // Check that error construction does not call setters for the | 34 // Check that error construction does not call setters for the |
| 35 // properties on error objects in prototypes. | 35 // properties on error objects in prototypes. |
| 36 function fail() { assertTrue(false); }; | 36 function fail() { assertTrue(false); } |
| 37 ReferenceError.prototype.__defineSetter__('stack', fail); | 37 ReferenceError.prototype.__defineSetter__('stack', fail); |
| 38 ReferenceError.prototype.__defineSetter__('message', fail); | 38 ReferenceError.prototype.__defineSetter__('message', fail); |
| 39 ReferenceError.prototype.__defineSetter__('type', fail); | 39 ReferenceError.prototype.__defineSetter__('type', fail); |
| 40 ReferenceError.prototype.__defineSetter__('arguments', fail); | 40 ReferenceError.prototype.__defineSetter__('arguments', fail); |
| 41 var e0 = new ReferenceError(); | 41 var e0 = new ReferenceError(); |
| 42 var e1 = new ReferenceError('123'); | 42 var e1 = new ReferenceError('123'); |
| 43 assertTrue(e1.hasOwnProperty('message')); | 43 assertTrue(e1.hasOwnProperty('message')); |
| 44 assertTrue(e0.hasOwnProperty('stack')); | 44 assertTrue(e0.hasOwnProperty('stack')); |
| 45 assertTrue(e1.hasOwnProperty('stack')); | 45 assertTrue(e1.hasOwnProperty('stack')); |
| 46 assertTrue(e0.hasOwnProperty('type')); | 46 assertTrue(e0.hasOwnProperty('type')); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 73 desc = Object.getOwnPropertyDescriptor(e, 'type'); | 73 desc = Object.getOwnPropertyDescriptor(e, 'type'); |
| 74 assertFalse(desc['enumerable']); | 74 assertFalse(desc['enumerable']); |
| 75 desc = Object.getOwnPropertyDescriptor(e, 'stack'); | 75 desc = Object.getOwnPropertyDescriptor(e, 'stack'); |
| 76 assertFalse(desc['enumerable']); | 76 assertFalse(desc['enumerable']); |
| 77 | 77 |
| 78 // name is not tested above, but in addition we should have no enumerable | 78 // name is not tested above, but in addition we should have no enumerable |
| 79 // properties, so we simply assert that. | 79 // properties, so we simply assert that. |
| 80 for (var v in e) { | 80 for (var v in e) { |
| 81 assertUnreachable(); | 81 assertUnreachable(); |
| 82 } | 82 } |
| OLD | NEW |