Turns out ArrayBuffers are not views of themselves.

This commit is contained in:
Karishma Chadha 2018-03-22 16:19:36 -04:00
parent 3a4f620318
commit c4ad76eef1

View file

@ -182,9 +182,10 @@ class VirtualMachine extends EventEmitter {
* @return {!Promise} Promise that resolves after targets are installed. * @return {!Promise} Promise that resolves after targets are installed.
*/ */
loadProject (input) { loadProject (input) {
if (typeof input === 'object' && !ArrayBuffer.isView(input)) { if (typeof input === 'object' && !(input instanceof ArrayBuffer) &&
// If the input is an object and not any ArrayBuffer view !ArrayBuffer.isView(input)) {
// (this includes all typed arrays and DataViews) // 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 // turn the object into a JSON string, because we suspect
// this is a project.json as an object // this is a project.json as an object
// validate expects a string or buffer as input // validate expects a string or buffer as input