Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index a175836adb2a8a83eaac8b3e0342ee2b19b4c8eb..c90d6ac1f3dcfdc7584b2543ed2de5f6e3fe61d9 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -5099,11 +5099,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) { |
if (callback->IsAccessorInfo()) { |
return isolate->heap()->undefined_value(); |
} |
- // Avoid redefining foreign callback as data property, just use the stored |
- // setter to update the value instead. |
+ // Provided a read-only property isn't being reconfigured, 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 |
// change, this should be fixed once we cleanup the underlying code. |
- if (callback->IsForeign() && lookup.GetAttributes() == attr) { |
+ if (callback->IsForeign() && |
+ lookup.GetAttributes() == attr && |
+ !(attr & READ_ONLY)) { |
Handle<Object> result_object = |
JSObject::SetPropertyWithCallback(js_object, |
callback, |