| Index: src/messages.js
|
| diff --git a/src/messages.js b/src/messages.js
|
| index 7d0c6bda42f1931e01c787959395caf64cae3b50..81619b32c9019150a7472c4e14c8b30956dc3660 100644
|
| --- a/src/messages.js
|
| +++ b/src/messages.js
|
| @@ -768,23 +768,18 @@ function GetStackTraceLine(recv, fun, pos, isGlobal) {
|
|
|
| // Defines accessors for a property that is calculated the first time
|
| // the property is read.
|
| -function DefineOneShotAccessor(obj, name, fun) {
|
| - // Note that the accessors consistently operate on 'obj', not 'this'.
|
| - // Since the object may occur in someone else's prototype chain we
|
| - // can't rely on 'this' being the same as 'obj'.
|
| - var value;
|
| - var value_factory = fun;
|
| +function DefineOneShotAccessor(obj, name, value_factory) {
|
| + // Note that 'obj' may be different than 'this' since obj may be on the
|
| + // prototype chain of 'this'.
|
| var getter = function() {
|
| - if (value_factory == null) {
|
| - return value;
|
| - }
|
| - value = value_factory(obj);
|
| - value_factory = null;
|
| + var value = value_factory(obj);
|
| + delete obj[name];
|
| + obj[name] = value;
|
| return value;
|
| };
|
| var setter = function(v) {
|
| - value_factory = null;
|
| - value = v;
|
| + // Set the property for 'this', ignoring this setter.
|
| + %DefineOrRedefineDataProperty(this, name, v, NONE);
|
| };
|
| %DefineOrRedefineAccessorProperty(obj, name, getter, setter, DONT_ENUM);
|
| }
|
|
|