| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 // Make sure an error is thrown when trying to access to redefined function. | 461 // Make sure an error is thrown when trying to access to redefined function. |
| 462 try { | 462 try { |
| 463 obj4.bar(); | 463 obj4.bar(); |
| 464 assertTrue(false); | 464 assertTrue(false); |
| 465 } catch (e) { | 465 } catch (e) { |
| 466 assertTrue(/is not a function/.test(e)); | 466 assertTrue(/is not a function/.test(e)); |
| 467 } | 467 } |
| 468 | 468 |
| 469 | 469 |
| 470 // Test runtime calls to DefineAccessorPropertyUnchecked - make sure we don't | |
| 471 // crash. | |
| 472 try { | |
| 473 %DefineAccessorPropertyUnchecked(0, 0, 0, 0, 0); | |
| 474 } catch (e) { | |
| 475 assertTrue(/illegal access/.test(e)); | |
| 476 } | |
| 477 | |
| 478 try { | |
| 479 %DefineAccessorPropertyUnchecked(null, null, null, null, null); | |
| 480 } catch (e) { | |
| 481 assertTrue(/illegal access/.test(e)); | |
| 482 } | |
| 483 | |
| 484 // Defining properties null should fail even when we have | |
| 485 // other allowed values | |
| 486 try { | |
| 487 %DefineAccessorPropertyUnchecked(null, 'foo', func, null, 0); | |
| 488 } catch (e) { | |
| 489 assertTrue(/illegal access/.test(e)); | |
| 490 } | |
| 491 | |
| 492 // Test that all possible differences in step 6 in DefineOwnProperty are | 470 // Test that all possible differences in step 6 in DefineOwnProperty are |
| 493 // exercised, i.e., any difference in the given property descriptor and the | 471 // exercised, i.e., any difference in the given property descriptor and the |
| 494 // existing properties should not return true, but throw an error if the | 472 // existing properties should not return true, but throw an error if the |
| 495 // existing configurable property is false. | 473 // existing configurable property is false. |
| 496 | 474 |
| 497 var obj5 = {}; | 475 var obj5 = {}; |
| 498 // Enumerable will default to false. | 476 // Enumerable will default to false. |
| 499 Object.defineProperty(obj5, 'foo', accessorNoConfigurable); | 477 Object.defineProperty(obj5, 'foo', accessorNoConfigurable); |
| 500 desc = Object.getOwnPropertyDescriptor(obj5, 'foo'); | 478 desc = Object.getOwnPropertyDescriptor(obj5, 'foo'); |
| 501 // First, test that we are actually allowed to set the accessor if all | 479 // First, test that we are actually allowed to set the accessor if all |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 Assign(new C); | 1150 Assign(new C); |
| 1173 | 1151 |
| 1174 // Test that changes to the prototype of a simple constructor are not ignored, | 1152 // Test that changes to the prototype of a simple constructor are not ignored, |
| 1175 // even after creating initial instances. | 1153 // even after creating initial instances. |
| 1176 function C() { | 1154 function C() { |
| 1177 this.x = 23; | 1155 this.x = 23; |
| 1178 } | 1156 } |
| 1179 assertEquals(23, new C().x); | 1157 assertEquals(23, new C().x); |
| 1180 C.prototype.__defineSetter__('x', function(value) { this.y = 23; }); | 1158 C.prototype.__defineSetter__('x', function(value) { this.y = 23; }); |
| 1181 assertEquals(void 0, new C().x); | 1159 assertEquals(void 0, new C().x); |
| OLD | NEW |