From 8e43f063251a6875a6792a5b31545bcd97c6683d Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Mon, 1 Jul 2019 11:08:06 -0700 Subject: [PATCH] fix #8411, fetch in case of cache error (#8415) (#8417) * fix #8411, fetch in case of cache error * Use warnOnce --- src/util/ajax.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util/ajax.js b/src/util/ajax.js index 374be504772..4f889301573 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -1,7 +1,7 @@ // @flow import window from './window'; -import { extend } from './util'; +import { extend, warnOnce } from './util'; import { isMapboxHTTPURL, hasCacheDefeatingSku } from './mapbox'; import config from './config'; import assert from 'assert'; @@ -111,7 +111,11 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon const validateOrFetch = (err, cachedResponse, responseIsFresh) => { if (err) { - return callback(err); + // Do fetch in case of cache error. + // HTTP pages in Edge trigger a security error that can be ignored. + if (err.message !== 'SecurityError') { + warnOnce(err); + } } if (cachedResponse && responseIsFresh) {