From c4ad76eef147938b5ed3b33d30c64f61027c5262 Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Thu, 22 Mar 2018 16:19:36 -0400 Subject: [PATCH] Turns out ArrayBuffers are not views of themselves. --- src/virtual-machine.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 0ce74559d..a4fa4b87f 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -182,9 +182,10 @@ class VirtualMachine extends EventEmitter { * @return {!Promise} Promise that resolves after targets are installed. */ loadProject (input) { - if (typeof input === 'object' && !ArrayBuffer.isView(input)) { - // If the input is an object and not any ArrayBuffer view - // (this includes all typed arrays and DataViews) + if (typeof input === 'object' && !(input instanceof ArrayBuffer) && + !ArrayBuffer.isView(input)) { + // If the input is an object and not any ArrayBuffer + // or an ArrayBuffer view (this includes all typed arrays and DataViews) // turn the object into a JSON string, because we suspect // this is a project.json as an object // validate expects a string or buffer as input