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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 if (!IS_SPEC_OBJECT(obj)) { | 742 if (!IS_SPEC_OBJECT(obj)) { |
743 throw MakeTypeError("obj_ctor_property_non_object", ["seal"]); | 743 throw MakeTypeError("obj_ctor_property_non_object", ["seal"]); |
744 } | 744 } |
745 var names = ObjectGetOwnPropertyNames(obj); | 745 var names = ObjectGetOwnPropertyNames(obj); |
746 for (var key in names) { | 746 for (var key in names) { |
747 var name = names[key]; | 747 var name = names[key]; |
748 var desc = GetOwnProperty(obj, name); | 748 var desc = GetOwnProperty(obj, name); |
749 if (desc.isConfigurable()) desc.setConfigurable(false); | 749 if (desc.isConfigurable()) desc.setConfigurable(false); |
750 DefineOwnProperty(obj, name, desc, true); | 750 DefineOwnProperty(obj, name, desc, true); |
751 } | 751 } |
752 ObjectPreventExtension(obj); | 752 return ObjectPreventExtension(obj); |
753 } | 753 } |
754 | 754 |
755 | 755 |
756 // ES5 section 15.2.3.9. | 756 // ES5 section 15.2.3.9. |
757 function ObjectFreeze(obj) { | 757 function ObjectFreeze(obj) { |
758 if (!IS_SPEC_OBJECT(obj)) { | 758 if (!IS_SPEC_OBJECT(obj)) { |
759 throw MakeTypeError("obj_ctor_property_non_object", ["freeze"]); | 759 throw MakeTypeError("obj_ctor_property_non_object", ["freeze"]); |
760 } | 760 } |
761 var names = ObjectGetOwnPropertyNames(obj); | 761 var names = ObjectGetOwnPropertyNames(obj); |
762 for (var key in names) { | 762 for (var key in names) { |
763 var name = names[key]; | 763 var name = names[key]; |
764 var desc = GetOwnProperty(obj, name); | 764 var desc = GetOwnProperty(obj, name); |
765 if (IsDataDescriptor(desc)) desc.setWritable(false); | 765 if (IsDataDescriptor(desc)) desc.setWritable(false); |
766 if (desc.isConfigurable()) desc.setConfigurable(false); | 766 if (desc.isConfigurable()) desc.setConfigurable(false); |
767 DefineOwnProperty(obj, name, desc, true); | 767 DefineOwnProperty(obj, name, desc, true); |
768 } | 768 } |
769 ObjectPreventExtension(obj); | 769 return ObjectPreventExtension(obj); |
770 } | 770 } |
771 | 771 |
772 | 772 |
773 // ES5 section 15.2.3.10 | 773 // ES5 section 15.2.3.10 |
774 function ObjectPreventExtension(obj) { | 774 function ObjectPreventExtension(obj) { |
775 if (!IS_SPEC_OBJECT(obj)) { | 775 if (!IS_SPEC_OBJECT(obj)) { |
776 throw MakeTypeError("obj_ctor_property_non_object", ["preventExtension"]); | 776 throw MakeTypeError("obj_ctor_property_non_object", ["preventExtension"]); |
777 } | 777 } |
778 %PreventExtensions(obj); | 778 %PreventExtensions(obj); |
779 return obj; | 779 return obj; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 // ---------------------------------------------------------------------------- | 1179 // ---------------------------------------------------------------------------- |
1180 | 1180 |
1181 function SetupFunction() { | 1181 function SetupFunction() { |
1182 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1182 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1183 "bind", FunctionBind, | 1183 "bind", FunctionBind, |
1184 "toString", FunctionToString | 1184 "toString", FunctionToString |
1185 )); | 1185 )); |
1186 } | 1186 } |
1187 | 1187 |
1188 SetupFunction(); | 1188 SetupFunction(); |
OLD | NEW |