summaryrefslogtreecommitdiff
path: root/lib/internal/process/worker_thread_only.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/process/worker_thread_only.js')
-rw-r--r--lib/internal/process/worker_thread_only.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/internal/process/worker_thread_only.js b/lib/internal/process/worker_thread_only.js
index b29bc7a390..2171d2b586 100644
--- a/lib/internal/process/worker_thread_only.js
+++ b/lib/internal/process/worker_thread_only.js
@@ -43,12 +43,24 @@ function initializeWorkerStdio() {
};
}
-function createMessageHandler(port) {
+function createMessageHandler(port, prepareUserCodeExecution) {
const publicWorker = require('worker_threads');
return function(message) {
if (message.type === messageTypes.LOAD_SCRIPT) {
- const { filename, doEval, workerData, publicPort, hasStdin } = message;
+ const {
+ filename,
+ doEval,
+ workerData,
+ publicPort,
+ manifestSrc,
+ manifestURL,
+ hasStdin
+ } = message;
+ if (manifestSrc) {
+ require('internal/process/policy').setup(manifestSrc, manifestURL);
+ }
+ prepareUserCodeExecution();
publicWorker.parentPort = publicPort;
publicWorker.workerData = workerData;