OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
931 | 931 |
932 // ES5 section 15.2.3.8. | 932 // ES5 section 15.2.3.8. |
933 function ObjectSeal(obj) { | 933 function ObjectSeal(obj) { |
934 if (!IS_SPEC_OBJECT(obj)) { | 934 if (!IS_SPEC_OBJECT(obj)) { |
935 throw MakeTypeError("obj_ctor_property_non_object", ["seal"]); | 935 throw MakeTypeError("obj_ctor_property_non_object", ["seal"]); |
936 } | 936 } |
937 var names = ObjectGetOwnPropertyNames(obj); | 937 var names = ObjectGetOwnPropertyNames(obj); |
938 for (var i = 0; i < names.length; i++) { | 938 for (var i = 0; i < names.length; i++) { |
939 var name = names[i]; | 939 var name = names[i]; |
940 var desc = GetOwnProperty(obj, name); | 940 var desc = GetOwnProperty(obj, name); |
941 if (desc.isConfigurable()) desc.setConfigurable(false); | 941 if (!desc.isConfigurable()) continue; |
942 desc.setConfigurable(false); | |
Lasse Reichstein
2011/06/10 09:09:10
Make it
if (desc.isConfigurable()) {
...
}
i
Mads Ager (chromium)
2011/06/10 09:13:41
Done.
| |
942 DefineOwnProperty(obj, name, desc, true); | 943 DefineOwnProperty(obj, name, desc, true); |
943 } | 944 } |
944 return ObjectPreventExtension(obj); | 945 return ObjectPreventExtension(obj); |
945 } | 946 } |
946 | 947 |
947 | 948 |
948 // ES5 section 15.2.3.9. | 949 // ES5 section 15.2.3.9. |
949 function ObjectFreeze(obj) { | 950 function ObjectFreeze(obj) { |
950 if (!IS_SPEC_OBJECT(obj)) { | 951 if (!IS_SPEC_OBJECT(obj)) { |
951 throw MakeTypeError("obj_ctor_property_non_object", ["freeze"]); | 952 throw MakeTypeError("obj_ctor_property_non_object", ["freeze"]); |
952 } | 953 } |
953 var names = ObjectGetOwnPropertyNames(obj); | 954 var names = ObjectGetOwnPropertyNames(obj); |
954 for (var i = 0; i < names.length; i++) { | 955 for (var i = 0; i < names.length; i++) { |
955 var name = names[i]; | 956 var name = names[i]; |
956 var desc = GetOwnProperty(obj, name); | 957 var desc = GetOwnProperty(obj, name); |
958 if (!desc.isWritable() && !desc.isConfigurable()) continue; | |
Lasse Reichstein
2011/06/10 09:09:10
Ditto here: invert the condition and put the rest
Mads Ager (chromium)
2011/06/10 09:13:41
Done.
| |
957 if (IsDataDescriptor(desc)) desc.setWritable(false); | 959 if (IsDataDescriptor(desc)) desc.setWritable(false); |
958 if (desc.isConfigurable()) desc.setConfigurable(false); | 960 if (desc.isConfigurable()) desc.setConfigurable(false); |
959 DefineOwnProperty(obj, name, desc, true); | 961 DefineOwnProperty(obj, name, desc, true); |
960 } | 962 } |
961 return ObjectPreventExtension(obj); | 963 return ObjectPreventExtension(obj); |
962 } | 964 } |
963 | 965 |
964 | 966 |
965 // ES5 section 15.2.3.10 | 967 // ES5 section 15.2.3.10 |
966 function ObjectPreventExtension(obj) { | 968 function ObjectPreventExtension(obj) { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1386 // ---------------------------------------------------------------------------- | 1388 // ---------------------------------------------------------------------------- |
1387 | 1389 |
1388 function SetupFunction() { | 1390 function SetupFunction() { |
1389 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1391 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1390 "bind", FunctionBind, | 1392 "bind", FunctionBind, |
1391 "toString", FunctionToString | 1393 "toString", FunctionToString |
1392 )); | 1394 )); |
1393 } | 1395 } |
1394 | 1396 |
1395 SetupFunction(); | 1397 SetupFunction(); |
OLD | NEW |