Reviewers: Jakob,

Message:
PTAL

Description:
Do not call setters of read-only accessors.

BUG=
TEST=mjsunit/readonly-accessor

Please review this at https://codereview.chromium.org/271433002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+9, -5 lines):
  M src/objects.cc
  A + test/mjsunit/readonly-accessor.js


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index a30d6ab0d1ceccea5a973752c3963faac83d651e..01de39f0250f3fb559f09170fbb883f07235e777 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3147,9 +3147,12 @@ MaybeHandle<Object> JSObject::SetPropertyViaPrototypes(
       }
       case CALLBACKS: {
         *done = true;
- Handle<Object> callback_object(result.GetCallbackObject(), isolate); - return SetPropertyWithCallback(object, callback_object, name, value, - handle(result.holder()), strict_mode);
+        if (!result.IsReadOnly()) {
+ Handle<Object> callback_object(result.GetCallbackObject(), isolate); + return SetPropertyWithCallback(object, callback_object, name, value, + handle(result.holder()), strict_mode);
+        }
+        break;
       }
       case HANDLER: {
         Handle<JSProxy> proxy(result.proxy());
Index: test/mjsunit/readonly-accessor.js
diff --git a/test/mjsunit/regress/regress-crbug-351262.js b/test/mjsunit/readonly-accessor.js
similarity index 71%
copy from test/mjsunit/regress/regress-crbug-351262.js
copy to test/mjsunit/readonly-accessor.js
index a2f4eadc0de5c2bd7d27f6e78ff9940fce7b0f85..5a73525fea60d67074d81e392d08d8448f8ae39d 100644
--- a/test/mjsunit/regress/regress-crbug-351262.js
+++ b/test/mjsunit/readonly-accessor.js
@@ -2,5 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-for (var x in this) {};
-JSON.stringify(this);
+var foo = {};
+foo.__proto__ = new String("bar");
+foo.length = 20;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to