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

Unified Diff: src/runtime.cc

Issue 12398010: Add workaround for redefinition of __proto__ property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 7 years, 10 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 | « src/bootstrapper.cc ('k') | test/mjsunit/regress/regress-2565.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index e914a3ae3291ee411b2c3a80122b2725c507fd90..52905ab1be547535ce5c20884b59dfc3ac10abf0 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4091,6 +4091,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
if (callback->IsAccessorInfo()) {
return isolate->heap()->undefined_value();
}
+ // TODO(mstarzinger): The __proto__ property should actually be a real
+ // JavaScript accessor instead of a foreign callback. But for now we just
+ // avoid changing the writability and configurability attribute of this
+ // property.
+ Handle<String> proto_string = isolate->factory()->proto_string();
+ if (callback->IsForeign() && proto_string->Equals(*name)) {
+ attr = static_cast<PropertyAttributes>(attr & ~(READ_ONLY | DONT_DELETE));
+ }
// Avoid redefining foreign callback as data property, just use the stored
// setter to update the value instead.
// TODO(mstarzinger): So far this only works if property attributes don't
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/regress/regress-2565.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698