From 4a63db7095a831352eaba726a95d7c46eec0f833 Mon Sep 17 00:00:00 2001 From: Nik Nyby Date: Sat, 20 Jun 2015 14:32:58 -0400 Subject: Look up web labels license by index instead of iteration --- lib/html_script_finder/web_labels/js_web_labels.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/html_script_finder/web_labels') diff --git a/lib/html_script_finder/web_labels/js_web_labels.js b/lib/html_script_finder/web_labels/js_web_labels.js index f811e35..510852b 100644 --- a/lib/html_script_finder/web_labels/js_web_labels.js +++ b/lib/html_script_finder/web_labels/js_web_labels.js @@ -174,6 +174,26 @@ WebLabelFinder.prototype.isLicenseFree = function( var license; var found = false; + // Check if we can look up this license by its identifier. + var identifier = lic.licenses[i]['licenseName']; + if (typeof identifier !== 'undefined' && + typeof licenses[identifier] !== 'undefined' + ) { + console.debug('recognized by index', identifier); + // This license was recognized, and it was free. Add it + // to the array of license status, which we'll look at + // when we're done with this web label row. + licenseStatuses.push(true); + + console.debug("about TO ADD TO XHR: ", lic.fileUrl); + this.listCheck[lic.fileUrl] = 0; + addToCache(lic, 0, jslicenseURL, callback); + + // Break out of the loop cause we found a matching license. + found = true; + continue; + } + // For each license from the internal license definitions for (license in licenses) { if (found === true) { -- cgit v1.2.3