diff options
author | Nik Nyby <nikolas@gnu.org> | 2015-06-20 14:32:58 -0400 |
---|---|---|
committer | Nik Nyby <nikolas@gnu.org> | 2015-06-20 14:32:58 -0400 |
commit | 4a63db7095a831352eaba726a95d7c46eec0f833 (patch) | |
tree | fc965299086d23852f73b672802d93fecf81b0f9 | |
parent | 7960459fc1d81dce2d5b08e5ae4873c3ad5d0b85 (diff) | |
download | librejsxul-4a63db7095a831352eaba726a95d7c46eec0f833.tar.lz librejsxul-4a63db7095a831352eaba726a95d7c46eec0f833.tar.xz librejsxul-4a63db7095a831352eaba726a95d7c46eec0f833.zip |
Look up web labels license by index instead of iteration
-rw-r--r-- | lib/html_script_finder/web_labels/js_web_labels.js | 20 |
1 files changed, 20 insertions, 0 deletions
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) { |