From ab62b5f202091c619510bff5cbc4651e2a16bdb0 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 18 Aug 2021 11:04:43 +0200 Subject: [PATCH] Check SharedArrayBuffer support in outer --- www/common/common-util.js | 4 ++++ www/common/onlyoffice/inner.js | 4 ++++ www/common/sframe-common-outer.js | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/www/common/common-util.js b/www/common/common-util.js index 3d2a8d0a4..3419b5160 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -616,6 +616,10 @@ getColor().toString(16); }; + Util.supportsWasm = function () { + return !(typeof(Atomics) === "undefined" || typeof (SharedArrayBuffer) === "undefined" || typeof(WebAssembly) === 'undefined'); + }; + if (typeof(module) !== 'undefined' && module.exports) { module.exports = Util; } else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) { diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 26c5aa947..9e31fa998 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -138,6 +138,10 @@ define([ var startOO = function () {}; + var supportsXLSX = function () { + return privateData.supportsWasm; + }; + var getMediasSources = APP.getMediasSources = function() { content.mediasSources = content.mediasSources || {}; return content.mediasSources; diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index ca60c2243..bc1f2f725 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -638,7 +638,8 @@ define([ title: Cryptpad.fromFileData.title } : undefined, burnAfterReading: burnAfterReading, - storeInTeam: Cryptpad.initialTeam || (Cryptpad.initialPath ? -1 : undefined) + storeInTeam: Cryptpad.initialTeam || (Cryptpad.initialPath ? -1 : undefined), + supportsWasm: Utils.Util.supportsWasm() }; if (window.CryptPad_newSharedFolder) { additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;