From 45dd332d1db1deec3aaa860f7a9fb0cd0a6f0bb9 Mon Sep 17 00:00:00 2001 From: Jake Champion Date: Thu, 9 Jul 2020 15:17:17 +0100 Subject: [PATCH] Detect if DOMException exists via typeof instead of trying to call it and catching the exception which may get thrown fixes https://github.com/github/fetch/issues/724 --- fetch.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fetch.js b/fetch.js index ef714825..5a572046 100644 --- a/fetch.js +++ b/fetch.js @@ -455,9 +455,8 @@ Response.redirect = function(url, status) { } export var DOMException = global.DOMException -try { - new DOMException() -} catch (err) { + +if (typeof DOMException !== 'function') { DOMException = function(message, name) { this.message = message this.name = name