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

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

Issue 5773002: Fix issue 965. (Closed)
Patch Set: Created 10 years 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
« src/v8natives.js ('K') | « src/v8natives.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 assertFalse(desc.configurable); 859 assertFalse(desc.configurable);
860 860
861 // Define non existing property - all attributes should default to false. 861 // Define non existing property - all attributes should default to false.
862 Object.defineProperty(arr, '15', descElement); 862 Object.defineProperty(arr, '15', descElement);
863 desc = Object.getOwnPropertyDescriptor(arr, '15'); 863 desc = Object.getOwnPropertyDescriptor(arr, '15');
864 assertEquals(desc.value, 'foobar'); 864 assertEquals(desc.value, 'foobar');
865 assertFalse(desc.writable); 865 assertFalse(desc.writable);
866 assertFalse(desc.enumerable); 866 assertFalse(desc.enumerable);
867 assertFalse(desc.configurable); 867 assertFalse(desc.configurable);
868 868
869 // See issue 968: http://code.google.com/p/v8/issues/detail?id=968
870 var o = { x : 42 };
871 Object.defineProperty(o, "x", { writable: false });
872 assertEquals(42, o.x);
869 873
874 o = { x : 42 };
875 Object.defineProperty(o, "x", {});
876 assertEquals(42, o.x);
877 o.x = 37;
878 // Writability is preserved.
879 assertEquals(37, o.x);
880
Rico 2010/12/10 10:42:35 Maybe add an additional test that makes sure that
Lasse Reichstein 2010/12/10 11:21:45 More tests added, for both non-existing property,
OLDNEW
« src/v8natives.js ('K') | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698