Index: src/object-observe.js |
diff --git a/src/object-observe.js b/src/object-observe.js |
index 28aa1f4e4e988caf624efcfd72df9c5d83325e30..b8fcee406230c7a0f842f36c44fe098950916f80 100644 |
--- a/src/object-observe.js |
+++ b/src/object-observe.js |
@@ -35,7 +35,7 @@ if (IS_UNDEFINED(observationState.observerInfoMap)) { |
observationState.observerInfoMap = %CreateObjectHashTable(); |
observationState.objectInfoMap = %CreateObjectHashTable(); |
observationState.notifierTargetMap = %CreateObjectHashTable(); |
- observationState.activeObservers = new InternalArray; |
+ observationState.pendingObservers = new InternalArray; |
observationState.observerPriority = 0; |
} |
@@ -117,7 +117,7 @@ function EnqueueChangeRecord(changeRecord, observers) { |
for (var i = 0; i < observers.length; i++) { |
var observer = observers[i]; |
var observerInfo = observerInfoMap.get(observer); |
- observationState.activeObservers[observerInfo.priority] = observer; |
+ observationState.pendingObservers[observerInfo.priority] = observer; |
%SetObserverDeliveryPending(); |
if (IS_NULL(observerInfo.pendingChangeRecords)) { |
observerInfo.pendingChangeRecords = new InternalArray(changeRecord); |
@@ -200,6 +200,7 @@ function DeliverChangeRecordsForObserver(observer) { |
return; |
observerInfo.pendingChangeRecords = null; |
+ delete observationState.pendingObservers[observerInfo.priority]; |
var delivered = []; |
%MoveArrayContents(pendingChangeRecords, delivered); |
try { |
@@ -215,11 +216,11 @@ function ObjectDeliverChangeRecords(callback) { |
} |
function DeliverChangeRecords() { |
- while (observationState.activeObservers.length) { |
- var activeObservers = observationState.activeObservers; |
- observationState.activeObservers = new InternalArray; |
- for (var i in activeObservers) { |
- DeliverChangeRecordsForObserver(activeObservers[i]); |
+ while (observationState.pendingObservers.length) { |
+ var pendingObservers = observationState.pendingObservers; |
+ observationState.pendingObservers = new InternalArray; |
+ for (var i in pendingObservers) { |
+ DeliverChangeRecordsForObserver(pendingObservers[i]); |
} |
} |
} |