From 4edc83ea4fe5c859ab6dfcc3c579a61f610132e4 Mon Sep 17 00:00:00 2001 From: Anthony Humphreys Date: Tue, 5 Jun 2018 09:34:53 +0100 Subject: [PATCH 1/2] proposed fix for #18223 --- Libraries/Network/XMLHttpRequest.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Libraries/Network/XMLHttpRequest.js b/Libraries/Network/XMLHttpRequest.js index e8be40a0ac6540..c124bc6ef50c47 100644 --- a/Libraries/Network/XMLHttpRequest.js +++ b/Libraries/Network/XMLHttpRequest.js @@ -247,7 +247,11 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { if (typeof this._response === 'object' && this._response) { this._cachedResponse = BlobManager.createFromOptions(this._response); } else { - throw new Error(`Invalid response for blob: ${this._response}`); + if (this._response === '') { + this._cachedResponse = null; + } else { + throw new Error(`Invalid response for blob: ${this._response}`); + } } break; @@ -595,4 +599,4 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { } } -module.exports = XMLHttpRequest; +module.exports = XMLHttpRequest; \ No newline at end of file From 38ae46654634869d18d2b670af0fbe43ded71bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= <165856+hramos@users.noreply.github.com> Date: Thu, 7 Jun 2018 10:03:10 -0400 Subject: [PATCH 2/2] Coding conventions --- Libraries/Network/XMLHttpRequest.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Libraries/Network/XMLHttpRequest.js b/Libraries/Network/XMLHttpRequest.js index c124bc6ef50c47..00f08c2fadc2c8 100644 --- a/Libraries/Network/XMLHttpRequest.js +++ b/Libraries/Network/XMLHttpRequest.js @@ -246,12 +246,10 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { case 'blob': if (typeof this._response === 'object' && this._response) { this._cachedResponse = BlobManager.createFromOptions(this._response); - } else { - if (this._response === '') { - this._cachedResponse = null; - } else { - throw new Error(`Invalid response for blob: ${this._response}`); - } + } else if (this._response === '') { + this._cachedResponse = null; + } else { + throw new Error(`Invalid response for blob: ${this._response}`); } break; @@ -599,4 +597,4 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) { } } -module.exports = XMLHttpRequest; \ No newline at end of file +module.exports = XMLHttpRequest;