Fix worker tests in compat browsers
This commit is contained in:
parent
e8ee70b2a8
commit
786d909f79
|
@ -11,6 +11,12 @@ tryTests('Application Worker', tests, {
|
||||||
function tests() {
|
function tests() {
|
||||||
|
|
||||||
it('Should support loading OpenPGP.js from inside a Web Worker', async function() {
|
it('Should support loading OpenPGP.js from inside a Web Worker', async function() {
|
||||||
|
try {
|
||||||
|
eval('async function() {}');
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
const worker = new Worker('./worker/worker_example.js');
|
const worker = new Worker('./worker/worker_example.js');
|
||||||
async function delegate(action, message) {
|
async function delegate(action, message) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -40,8 +40,8 @@ tryTests('Async Proxy', tests, {
|
||||||
await openpgp.initWorker({ path:'../dist/openpgp.worker.js' });
|
await openpgp.initWorker({ path:'../dist/openpgp.worker.js' });
|
||||||
pubKey = (await openpgp.key.readArmored(pub_key)).keys[0];
|
pubKey = (await openpgp.key.readArmored(pub_key)).keys[0];
|
||||||
},
|
},
|
||||||
after: function() {
|
after: async function() {
|
||||||
openpgp.destroyWorker();
|
await openpgp.destroyWorker();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user