aboutsummaryrefslogtreecommitdiffstats
path: root/lib/script_entries/scripts_cache.js
diff options
context:
space:
mode:
authorNik Nyby <nikolas@gnu.org>2015-10-07 19:55:31 -0400
committerNik Nyby <nikolas@gnu.org>2015-10-07 19:55:31 -0400
commitb73d5691fbc2a2b5c60b110a7c98fcd9c4d62c1b (patch)
treea5fdc904c8ffe33e828f45f1d2a5576c7c7a7132 /lib/script_entries/scripts_cache.js
parent4a63db7095a831352eaba726a95d7c46eec0f833 (diff)
downloadlibrejsxul-b73d5691fbc2a2b5c60b110a7c98fcd9c4d62c1b.tar.lz
librejsxul-b73d5691fbc2a2b5c60b110a7c98fcd9c4d62c1b.tar.xz
librejsxul-b73d5691fbc2a2b5c60b110a7c98fcd9c4d62c1b.zip
Revert "Resolve circular dependency btw free_libraries and scripts_cached"
This reverts commit e5bd270b6b4692bad78561a4baf81c5d341f4790.
Diffstat (limited to 'lib/script_entries/scripts_cache.js')
-rw-r--r--lib/script_entries/scripts_cache.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/script_entries/scripts_cache.js b/lib/script_entries/scripts_cache.js
index dfc5e6a..47ab069 100644
--- a/lib/script_entries/scripts_cache.js
+++ b/lib/script_entries/scripts_cache.js
@@ -19,7 +19,11 @@
* You should have received a copy of the GNU General Public License
* along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>.
*/
-var relationChecker = require("js_checker/relation_checker").relationChecker;
+var relationCheckerObj = require("js_checker/relation_checker")
+ .relationChecker;
+
+// import free_libraries to populate the cache hash map.
+var free_libraries = require("script_entries/free_libraries");
var crypto = require('script_entries/crypto');
const checkTypes = require("js_checker/constant_types").checkTypes;
@@ -48,8 +52,6 @@ ScriptsCached.prototype.getHash = function(scriptText) {
*/
ScriptsCached.prototype.resetCache = function () {
cachedResults = {};
- // import free_libraries to populate the cache hash map.
- var free_libraries = require("script_entries/free_libraries");
free_libraries.init();
};
@@ -62,12 +64,11 @@ ScriptsCached.prototype.resetCache = function () {
*
*/
ScriptsCached.prototype.addEntry = function(
- scriptText, result, relationCheckerObj, allowTrivial, url
-) {
+ scriptText, result, relationChecker, allowTrivial, url) {
console.debug("result addEntry is", JSON.stringify(result));
cachedResults[this.getHash(scriptText)] = {
'result': result,
- 'relationChecker': relationChecker(),
+ 'relationChecker': relationCheckerObj(),
'allowTrivial': allowTrivial,
'url': url
};