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

Unified Diff: src/v8natives.js

Issue 7044104: Fix issue 1447 by not redefining properties unneccesarily in seal and freeze. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1447.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 3cb9dfd63e756f2e080596a586dbff80ccf673e3..0c88eb17a671e310aa2aa91ce02c2bba79d31f1f 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -938,7 +938,8 @@ function ObjectSeal(obj) {
for (var i = 0; i < names.length; i++) {
var name = names[i];
var desc = GetOwnProperty(obj, name);
- if (desc.isConfigurable()) desc.setConfigurable(false);
+ if (!desc.isConfigurable()) continue;
+ desc.setConfigurable(false);
Lasse Reichstein 2011/06/10 09:09:10 Make it if (desc.isConfigurable()) { ... } i
Mads Ager (chromium) 2011/06/10 09:13:41 Done.
DefineOwnProperty(obj, name, desc, true);
}
return ObjectPreventExtension(obj);
@@ -954,6 +955,7 @@ function ObjectFreeze(obj) {
for (var i = 0; i < names.length; i++) {
var name = names[i];
var desc = GetOwnProperty(obj, name);
+ if (!desc.isWritable() && !desc.isConfigurable()) continue;
Lasse Reichstein 2011/06/10 09:09:10 Ditto here: invert the condition and put the rest
Mads Ager (chromium) 2011/06/10 09:13:41 Done.
if (IsDataDescriptor(desc)) desc.setWritable(false);
if (desc.isConfigurable()) desc.setConfigurable(false);
DefineOwnProperty(obj, name, desc, true);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1447.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698