Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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,
| |
| OLD | NEW |