OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var $functionSourceString; | 5 var $functionSourceString; |
6 var $globalEval; | 6 var $globalEval; |
7 var $objectGetOwnPropertyDescriptor; | 7 var $objectGetOwnPropertyDescriptor; |
8 var $toCompletePropertyDescriptor; | 8 var $toCompletePropertyDescriptor; |
9 | 9 |
10 (function(global, utils) { | 10 (function(global, utils) { |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 // Step 9a | 674 // Step 9a |
675 if (IsDataDescriptor(current) != IsDataDescriptor(desc)) { | 675 if (IsDataDescriptor(current) != IsDataDescriptor(desc)) { |
676 if (should_throw) { | 676 if (should_throw) { |
677 throw MakeTypeError(kRedefineDisallowed, p); | 677 throw MakeTypeError(kRedefineDisallowed, p); |
678 } else { | 678 } else { |
679 return false; | 679 return false; |
680 } | 680 } |
681 } | 681 } |
682 // Step 10a | 682 // Step 10a |
683 if (IsDataDescriptor(current) && IsDataDescriptor(desc)) { | 683 if (IsDataDescriptor(current) && IsDataDescriptor(desc)) { |
684 if (!current.isWritable() && desc.isWritable()) { | 684 var currentIsWritable = current.isWritable(); |
685 if (should_throw) { | 685 if (currentIsWritable != desc.isWritable()) { |
686 throw MakeTypeError(kRedefineDisallowed, p); | 686 if (!currentIsWritable || IS_STRONG(obj)) { |
687 } else { | 687 if (should_throw) { |
688 return false; | 688 throw IS_STRONG(obj) ? |
689 MakeTypeError(kStrongRedefineDisallowed, o, p) : | |
rossberg
2015/05/22 14:15:29
Nit: style guide wants ? and : each first on the n
conradw
2015/05/27 18:15:45
Done.
| |
690 MakeTypeError(kRedefineDisallowed, p) | |
691 } else { | |
692 return false; | |
693 } | |
689 } | 694 } |
690 } | 695 } |
691 if (!current.isWritable() && desc.hasValue() && | 696 if (!currentIsWritable && desc.hasValue() && |
692 !$sameValue(desc.getValue(), current.getValue())) { | 697 !$sameValue(desc.getValue(), current.getValue())) { |
693 if (should_throw) { | 698 if (should_throw) { |
694 throw MakeTypeError(kRedefineDisallowed, p); | 699 throw MakeTypeError(kRedefineDisallowed, p); |
695 } else { | 700 } else { |
696 return false; | 701 return false; |
697 } | 702 } |
698 } | 703 } |
699 } | 704 } |
700 // Step 11 | 705 // Step 11 |
701 if (IsAccessorDescriptor(desc) && IsAccessorDescriptor(current)) { | 706 if (IsAccessorDescriptor(desc) && IsAccessorDescriptor(current)) { |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1844 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; | 1849 to.ObjectGetOwnPropertyKeys = ObjectGetOwnPropertyKeys; |
1845 to.ObjectHasOwnProperty = ObjectHasOwnProperty; | 1850 to.ObjectHasOwnProperty = ObjectHasOwnProperty; |
1846 to.ObjectIsFrozen = ObjectIsFrozen; | 1851 to.ObjectIsFrozen = ObjectIsFrozen; |
1847 to.ObjectIsSealed = ObjectIsSealed; | 1852 to.ObjectIsSealed = ObjectIsSealed; |
1848 to.ObjectToString = ObjectToString; | 1853 to.ObjectToString = ObjectToString; |
1849 to.OwnPropertyKeys = OwnPropertyKeys; | 1854 to.OwnPropertyKeys = OwnPropertyKeys; |
1850 to.ToNameArray = ToNameArray; | 1855 to.ToNameArray = ToNameArray; |
1851 }); | 1856 }); |
1852 | 1857 |
1853 }) | 1858 }) |
OLD | NEW |