Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: test/mjsunit/object-define-property.js

Issue 351853005: Split SetProperty(...attributes, strictmode) into AddProperty(...attributes) and SetProperty(...… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/mjsunit/regress/regress-1199637.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 DefineOrRedefineDataProperty and 470 // Test runtime calls to DefineDataPropertyUnchecked and
471 // DefineOrRedefineAccessorProperty - make sure we don't 471 // DefineAccessorPropertyUnchecked - make sure we don't
472 // crash. 472 // crash.
473 try { 473 try {
474 %DefineOrRedefineAccessorProperty(0, 0, 0, 0, 0); 474 %DefineAccessorPropertyUnchecked(0, 0, 0, 0, 0);
475 } catch (e) { 475 } catch (e) {
476 assertTrue(/illegal access/.test(e)); 476 assertTrue(/illegal access/.test(e));
477 } 477 }
478 478
479 try { 479 try {
480 %DefineOrRedefineDataProperty(0, 0, 0, 0); 480 %DefineDataPropertyUnchecked(0, 0, 0, 0);
481 } catch (e) { 481 } catch (e) {
482 assertTrue(/illegal access/.test(e)); 482 assertTrue(/illegal access/.test(e));
483 } 483 }
484 484
485 try { 485 try {
486 %DefineOrRedefineDataProperty(null, null, null, null); 486 %DefineDataPropertyUnchecked(null, null, null, null);
487 } catch (e) { 487 } catch (e) {
488 assertTrue(/illegal access/.test(e)); 488 assertTrue(/illegal access/.test(e));
489 } 489 }
490 490
491 try { 491 try {
492 %DefineOrRedefineAccessorProperty(null, null, null, null, null); 492 %DefineAccessorPropertyUnchecked(null, null, null, null, null);
493 } catch (e) { 493 } catch (e) {
494 assertTrue(/illegal access/.test(e)); 494 assertTrue(/illegal access/.test(e));
495 } 495 }
496 496
497 try { 497 try {
498 %DefineOrRedefineDataProperty({}, null, null, null); 498 %DefineDataPropertyUnchecked({}, null, null, null);
499 } catch (e) { 499 } catch (e) {
500 assertTrue(/illegal access/.test(e)); 500 assertTrue(/illegal access/.test(e));
501 } 501 }
502 502
503 // Defining properties null should fail even when we have 503 // Defining properties null should fail even when we have
504 // other allowed values 504 // other allowed values
505 try { 505 try {
506 %DefineOrRedefineAccessorProperty(null, 'foo', func, null, 0); 506 %DefineAccessorPropertyUnchecked(null, 'foo', func, null, 0);
507 } catch (e) { 507 } catch (e) {
508 assertTrue(/illegal access/.test(e)); 508 assertTrue(/illegal access/.test(e));
509 } 509 }
510 510
511 try { 511 try {
512 %DefineOrRedefineDataProperty(null, 'foo', 0, 0); 512 %DefineDataPropertyUnchecked(null, 'foo', 0, 0);
513 } catch (e) { 513 } catch (e) {
514 assertTrue(/illegal access/.test(e)); 514 assertTrue(/illegal access/.test(e));
515 } 515 }
516 516
517 // Test that all possible differences in step 6 in DefineOwnProperty are 517 // Test that all possible differences in step 6 in DefineOwnProperty are
518 // exercised, i.e., any difference in the given property descriptor and the 518 // exercised, i.e., any difference in the given property descriptor and the
519 // existing properties should not return true, but throw an error if the 519 // existing properties should not return true, but throw an error if the
520 // existing configurable property is false. 520 // existing configurable property is false.
521 521
522 var obj5 = {}; 522 var obj5 = {};
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 Assign(new C); 1197 Assign(new C);
1198 1198
1199 // Test that changes to the prototype of a simple constructor are not ignored, 1199 // Test that changes to the prototype of a simple constructor are not ignored,
1200 // even after creating initial instances. 1200 // even after creating initial instances.
1201 function C() { 1201 function C() {
1202 this.x = 23; 1202 this.x = 23;
1203 } 1203 }
1204 assertEquals(23, new C().x); 1204 assertEquals(23, new C().x);
1205 C.prototype.__defineSetter__('x', function(value) { this.y = 23; }); 1205 C.prototype.__defineSetter__('x', function(value) { this.y = 23; });
1206 assertEquals(void 0, new C().x); 1206 assertEquals(void 0, new C().x);
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/mjsunit/regress/regress-1199637.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698