Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: src/v8natives.js

Issue 11364237: When using an Object as a set in Object.getOwnPropertyNames, null out the proto (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Lint Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2410.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 1018
1019 if (%GetInterceptorInfo(obj) & 2) { 1019 if (%GetInterceptorInfo(obj) & 2) {
1020 var namedInterceptorNames = 1020 var namedInterceptorNames =
1021 %GetNamedInterceptorPropertyNames(obj); 1021 %GetNamedInterceptorPropertyNames(obj);
1022 if (namedInterceptorNames) { 1022 if (namedInterceptorNames) {
1023 propertyNames = propertyNames.concat(namedInterceptorNames); 1023 propertyNames = propertyNames.concat(namedInterceptorNames);
1024 } 1024 }
1025 } 1025 }
1026 1026
1027 // Property names are expected to be unique strings. 1027 // Property names are expected to be unique strings.
1028 var propertySet = {}; 1028 var propertySet = { __proto__: null };
1029 var j = 0; 1029 var j = 0;
1030 for (var i = 0; i < propertyNames.length; ++i) { 1030 for (var i = 0; i < propertyNames.length; ++i) {
1031 var name = ToString(propertyNames[i]); 1031 var name = ToString(propertyNames[i]);
1032 // We need to check for the exact property value since for intrinsic 1032 // We need to check for the exact property value since for intrinsic
1033 // properties like toString if(propertySet["toString"]) will always 1033 // properties like toString if(propertySet["toString"]) will always
1034 // succeed. 1034 // succeed.
1035 if (propertySet[name] === true) { 1035 if (propertySet[name] === true) {
1036 continue; 1036 continue;
1037 } 1037 }
1038 propertySet[name] = true; 1038 propertySet[name] = true;
(...skipping 20 matching lines...) Expand all
1059 // ES5 section 15.2.3.6. 1059 // ES5 section 15.2.3.6.
1060 function ObjectDefineProperty(obj, p, attributes) { 1060 function ObjectDefineProperty(obj, p, attributes) {
1061 if (!IS_SPEC_OBJECT(obj)) { 1061 if (!IS_SPEC_OBJECT(obj)) {
1062 throw MakeTypeError("called_on_non_object", ["Object.defineProperty"]); 1062 throw MakeTypeError("called_on_non_object", ["Object.defineProperty"]);
1063 } 1063 }
1064 var name = ToString(p); 1064 var name = ToString(p);
1065 if (%IsJSProxy(obj)) { 1065 if (%IsJSProxy(obj)) {
1066 // Clone the attributes object for protection. 1066 // Clone the attributes object for protection.
1067 // TODO(rossberg): not spec'ed yet, so not sure if this should involve 1067 // TODO(rossberg): not spec'ed yet, so not sure if this should involve
1068 // non-own properties as it does (or non-enumerable ones, as it doesn't?). 1068 // non-own properties as it does (or non-enumerable ones, as it doesn't?).
1069 var attributesClone = {}; 1069 var attributesClone = {};
rossberg 2012/11/15 14:23:11 While you're at it, could you apply the same fix h
adamk 2012/11/15 14:33:30 But then I'd need a test :). Seems like a separat
1070 for (var a in attributes) { 1070 for (var a in attributes) {
1071 attributesClone[a] = attributes[a]; 1071 attributesClone[a] = attributes[a];
1072 } 1072 }
1073 DefineProxyProperty(obj, name, attributesClone, true); 1073 DefineProxyProperty(obj, name, attributesClone, true);
1074 // The following would implement the spec as in the current proposal, 1074 // The following would implement the spec as in the current proposal,
1075 // but after recent comments on es-discuss, is most likely obsolete. 1075 // but after recent comments on es-discuss, is most likely obsolete.
1076 /* 1076 /*
1077 var defineObj = FromGenericPropertyDescriptor(desc); 1077 var defineObj = FromGenericPropertyDescriptor(desc);
1078 var names = ObjectGetOwnPropertyNames(attributes); 1078 var names = ObjectGetOwnPropertyNames(attributes);
1079 var standardNames = 1079 var standardNames =
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 1677
1678 function SetUpFunction() { 1678 function SetUpFunction() {
1679 %CheckIsBootstrapping(); 1679 %CheckIsBootstrapping();
1680 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1680 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1681 "bind", FunctionBind, 1681 "bind", FunctionBind,
1682 "toString", FunctionToString 1682 "toString", FunctionToString
1683 )); 1683 ));
1684 } 1684 }
1685 1685
1686 SetUpFunction(); 1686 SetUpFunction();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2410.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698