Skip to content

Commit 9abd0a8

Browse files
committed
Deep-clone the worker template to avoid tampering
1 parent 0a93306 commit 9abd0a8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/worker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { objType, createElement, cloneNode, unitConvert } from './utils.js';
66

77
var Worker = function Worker(opt) {
88
// Create the root parent for the proto chain, and the starting Worker.
9-
var root = Object.assign(Worker.convert(Promise.resolve()), Worker.template);
9+
var root = Object.assign(Worker.convert(Promise.resolve()),
10+
JSON.parse(JSON.stringify(Worker.template)));
1011
var self = Worker.convert(Promise.resolve(), root);
1112

1213
// Set progress, optional settings, and return.

0 commit comments

Comments
 (0)