From 37c6ab8a0ce1ceb8038c285694efbf0cf52f1864 Mon Sep 17 00:00:00 2001 From: Tankred Hase <tankred@whiteout.io> Date: Wed, 12 Feb 2014 19:28:54 +0100 Subject: [PATCH] do clearer case checking and load minified lib in worker --- src/openpgp.js | 2 +- src/worker/worker.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openpgp.js b/src/openpgp.js index 4cdabc32..30924aec 100644 --- a/src/openpgp.js +++ b/src/openpgp.js @@ -231,7 +231,7 @@ function generateKeyPair(keyType, numBits, userId, passphrase, callback) { * Are we in a browser and do we support worker? */ function useWorker(callback) { - if (typeof callback === 'undefined') { + if (typeof window === 'undefined' || !window.Worker || typeof callback !== 'function') { return false; } diff --git a/src/worker/worker.js b/src/worker/worker.js index f8d6a2ef..f3180251 100644 --- a/src/worker/worker.js +++ b/src/worker/worker.js @@ -17,7 +17,7 @@ window = {}; // to make UMD bundles work -importScripts('openpgp.js'); +importScripts('openpgp.min.js'); var MIN_SIZE_RANDOM_BUFFER = 40000; var MAX_SIZE_RANDOM_BUFFER = 60000;