aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/html_script_finder/web_labels/script_hash_worker.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/html_script_finder/web_labels/script_hash_worker.js b/lib/html_script_finder/web_labels/script_hash_worker.js
index a8b2fdb..92ffb82 100644
--- a/lib/html_script_finder/web_labels/script_hash_worker.js
+++ b/lib/html_script_finder/web_labels/script_hash_worker.js
@@ -49,15 +49,28 @@ exports.addToCache = function (lic, delay, jsWebLabelsURL, callback) {
lic.fileUrl
);
console.debug('returning xhr from', lic.fileUrl);
- callback(lic.fileUrl);
+ if (typeof callback === 'function') {
+ callback(lic.fileUrl);
+ } else {
+ console.debug('callback is not a function:', callback);
+ }
} catch (e) {
- callback(lic.fileUrl);
+ if (typeof callback === 'function') {
+ callback(lic.fileUrl);
+ } else {
+ console.debug('callback is not a function:', callback);
+ }
}
};
// just callback after 5 seconds if we don't get the answer yet.
timers.setTimeout(function() {
cb = function() {};
- callback(lic.fileUrl); }, 20000);
+ if (typeof callback === 'function') {
+ callback(lic.fileUrl);
+ } else {
+ console.debug('callback is not a function:', callback);
+ }
+ }, 20000);
xhr({'url': lic.fileUrl}, cb);
}, delay);