OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 21 matching lines...) Expand all Loading... |
32 // version back by deleting the new definition. | 32 // version back by deleting the new definition. |
33 | 33 |
34 var array; | 34 var array; |
35 | 35 |
36 array = [ | 36 array = [ |
37 "toString", "toLocaleString", "join", "pop", "push", "concat", "reverse", | 37 "toString", "toLocaleString", "join", "pop", "push", "concat", "reverse", |
38 "shift", "unshift", "slice", "splice", "sort", "filter", "forEach", "some", | 38 "shift", "unshift", "slice", "splice", "sort", "filter", "forEach", "some", |
39 "every", "map", "indexOf", "lastIndexOf", "reduce", "reduceRight"]; | 39 "every", "map", "indexOf", "lastIndexOf", "reduce", "reduceRight"]; |
40 CheckJSCSemantics(Array.prototype, array, "Array prototype"); | 40 CheckJSCSemantics(Array.prototype, array, "Array prototype"); |
41 | 41 |
| 42 var old_Array_prototype = Array.prototype; |
| 43 var new_Array_prototype = {}; |
| 44 for (var i = 0; i < 7; i++) { |
| 45 Array.prototype = new_Array_prototype; |
| 46 assertEquals(old_Array_prototype, Array.prototype); |
| 47 } |
| 48 |
42 array = [ | 49 array = [ |
43 "toString", "toDateString", "toTimeString", "toLocaleString", | 50 "toString", "toDateString", "toTimeString", "toLocaleString", |
44 "toLocaleDateString", "toLocaleTimeString", "valueOf", "getTime", | 51 "toLocaleDateString", "toLocaleTimeString", "valueOf", "getTime", |
45 "getFullYear", "getUTCFullYear", "getMonth", "getUTCMonth", "getDate", | 52 "getFullYear", "getUTCFullYear", "getMonth", "getUTCMonth", "getDate", |
46 "getUTCDate", "getDay", "getUTCDay", "getHours", "getUTCHours", "getMinutes", | 53 "getUTCDate", "getDay", "getUTCDay", "getHours", "getUTCHours", "getMinutes", |
47 "getUTCMinutes", "getSeconds", "getUTCSeconds", "getMilliseconds", | 54 "getUTCMinutes", "getSeconds", "getUTCSeconds", "getMilliseconds", |
48 "getUTCMilliseconds", "getTimezoneOffset", "setTime", "setMilliseconds", | 55 "getUTCMilliseconds", "getTimezoneOffset", "setTime", "setMilliseconds", |
49 "setUTCMilliseconds", "setSeconds", "setUTCSeconds", "setMinutes", | 56 "setUTCMilliseconds", "setSeconds", "setUTCSeconds", "setMinutes", |
50 "setUTCMinutes", "setHours", "setUTCHours", "setDate", "setUTCDate", | 57 "setUTCMinutes", "setHours", "setUTCHours", "setDate", "setUTCDate", |
51 "setMonth", "setUTCMonth", "setFullYear", "setUTCFullYear", "toGMTString", | 58 "setMonth", "setUTCMonth", "setFullYear", "setUTCFullYear", "toGMTString", |
(...skipping 20 matching lines...) Expand all Loading... |
72 | 79 |
73 array = ["exec", "test", "toString", "compile"]; | 80 array = ["exec", "test", "toString", "compile"]; |
74 CheckEcmaSemantics(RegExp.prototype, array, "RegExp prototype"); | 81 CheckEcmaSemantics(RegExp.prototype, array, "RegExp prototype"); |
75 | 82 |
76 array = [ | 83 array = [ |
77 "toString", "toLocaleString", "valueOf", "hasOwnProperty", | 84 "toString", "toLocaleString", "valueOf", "hasOwnProperty", |
78 "isPrototypeOf", "propertyIsEnumerable", "__defineGetter__", | 85 "isPrototypeOf", "propertyIsEnumerable", "__defineGetter__", |
79 "__lookupGetter__", "__defineSetter__", "__lookupSetter__"]; | 86 "__lookupGetter__", "__defineSetter__", "__lookupSetter__"]; |
80 CheckEcmaSemantics(Object.prototype, array, "Object prototype"); | 87 CheckEcmaSemantics(Object.prototype, array, "Object prototype"); |
81 | 88 |
| 89 var old_Object_prototype = Object.prototype; |
| 90 var new_Object_prototype = {}; |
| 91 for (var i = 0; i < 7; i++) { |
| 92 Object.prototype = new_Object_prototype; |
| 93 assertEquals(old_Object_prototype, Object.prototype); |
| 94 } |
| 95 |
82 array = [ | 96 array = [ |
83 "toString", "valueOf", "toJSON"]; | 97 "toString", "valueOf", "toJSON"]; |
84 CheckEcmaSemantics(Boolean.prototype, array, "Boolean prototype"); | 98 CheckEcmaSemantics(Boolean.prototype, array, "Boolean prototype"); |
85 | 99 |
86 array = [ | 100 array = [ |
87 "toString", "toLocaleString", "valueOf", "toFixed", "toExponential", | 101 "toString", "toLocaleString", "valueOf", "toFixed", "toExponential", |
88 "toPrecision", "toJSON"]; | 102 "toPrecision", "toJSON"]; |
89 CheckEcmaSemantics(Number.prototype, array, "Number prototype"); | 103 CheckEcmaSemantics(Number.prototype, array, "Number prototype"); |
90 | 104 |
91 CheckEcmaSemantics(Function.prototype, ["toString"], "Function prototype"); | 105 CheckEcmaSemantics(Function.prototype, ["toString"], "Function prototype"); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (!type[prop]) return; | 186 if (!type[prop]) return; |
173 assertTrue(type.hasOwnProperty(prop), "inherited: " + prop); | 187 assertTrue(type.hasOwnProperty(prop), "inherited: " + prop); |
174 var deleted = delete type[prop]; | 188 var deleted = delete type[prop]; |
175 assertFalse(deleted, "delete operator returned true: " + prop); | 189 assertFalse(deleted, "delete operator returned true: " + prop); |
176 assertTrue(type.hasOwnProperty(prop), "not there after delete: " + prop); | 190 assertTrue(type.hasOwnProperty(prop), "not there after delete: " + prop); |
177 type[prop] = "foo"; | 191 type[prop] = "foo"; |
178 assertEquals("foo", type[prop], "overwritable: " + prop); | 192 assertEquals("foo", type[prop], "overwritable: " + prop); |
179 } | 193 } |
180 | 194 |
181 print("OK"); | 195 print("OK"); |
OLD | NEW |