From db2c67e67812a37c9dffb187a225785cf6511dce Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Wed, 26 Mar 2014 15:31:20 -0400 Subject: [PATCH] fix(dirtychecking): prevent long prototype chain lookups of object properties This doesn't really make a lot of sense, and is probably not worth doing. It also breaks tests, which will possibly be rectified after reviewing angular.dart commit e12e5b52b7441436858628e7b9d9e98b6c9f518f. --- src/dirty_checking.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dirty_checking.js b/src/dirty_checking.js index 8ebcabc..5d4f2bf 100644 --- a/src/dirty_checking.js +++ b/src/dirty_checking.js @@ -334,6 +334,17 @@ class DirtyCheckingRecord extends ChangeRecord { } if (typeof obj === "object") { this._mode = _MODE_MAP_FIELD_; + + if (obj && this._field !== null) { + var object = obj, field = this._field; + while (object && !object.hasOwnProperty(field)) { + object = Object.getPrototypeOf(object); + } + if (!object) { + throw new Error("property '" + field + "' not found in object"); + } + } + // _instanceMirror = null; --- Reflection needed? } else if (this._getter !== null) { this._mode = _MODE_GETTER_;