Skip to content

Commit

Permalink
fix #8411, fetch in case of cache error (#8415) (#8417)
Browse files Browse the repository at this point in the history
* fix #8411, fetch in case of cache error

* Use warnOnce
  • Loading branch information
Asheem Mamoowala authored and ahk committed Jul 1, 2019
1 parent c1eddeb commit 8e43f06
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/util/ajax.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8e43f06

Please sign in to comment.