From 7559b9ec714b8714bf3f24cc4164b94b6877e3ab Mon Sep 17 00:00:00 2001 From: "JiaLi.Passion" Date: Sat, 28 Apr 2018 13:26:47 +0800 Subject: [PATCH] fix(core): use then directly when promise is not patchable --- lib/zone.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/zone.ts b/lib/zone.ts index 9cbd04fdc..f39cc4c2d 100644 --- a/lib/zone.ts +++ b/lib/zone.ts @@ -1272,7 +1272,13 @@ const Zone: ZoneType = (function(global: any) { } } if (nativeMicroTaskQueuePromise) { - nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue); + let nativeThen = nativeMicroTaskQueuePromise[symbolThen]; + if (!nativeThen) { + // native Promise is not patchable, we need to use `then` directly + // issue 1078 + nativeThen = nativeMicroTaskQueuePromise['then']; + } + nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue); } else { global[symbolSetTimeout](drainMicroTaskQueue, 0); }