| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 assertEquals(undefined, obj2[1]); | 81 assertEquals(undefined, obj2[1]); |
| 82 | 82 |
| 83 var arr = new Array(); | 83 var arr = new Array(); |
| 84 arr[1] = 10; | 84 arr[1] = 10; |
| 85 | 85 |
| 86 Object.preventExtensions(arr); | 86 Object.preventExtensions(arr); |
| 87 | 87 |
| 88 arr[2] = 42; | 88 arr[2] = 42; |
| 89 assertEquals(10, arr[1]); | 89 assertEquals(10, arr[1]); |
| 90 | 90 |
| 91 // We should still be able to change exiting elements. | 91 // We should still be able to change existing elements. |
| 92 arr[1]= 42; | 92 arr[1]= 42; |
| 93 assertEquals(42, arr[1]); | 93 assertEquals(42, arr[1]); |
| 94 | 94 |
| 95 | 95 |
| 96 // Test the the extensible flag is not inherited. | 96 // Test the the extensible flag is not inherited. |
| 97 var parent = {}; | 97 var parent = {}; |
| 98 parent.x = 42; | 98 parent.x = 42; |
| 99 Object.preventExtensions(parent); | 99 Object.preventExtensions(parent); |
| 100 | 100 |
| 101 var child = Object.create(parent); | 101 var child = Object.create(parent); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 obj = { prop1: 1, prop2: 2, 75: 'foo' }; | 153 obj = { prop1: 1, prop2: 2, 75: 'foo' }; |
| 154 obj2 = { prop1: 3, prop2: 4, 150: 'bar' }; | 154 obj2 = { prop1: 3, prop2: 4, 150: 'bar' }; |
| 155 assertTrue(%HaveSameMap(obj, obj2)); | 155 assertTrue(%HaveSameMap(obj, obj2)); |
| 156 Object.preventExtensions(obj); | 156 Object.preventExtensions(obj); |
| 157 Object.preventExtensions(obj2); | 157 Object.preventExtensions(obj2); |
| 158 assertFalse(Object.isExtensible(obj)); | 158 assertFalse(Object.isExtensible(obj)); |
| 159 assertFalse(Object.isExtensible(obj2)); | 159 assertFalse(Object.isExtensible(obj2)); |
| 160 assertFalse(Object.isSealed(obj)); | 160 assertFalse(Object.isSealed(obj)); |
| 161 assertFalse(Object.isSealed(obj2)); | 161 assertFalse(Object.isSealed(obj2)); |
| 162 assertTrue(%HaveSameMap(obj, obj2)); | 162 assertTrue(%HaveSameMap(obj, obj2)); |
| OLD | NEW |