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

Commit 7559b9e

Browse files
committed
fix(core): use then directly when promise is not patchable
1 parent 1ba8519 commit 7559b9e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/zone.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,13 @@ const Zone: ZoneType = (function(global: any) {
12721272
}
12731273
}
12741274
if (nativeMicroTaskQueuePromise) {
1275-
nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
1275+
let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
1276+
if (!nativeThen) {
1277+
// native Promise is not patchable, we need to use `then` directly
1278+
// issue 1078
1279+
nativeThen = nativeMicroTaskQueuePromise['then'];
1280+
}
1281+
nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
12761282
} else {
12771283
global[symbolSetTimeout](drainMicroTaskQueue, 0);
12781284
}

0 commit comments

Comments
 (0)