Chromium Code Reviews| 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 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
| 6 // in runtime.js: | 6 // in runtime.js: |
| 7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
| 8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
| 9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
| 10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 throw MakeTypeError("handler_returned_false", | 707 throw MakeTypeError("handler_returned_false", |
| 708 [handler, "defineProperty"]); | 708 [handler, "defineProperty"]); |
| 709 } else { | 709 } else { |
| 710 return false; | 710 return false; |
| 711 } | 711 } |
| 712 } | 712 } |
| 713 return true; | 713 return true; |
| 714 } | 714 } |
| 715 | 715 |
| 716 | 716 |
| 717 function DefineObjectPropertyFromAPI(obj, p, value, configurable, enumerable, | |
| 718 writable) { | |
| 719 DefineObjectProperty(obj, p, ToPropertyDescriptor({ | |
|
adamk
2015/04/15 16:31:53
I think you're entering too late, and should call
| |
| 720 value: value, | |
| 721 configurable: configurable, | |
| 722 enumerable: enumerable, | |
| 723 writable: writable | |
| 724 }), | |
| 725 true); | |
| 726 return this; | |
| 727 } | |
| 728 | |
| 729 | |
| 717 // ES5 8.12.9. | 730 // ES5 8.12.9. |
| 718 function DefineObjectProperty(obj, p, desc, should_throw) { | 731 function DefineObjectProperty(obj, p, desc, should_throw) { |
| 719 var current_array = %GetOwnProperty(obj, ToName(p)); | 732 var current_array = %GetOwnProperty(obj, ToName(p)); |
| 720 var current = ConvertDescriptorArrayToDescriptor(current_array); | 733 var current = ConvertDescriptorArrayToDescriptor(current_array); |
| 721 var extensible = %IsExtensible(obj); | 734 var extensible = %IsExtensible(obj); |
| 722 | 735 |
| 723 // Error handling according to spec. | 736 // Error handling according to spec. |
| 724 // Step 3 | 737 // Step 3 |
| 725 if (IS_UNDEFINED(current) && !extensible) { | 738 if (IS_UNDEFINED(current) && !extensible) { |
| 726 if (should_throw) { | 739 if (should_throw) { |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1914 } | 1927 } |
| 1915 if (!IS_SPEC_FUNCTION(method)) { | 1928 if (!IS_SPEC_FUNCTION(method)) { |
| 1916 throw MakeTypeError('not_iterable', [obj]); | 1929 throw MakeTypeError('not_iterable', [obj]); |
| 1917 } | 1930 } |
| 1918 var iterator = %_CallFunction(obj, method); | 1931 var iterator = %_CallFunction(obj, method); |
| 1919 if (!IS_SPEC_OBJECT(iterator)) { | 1932 if (!IS_SPEC_OBJECT(iterator)) { |
| 1920 throw MakeTypeError('not_an_iterator', [iterator]); | 1933 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1921 } | 1934 } |
| 1922 return iterator; | 1935 return iterator; |
| 1923 } | 1936 } |
| OLD | NEW |