Add onerror handler to Worker to see uncaught errors

This commit is contained in:
Tankred Hase 2014-03-07 23:04:22 +01:00
parent 6bb53f04b4
commit 3604f19eb9

View File

@ -41,6 +41,9 @@ var INITIAL_RANDOM_SEED = 50000, // random bytes seeded to worker
function AsyncProxy(path) { function AsyncProxy(path) {
this.worker = new Worker(path || 'openpgp.worker.js'); this.worker = new Worker(path || 'openpgp.worker.js');
this.worker.onmessage = this.onMessage.bind(this); this.worker.onmessage = this.onMessage.bind(this);
this.worker.onerror = function(e) {
throw new Error('Unhandled error in openpgp worker: ' + e.message + ' (' + e.filename + ':' + e.lineno + ')');
};
this.seedRandom(INITIAL_RANDOM_SEED); this.seedRandom(INITIAL_RANDOM_SEED);
// FIFO // FIFO
this.tasks = []; this.tasks = [];