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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 if (namedInterceptorNames) { | 675 if (namedInterceptorNames) { |
676 propertyNames = propertyNames.concat(namedInterceptorNames); | 676 propertyNames = propertyNames.concat(namedInterceptorNames); |
677 } | 677 } |
678 } | 678 } |
679 | 679 |
680 // Property names are expected to be unique strings. | 680 // Property names are expected to be unique strings. |
681 var propertySet = {}; | 681 var propertySet = {}; |
682 var j = 0; | 682 var j = 0; |
683 for (var i = 0; i < propertyNames.length; ++i) { | 683 for (var i = 0; i < propertyNames.length; ++i) { |
684 var name = ToString(propertyNames[i]); | 684 var name = ToString(propertyNames[i]); |
685 if (name in propertySet) | 685 // We need to check for the exact property value since for intrinsic |
| 686 // properties like toString if(propertySet["toString"]) will always |
| 687 // succeed. |
| 688 if (propertySet[name] === true) |
686 continue; | 689 continue; |
687 propertySet[name] = true; | 690 propertySet[name] = true; |
688 propertyNames[j++] = name; | 691 propertyNames[j++] = name; |
689 } | 692 } |
690 propertyNames.length = j; | 693 propertyNames.length = j; |
691 | 694 |
692 return propertyNames; | 695 return propertyNames; |
693 } | 696 } |
694 | 697 |
695 | 698 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1041 |
1039 // ---------------------------------------------------------------------------- | 1042 // ---------------------------------------------------------------------------- |
1040 | 1043 |
1041 function SetupFunction() { | 1044 function SetupFunction() { |
1042 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1045 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1043 "toString", FunctionToString | 1046 "toString", FunctionToString |
1044 )); | 1047 )); |
1045 } | 1048 } |
1046 | 1049 |
1047 SetupFunction(); | 1050 SetupFunction(); |
OLD | NEW |