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); });