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

Unified Diff: src/runtime.cc

Issue 240573004: Allow Object.defineProperty to update value of an API accessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/cctest/test-api.cc » ('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 b98ba40fdb161faa3c45c8976eccdef406e09b16..ef7a74857deb6bf2a999b4b745c3028cd933f489 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -5229,17 +5229,12 @@ RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) {
// 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,
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698