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

Commit 3844435

Browse files
committed
fix(fetch): correct chrome not able to load about://blank
Closes #444
1 parent 7a66237 commit 3844435

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: lib/zone.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,14 @@ const Zone: ZoneType = (function(global: any) {
11451145
if (NativePromise) {
11461146
patchThen(NativePromise);
11471147
if (typeof global['fetch'] !== 'undefined') {
1148-
const fetchPromise = global['fetch']('about:blank');
1148+
let fetchPromise: Promise<any>;
1149+
try {
1150+
// In MS Edge this throws
1151+
fetchPromise = global['fetch']();
1152+
} catch (e) {
1153+
// In Chrome this throws instead.
1154+
fetchPromise = global['fetch']('about:blank');
1155+
}
11491156
// ignore output to prevent error;
11501157
fetchPromise.then(() => null, () => null);
11511158
if (fetchPromise.constructor != NativePromise) {

0 commit comments

Comments
 (0)