From 7d2fa852e02c6a40c535974d64d8a12b31073db0 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 13 Nov 2016 14:08:45 +0900 Subject: [PATCH] Fix #40 --- lib/xmlhttprequest.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/xmlhttprequest.js b/lib/xmlhttprequest.js index ede9a73..2cf89a8 100644 --- a/lib/xmlhttprequest.js +++ b/lib/xmlhttprequest.js @@ -121,14 +121,14 @@ function _receiveResponse(response) { } function _setDispatchProgressEvents(stream) { - const _properties = this._properties; + const _properties = this._properties || {}; const loadStartEvent = new ProgressEvent('loadstart'); this.dispatchEvent(loadStartEvent); stream.on('data', () => { const progressEvent = new ProgressEvent('progress', { - lengthComputable: _properties.lengthComputable, - loaded: _properties.loaded, - total: _properties.total + lengthComputable: _properties.lengthComputable || 0, + loaded: _properties.loaded || 0, + total: _properties.total || 0 }); this.dispatchEvent(progressEvent); });