From 8a6e644fc0c0b9da7cfd16a650a1aa6772dd08bc Mon Sep 17 00:00:00 2001 From: Marcel Mraz Date: Tue, 20 Aug 2024 14:21:40 +0200 Subject: [PATCH] Fix issues with ArrayBuffer when running inside VM --- packages/excalidraw/fonts/wasm/woff2.bindings.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/excalidraw/fonts/wasm/woff2.bindings.ts b/packages/excalidraw/fonts/wasm/woff2.bindings.ts index c9813f604..a34c8e6b7 100644 --- a/packages/excalidraw/fonts/wasm/woff2.bindings.ts +++ b/packages/excalidraw/fonts/wasm/woff2.bindings.ts @@ -6,6 +6,7 @@ * * CHANGELOG: * - replaced existing exports with default esm export (`export default Module;`) + * - replaced "instanceof ArrayBuffer" with "Object.prototype.toString.call(d) === "[object ArrayBuffer]", due to unreliability of different ArrayBuffer instances depending on the context (i.e. inside VM) The MIT License (MIT) @@ -2780,7 +2781,7 @@ const Module = (function () { return str; }, toWireType(destructors, value) { - if (value instanceof ArrayBuffer) { + if (Object.prototype.toString.call(d) === "[object ArrayBuffer]") { value = new Uint8Array(value); } let getLength;