From ee0d605047eb4ab1d118c58ba646eec17c1c17b0 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 27 May 2015 16:08:52 -0300 Subject: [PATCH 1/3] Clone shared values to avoid possible modification via reference --- job.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/job.js b/job.js index 438c710..b4e4eac 100644 --- a/job.js +++ b/job.js @@ -723,7 +723,7 @@ Job.prototype._getShared = function (taskId, key) { */ Job.prototype._setShared = function (taskId, key, value) { this.__taskStorages[taskId] = this.__taskStorages[taskId] || {}; - this.__taskStorages[taskId][key] = value; + this.__taskStorages[taskId][key] = _.cloneDeep(value); }; /** From c7cf423e66cb1250322e4791db26a234b1bb1d70 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 27 May 2015 16:10:06 -0300 Subject: [PATCH 2/3] Fix cloning in the wrong spot --- job.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/job.js b/job.js index b4e4eac..a001b93 100644 --- a/job.js +++ b/job.js @@ -709,7 +709,7 @@ Job.prototype.__taskIsInPlan = function (taskId) { */ Job.prototype._getShared = function (taskId, key) { if (this.__taskStorages[taskId] && this.__taskStorages[taskId][key] !== undefined) { - return this.__taskStorages[taskId][key]; + return _.cloneDeep(this.__taskStorages[taskId][key]); } return undefined; @@ -723,7 +723,7 @@ Job.prototype._getShared = function (taskId, key) { */ Job.prototype._setShared = function (taskId, key, value) { this.__taskStorages[taskId] = this.__taskStorages[taskId] || {}; - this.__taskStorages[taskId][key] = _.cloneDeep(value); + this.__taskStorages[taskId][key] = value; }; /** From 62129ab0e5126953196af1b5fc7abed42fc382a6 Mon Sep 17 00:00:00 2001 From: Rafael Vidaurre Date: Wed, 27 May 2015 16:10:44 -0300 Subject: [PATCH 3/3] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d5781af..3f7ea97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yakuza", - "version": "1.0.4", + "version": "1.0.5", "description": "Heavyweight scraping framework for mobsters", "main": "yakuza.js", "repository": {