| OLD | NEW |
| 1 // Copyright 2012-2015 the V8 project authors. All rights reserved. | 1 // Copyright 2012-2015 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 434 |
| 435 // Make sure an error is thrown when trying to access to redefined function. | 435 // Make sure an error is thrown when trying to access to redefined function. |
| 436 try { | 436 try { |
| 437 obj4.bar(); | 437 obj4.bar(); |
| 438 assertTrue(false); | 438 assertTrue(false); |
| 439 } catch (e) { | 439 } catch (e) { |
| 440 assertTrue(/is not a function/.test(e)); | 440 assertTrue(/is not a function/.test(e)); |
| 441 } | 441 } |
| 442 | 442 |
| 443 | 443 |
| 444 // Test runtime calls to DefineAccessorPropertyUnchecked - make sure we don't | |
| 445 // crash. | |
| 446 try { | |
| 447 %DefineAccessorPropertyUnchecked(0, 0, 0, 0, 0); | |
| 448 } catch (e) { | |
| 449 assertTrue(/illegal access/.test(e)); | |
| 450 } | |
| 451 | |
| 452 try { | |
| 453 %DefineAccessorPropertyUnchecked(null, null, null, null, null); | |
| 454 } catch (e) { | |
| 455 assertTrue(/illegal access/.test(e)); | |
| 456 } | |
| 457 | |
| 458 // Defining properties null should fail even when we have | |
| 459 // other allowed values | |
| 460 try { | |
| 461 %DefineAccessorPropertyUnchecked(null, 'foo', func, null, 0); | |
| 462 } catch (e) { | |
| 463 assertTrue(/illegal access/.test(e)); | |
| 464 } | |
| 465 | |
| 466 // Test that all possible differences in step 6 in DefineOwnProperty are | 444 // Test that all possible differences in step 6 in DefineOwnProperty are |
| 467 // exercised, i.e., any difference in the given property descriptor and the | 445 // exercised, i.e., any difference in the given property descriptor and the |
| 468 // existing properties should not return true, but throw an error if the | 446 // existing properties should not return true, but throw an error if the |
| 469 // existing configurable property is false. | 447 // existing configurable property is false. |
| 470 | 448 |
| 471 var obj5 = {}; | 449 var obj5 = {}; |
| 472 // Enumerable will default to false. | 450 // Enumerable will default to false. |
| 473 assertTrue(Reflect.defineProperty(obj5, 'foo', accessorNoConfigurable)); | 451 assertTrue(Reflect.defineProperty(obj5, 'foo', accessorNoConfigurable)); |
| 474 desc = Object.getOwnPropertyDescriptor(obj5, 'foo'); | 452 desc = Object.getOwnPropertyDescriptor(obj5, 'foo'); |
| 475 // First, test that we are actually allowed to set the accessor if all | 453 // First, test that we are actually allowed to set the accessor if all |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 Assign(new C); | 1059 Assign(new C); |
| 1082 | 1060 |
| 1083 // Test that changes to the prototype of a simple constructor are not ignored, | 1061 // Test that changes to the prototype of a simple constructor are not ignored, |
| 1084 // even after creating initial instances. | 1062 // even after creating initial instances. |
| 1085 function C() { | 1063 function C() { |
| 1086 this.x = 23; | 1064 this.x = 23; |
| 1087 } | 1065 } |
| 1088 assertEquals(23, new C().x); | 1066 assertEquals(23, new C().x); |
| 1089 C.prototype.__defineSetter__('x', function(value) { this.y = 23; }); | 1067 C.prototype.__defineSetter__('x', function(value) { this.y = 23; }); |
| 1090 assertEquals(void 0, new C().x); | 1068 assertEquals(void 0, new C().x); |
| OLD | NEW |