diff --git a/package-lock.json b/package-lock.json index 943f7e1..f59fdb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@exact-realty/lot", - "version": "0.0.25", + "version": "0.0.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@exact-realty/lot", - "version": "0.0.25", + "version": "0.0.26", "license": "ISC", "devDependencies": { "@exact-realty/esbuild-plugin-closure-compiler": "^1.0.4", diff --git a/package.json b/package.json index 6edbbe4..767b538 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@exact-realty/lot", - "version": "0.0.25", + "version": "0.0.26", "description": "Sandbox for isolating ECMAScript code", "main": "./dist/index.cjs", "types": "./dist/index.d.cts", diff --git a/src/untrusted/impl/worker/workerSandboxManager.ts b/src/untrusted/impl/worker/workerSandboxManager.ts index b782807..c01b59b 100644 --- a/src/untrusted/impl/worker/workerSandboxManager.ts +++ b/src/untrusted/impl/worker/workerSandboxManager.ts @@ -161,7 +161,7 @@ const workerSandboxManager = async ( if (EMessageTypes.REQUEST !== data[0]) return; Logger.debug( - 'Forwarding REQUEST from worker to parent for executing task' + + 'Forwarding REQUEST from worker to parent for executing task ' + data[2], ); diff --git a/src/untrusted/lib/performTaskFactory.ts b/src/untrusted/lib/performTaskFactory.ts index 6ec6b2d..ae07eb9 100644 --- a/src/untrusted/lib/performTaskFactory.ts +++ b/src/untrusted/lib/performTaskFactory.ts @@ -57,7 +57,11 @@ const performTaskFactory = ( unresolved.splice(idx, 1); } }; - incomingPort.onmessage = (ev) => { + // The following const definitions prevent Google Closure Compiler + // from mangling the event handler names + const onmessage = 'onmessage'; + const onmessageerror = 'onmessageerror'; + incomingPort[onmessage] = (ev) => { const data = ev['data']; if ( !aIsArray(data) || @@ -73,7 +77,8 @@ const performTaskFactory = ( (data[0] === EMessageTypes.RESULT ? 'RESULT' : 'ERROR') + - ' from executing task', + ' from executing task ' + + op, ); if (data[0] === EMessageTypes.RESULT) { @@ -83,12 +88,12 @@ const performTaskFactory = ( } markAsResolved(); }; - incomingPort.onmessageerror = (ev) => { + incomingPort[onmessageerror] = () => { Logger.debug( - 'Error receiving task result after executing task', + 'Error decoding task result after executing task ' + op, ); - reject(ev['data']); + reject(new E('Error decoding task result')); markAsResolved(); }; incomingPort.start();