Skip to content

Commit

Permalink
Don't block on slow pages, igoring polyfill.io
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 15, 2018
1 parent 5b0f933 commit bd17870
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion buildtools/check-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,23 @@ page.onAlert = function(msg) {
console.log('alert: ' + msg);
exitCode = 2;
};

page.onResourceError = function(resourceError) {
if (resourceError.url.includes('tile.openstreetmap.org')) {
console.warn('Ignoring resource error from OpenStreetMap');
} else if (resourceError.url.includes('https://maps.googleapis.com/maps/api/js')) {
console.warn('Ignoring resource error from Google');
} else if (resourceError.url.includes('https://csi.gstatic.com/')) {
console.warn('Ignoring resource error from Google static');
if (resourceError.url.includes('cdn.polyfill.io')) {
console.warn('Ignoring resource error from polyfill.io');
} else if (resourceError.errorCode >= 400) {
console.log('Resource error: ' + resourceError.errorCode + ', ' + resourceError.url);
console.log('Resource error: ' + resourceError.errorCode + ', ' + resourceError.errorString + ', ' + resourceError.url);
exitCode = 2;
}
};
page.onResourceTimeout = page.onResourceError;
page.settings.resourceTimeout = 2000;
page.onUrlChanged = function(url) {
console.log('URL changed: ' + url);
};
Expand Down

0 comments on commit bd17870

Please sign in to comment.