Skip to content
Snippets Groups Projects
Commit ec96bb8a authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add a browser check for AbortController

It's nice to have to aborting requests and adding timeouts to them.
This is in theory supported in all browsers covered by other checks,
but Safari 11.x had a broken implementation.

Fixes #38
parent 97a1ff50
No related branches found
No related tags found
No related merge requests found
Pipeline #14448 passed
...@@ -74,6 +74,13 @@ function supportsEval() { ...@@ -74,6 +74,13 @@ function supportsEval() {
return true; return true;
} }
// https://caniuse.com/abortcontroller
function supportsAbortController() {
// AbortController in older Safari is broken, so check for the signal property
// as well.
return (!!window.AbortController && Request.prototype.hasOwnProperty('signal'));
}
function isBrowserSupported() { function isBrowserSupported() {
if (!supportsEval()) { if (!supportsEval()) {
console.log("Eval support disabled, skipping browser feature detection."); console.log("Eval support disabled, skipping browser feature detection.");
...@@ -110,6 +117,11 @@ function isBrowserSupported() { ...@@ -110,6 +117,11 @@ function isBrowserSupported() {
return false; return false;
} }
if (!supportsAbortController()) {
console.log("AbortController not supported");
return false;
}
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment