Index: src/object-observe.js |
diff --git a/src/object-observe.js b/src/object-observe.js |
index 73a5d34c7ca2bcff899f60402f6fa15cb71e6042..dfa57b8312640bbdf972b5eb1bb15a6f7aba5894 100644 |
--- a/src/object-observe.js |
+++ b/src/object-observe.js |
@@ -384,7 +384,7 @@ function ObserverEnqueueIfActive(observer, objectInfo, changeRecord, |
observationState.pendingObservers = { __proto__: null }; |
observationState.pendingObservers[callbackInfo.priority] = callback; |
callbackInfo.push(changeRecord); |
- %SetObserverDeliveryPending(); |
+ %SetMicrotaskPending(true); |
} |
function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord, type) { |
@@ -551,7 +551,7 @@ function CallbackDeliverPending(callback) { |
try { |
%_CallFunction(UNDEFINED, delivered, callback); |
- } catch (ex) {} |
+ } catch (ex) {} // TODO(rossberg): perhaps log uncaught exceptions. |
return true; |
} |
@@ -562,15 +562,16 @@ function ObjectDeliverChangeRecords(callback) { |
while (CallbackDeliverPending(callback)) {} |
} |
-function DeliverChangeRecords() { |
- while (observationState.pendingObservers) { |
- var pendingObservers = observationState.pendingObservers; |
+function ObserveMicrotaskRunner() { |
+ var pendingObservers = observationState.pendingObservers; |
+ if (pendingObservers) { |
observationState.pendingObservers = null; |
for (var i in pendingObservers) { |
CallbackDeliverPending(pendingObservers[i]); |
} |
} |
} |
+RunMicrotasks.runners.push(ObserveMicrotaskRunner); |
function SetupObjectObserve() { |
%CheckIsBootstrapping(); |