Disable Web Workers on browsers without MessageChannel support

For compatibility with old Firefox / Pale Moon 27
This commit is contained in:
Daniel Huigens 2018-12-21 23:08:15 -05:00
parent 3a2408d0f1
commit 95cc9cecf0

View File

@ -65,7 +65,7 @@ let asyncProxy; // instance of the asyncproxy
* @param {Array<Object>} workers alternative to path parameter: web workers initialized with 'openpgp.worker.js'
*/
export function initWorker({ path='openpgp.worker.js', n = 1, workers = [] } = {}) {
if (workers.length || (typeof window !== 'undefined' && window.Worker)) {
if (workers.length || (typeof window !== 'undefined' && window.Worker && window.MessageChannel)) {
asyncProxy = new AsyncProxy({ path, n, workers, config });
return true;
}