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

Commit d7e0a31

Browse files
JiaLiPassionmhevery
authored andcommitted
fix(core): use then directly when promise is not patchable (#1079)
1 parent 14cfc68 commit d7e0a31

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: lib/zone.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,13 @@ const Zone: ZoneType = (function(global: any) {
12671267
}
12681268
}
12691269
if (nativeMicroTaskQueuePromise) {
1270-
nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
1270+
let nativeThen = nativeMicroTaskQueuePromise[symbolThen];
1271+
if (!nativeThen) {
1272+
// native Promise is not patchable, we need to use `then` directly
1273+
// issue 1078
1274+
nativeThen = nativeMicroTaskQueuePromise['then'];
1275+
}
1276+
nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
12711277
} else {
12721278
global[symbolSetTimeout](drainMicroTaskQueue, 0);
12731279
}

0 commit comments

Comments
 (0)