aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNik Nyby <nikolas@gnu.org>2015-10-07 19:58:12 -0400
committerNik Nyby <nikolas@gnu.org>2015-10-07 19:58:12 -0400
commit3e9e613851e22eddf507ca1fbc5e5a2511f4cdd8 (patch)
treeca751418f7ae88da8c8b5686a722219643070427 /lib
parentb73d5691fbc2a2b5c60b110a7c98fcd9c4d62c1b (diff)
downloadlibrejsxul-3e9e613851e22eddf507ca1fbc5e5a2511f4cdd8.tar.lz
librejsxul-3e9e613851e22eddf507ca1fbc5e5a2511f4cdd8.tar.xz
librejsxul-3e9e613851e22eddf507ca1fbc5e5a2511f4cdd8.zip
Revert "Add Ruben's isFreeLicensed check for external scripts"
This reverts commit 9b79c2a61be72965c001c8d9779a7b3188628613.
Diffstat (limited to 'lib')
-rw-r--r--lib/js_checker/js_checker.js46
1 files changed, 14 insertions, 32 deletions
diff --git a/lib/js_checker/js_checker.js b/lib/js_checker/js_checker.js
index da3ebe6..21bfeaf 100644
--- a/lib/js_checker/js_checker.js
+++ b/lib/js_checker/js_checker.js
@@ -161,6 +161,7 @@ JsChecker.prototype.isFreeLicensed = function(script) {
* Takes in some javascript code (as string).
* Uses Narcissus parser to build an abstract syntax tree.
* Checks for trivialness.
+ *
*/
JsChecker.prototype.searchJs = function(jsCode, resultReady, url) {
var that = this;
@@ -203,39 +204,20 @@ JsChecker.prototype.searchJs = function(jsCode, resultReady, url) {
this.freeToken = types.emptyTypeObj();
this.nontrivialness = types.emptyTypeObj();
- if (typeof url === 'undefined' || url === null) {
- // use this.hash to keep track of comments made by the nontrivial
- // checker code about why/how the code is found to be nontrivial.
- this.nonTrivialChecker =
- nonTrivialModule.nonTrivialChecker(this.hash);
-
- // register callback and hash. So that result
- // can be passed.
- setHashCallback(
- this.hash, this.handleTree.bind(this), this.notification);
-
- // parse using ChromeWorker.
- console.debug(
- 'JsChecker.searchJs(): starting narcissusWorker.parse()');
- narcissusWorker.parse(this.jsCode, this.hash);
- } else {
- // Handle external scripts
- console.debug('Analyzing external script: ' + url);
- this.parseTree = {};
- if (this.isFreeLicensed(this.jsCode)) {
- this.parseTree.freeTrivialCheck = type.trivialWithComment(
- 'This script is under free software licenses: ' + url);
- } else {
- this.parseTree.freeTrivialCheck = type.nontrivialWithComment(
- 'This external script is not under free software ' +
- 'licenses: ' + url);
- }
+ // use this.hash to keep track of comments made by the nontrivial
+ // checker code about why/how the code is found to be nontrivial.
+ this.nonTrivialChecker =
+ nonTrivialModule.nonTrivialChecker(this.hash);
- // Cache result with hash of script for future checks
- scriptsCached.addEntry(
- this.jsCode, this.parseTree.freeTrivialCheck,
- this.relationChecker, true, this.url);
- }
+ // register callback and hash. So that result
+ // can be passed.
+ setHashCallback(
+ this.hash, this.handleTree.bind(this), this.notification);
+
+ // parse using ChromeWorker.
+ console.debug(
+ 'JsChecker.searchJs(): starting narcissusWorker.parse()');
+ narcissusWorker.parse(this.jsCode, this.hash);
} catch (x) {
console.debug('error', x);
this.handleTree(false, x);