| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 assertFalse(desc.configurable); | 92 assertFalse(desc.configurable); |
| 93 assertEquals("foobar", desc.value); | 93 assertEquals("foobar", desc.value); |
| 94 | 94 |
| 95 // Since writable is not affected by seal we should still be able to | 95 // Since writable is not affected by seal we should still be able to |
| 96 // update the values. | 96 // update the values. |
| 97 obj.x = "43"; | 97 obj.x = "43"; |
| 98 assertEquals("43", obj.x); | 98 assertEquals("43", obj.x); |
| 99 | 99 |
| 100 // Test on accessors. | 100 // Test on accessors. |
| 101 var obj2 = {}; | 101 var obj2 = {}; |
| 102 function get() { return 43; }; | 102 function get() { return 43; } |
| 103 function set() {}; | 103 function set() {} |
| 104 Object.defineProperty(obj2, 'x', { get: get, set: set, configurable: true }); | 104 Object.defineProperty(obj2, 'x', { get: get, set: set, configurable: true }); |
| 105 | 105 |
| 106 desc = Object.getOwnPropertyDescriptor(obj2, 'x'); | 106 desc = Object.getOwnPropertyDescriptor(obj2, 'x'); |
| 107 assertTrue(desc.configurable); | 107 assertTrue(desc.configurable); |
| 108 assertEquals(undefined, desc.value); | 108 assertEquals(undefined, desc.value); |
| 109 assertEquals(set, desc.set); | 109 assertEquals(set, desc.set); |
| 110 assertEquals(get, desc.get); | 110 assertEquals(get, desc.get); |
| 111 | 111 |
| 112 assertTrue(Object.isExtensible(obj2)); | 112 assertTrue(Object.isExtensible(obj2)); |
| 113 assertFalse(Object.isSealed(obj2)); | 113 assertFalse(Object.isSealed(obj2)); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 var obj4 = {}; | 185 var obj4 = {}; |
| 186 Object.defineProperty(obj4, 'x', {configurable: true, writable: false}); | 186 Object.defineProperty(obj4, 'x', {configurable: true, writable: false}); |
| 187 Object.defineProperty(obj4, 'y', {configurable: false, writable: false}); | 187 Object.defineProperty(obj4, 'y', {configurable: false, writable: false}); |
| 188 Object.preventExtensions(obj4); | 188 Object.preventExtensions(obj4); |
| 189 | 189 |
| 190 assertFalse(Object.isSealed(obj4)); | 190 assertFalse(Object.isSealed(obj4)); |
| 191 | 191 |
| 192 // Make sure that Object.seal returns the sealed object. | 192 // Make sure that Object.seal returns the sealed object. |
| 193 var obj4 = {}; | 193 var obj4 = {}; |
| 194 assertTrue(obj4 === Object.seal(obj4)); | 194 assertTrue(obj4 === Object.seal(obj4)); |
| OLD | NEW |