Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

fix(dirtychecking): prevent long prototype chain lookups of object properties #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/dirty_checking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down