diff --git a/lib/Http/HttpModule.js b/lib/Http/HttpModule.js index 42639e8..9702e19 100755 --- a/lib/Http/HttpModule.js +++ b/lib/Http/HttpModule.js @@ -95,7 +95,7 @@ export default class HttpModule extends EventDispatcher { } }); - this.on(['xhr-loadend', 'xhr-upload-loadend'], () => { + this.on(['xhr-loadend', 'xhr-upload-loadend', 'xhr-error'], () => { if (!this._requestingOverridden) { this._requesting = false; } diff --git a/lib/Http/LatencyModule.js b/lib/Http/LatencyModule.js index 219b69c..416ca7e 100644 --- a/lib/Http/LatencyModule.js +++ b/lib/Http/LatencyModule.js @@ -156,6 +156,10 @@ export default class LatencyModule extends HttpModule { // Measure the latency with the Resource Timing API once the request is finished if (supportsResourceTiming) { this.on('xhr-load', () => this._measure()); + this.on('xhr-error', () => { + this._latencies.push(null); + this._nextRequest(); + }); } // If the browser doesn't support the Resource Timing API, we fallback on a Datetime solution.