Skip to content

Commit

Permalink
worker_threads: fix workers isolation
Browse files Browse the repository at this point in the history
Added strict mode inside the worker script.

Fixes: #24947
  • Loading branch information
sagitsofan authored and Trott committed Dec 24, 2018
1 parent 0fffd47 commit f4642f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ function setupChild(evalScript) {
port.unref();
port.postMessage({ type: messageTypes.UP_AND_RUNNING });
if (doEval) {
evalScript('[worker eval]', filename);
const src = `'use strict'; ${filename}`;
evalScript('[worker eval]', src);
} else {
process.argv[1] = filename; // script filename
require('module').runMain();
Expand Down

0 comments on commit f4642f3

Please sign in to comment.