1 | export function polyfillNeeded(self) {
|
2 | if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
|
3 | console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');
|
4 | return true;
|
5 | }
|
6 |
|
7 | // Note that the "unfetch" minimal fetch polyfill defines fetch() without
|
8 | // defining window.Request, and this polyfill need to work on top of unfetch
|
9 | // so the below feature detection needs the !self.AbortController part.
|
10 | // The Request.prototype check is also needed because Safari versions 11.1.2
|
11 | // up to and including 12.1.x has a window.AbortController present but still
|
12 | // does NOT correctly implement abortable fetch:
|
13 | // https://bugs.webkit.org/show_bug.cgi?id=174980#c2
|
14 | return (typeof(self.Request) === 'function' && !self.Request.prototype.hasOwnProperty('signal')) || !self.AbortController;
|
15 | }
|