Revision: 20910
Author:   [email protected]
Date:     Wed Apr 23 13:05:38 2014 UTC
Log:      Allow Object.defineProperty to update value of an API accessor.

This is needed for converting internal accessors to API accessors and can break blink tests.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/240573004
http://code.google.com/p/v8/source/detail?r=20910

Modified:
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/src/runtime.cc      Wed Apr 23 12:28:50 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Wed Apr 23 13:05:38 2014 UTC
@@ -5229,17 +5229,12 @@
   // Special case for callback properties.
   if (lookup.IsPropertyCallbacks()) {
     Handle<Object> callback(lookup.GetCallbackObject(), isolate);
- // To be compatible with Safari we do not change the value on API objects - // in Object.defineProperty(). Firefox disagrees here, and actually changes
-    // the value.
-    if (callback->IsAccessorInfo()) {
-      return isolate->heap()->undefined_value();
-    }
- // Avoid redefining foreign callback as data property, just use the stored
+    // Avoid redefining 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
     // change, this should be fixed once we cleanup the underlying code.
-    if (callback->IsForeign() && lookup.GetAttributes() == attr) {
+    if ((callback->IsForeign() || callback->IsAccessorInfo()) &&
+        lookup.GetAttributes() == attr) {
       Handle<Object> result_object;
       ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
           isolate, result_object,
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Tue Apr 22 10:45:43 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Wed Apr 23 13:05:38 2014 UTC
@@ -9396,7 +9396,6 @@
   CHECK_EQ(42, g_echo_value_1);

   v8::Handle<Value> value;
-  // We follow Safari in ignoring assignments to host object accessors.
CompileRun("Object.defineProperty(other, 'accessible_prop', {value: -1})");
   value = CompileRun("other.accessible_prop == 42");
   CHECK(value->IsTrue());

--
--
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