Chromium Code Reviews| Index: src/v8natives.js |
| diff --git a/src/v8natives.js b/src/v8natives.js |
| index 20fc74dc440dcf28dd64ece1de30133611aadf0b..7c8381812bb86158ad554bd6e774f42cab974eb5 100644 |
| --- a/src/v8natives.js |
| +++ b/src/v8natives.js |
| @@ -1154,6 +1154,17 @@ function ProxyFix(obj) { |
| ObjectDefineProperties(obj, props); |
| } |
| +function GetOwnPropertyNamesForSealOrFreeze(obj) { |
| + var names = ObjectGetOwnPropertyNames(obj); |
| + if (IS_SPEC_FUNCTION(obj)) { |
|
rossberg
2012/11/16 12:28:55
IS_FUNCTION probably is more adequate here, since
arv (Not doing code reviews)
2012/11/16 14:38:06
There are more poison pills than functionObj.calle
rossberg
2012/11/16 15:52:46
Yes, but this issue affects only "caller", because
|
| + // The "caller" property on Functions is always non-writable and |
| + // non-configurable, so there's no need to check it or redefine it. |
| + // Thus, we skip it to avoid the strict-mode check the getter enforces. |
| + names = names.filter(function(name) { return name != "caller"; }); |
| + } |
| + return names; |
| +} |
| + |
| // ES5 section 15.2.3.8. |
| function ObjectSeal(obj) { |
| @@ -1163,7 +1174,7 @@ function ObjectSeal(obj) { |
| if (%IsJSProxy(obj)) { |
| ProxyFix(obj); |
| } |
| - var names = ObjectGetOwnPropertyNames(obj); |
| + var names = GetOwnPropertyNamesForSealOrFreeze(obj); |
| for (var i = 0; i < names.length; i++) { |
| var name = names[i]; |
| var desc = GetOwnProperty(obj, name); |
| @@ -1185,7 +1196,7 @@ function ObjectFreeze(obj) { |
| if (%IsJSProxy(obj)) { |
| ProxyFix(obj); |
| } |
| - var names = ObjectGetOwnPropertyNames(obj); |
| + var names = GetOwnPropertyNamesForSealOrFreeze(obj); |
| for (var i = 0; i < names.length; i++) { |
| var name = names[i]; |
| var desc = GetOwnProperty(obj, name); |
| @@ -1221,7 +1232,7 @@ function ObjectIsSealed(obj) { |
| if (%IsJSProxy(obj)) { |
| return false; |
| } |
| - var names = ObjectGetOwnPropertyNames(obj); |
| + var names = GetOwnPropertyNamesForSealOrFreeze(obj); |
| for (var i = 0; i < names.length; i++) { |
| var name = names[i]; |
| var desc = GetOwnProperty(obj, name); |
| @@ -1242,7 +1253,7 @@ function ObjectIsFrozen(obj) { |
| if (%IsJSProxy(obj)) { |
| return false; |
| } |
| - var names = ObjectGetOwnPropertyNames(obj); |
| + var names = GetOwnPropertyNamesForSealOrFreeze(obj); |
| for (var i = 0; i < names.length; i++) { |
| var name = names[i]; |
| var desc = GetOwnProperty(obj, name); |