diff options
author | Nik Nyby <nikolas@gnu.org> | 2015-04-02 21:08:03 -0400 |
---|---|---|
committer | Nik Nyby <nikolas@gnu.org> | 2015-04-02 21:08:03 -0400 |
commit | f3b7630c6f276545696d8abf91f90c03c3bb0cf6 (patch) | |
tree | 8c09f28bc4d649bbdd50c7dcb549f69307e2e3b5 /lib/html_script_finder | |
parent | fdc3e8a485ef5e89dc24b8e9f53875940991a1dc (diff) | |
download | librejsxul-f3b7630c6f276545696d8abf91f90c03c3bb0cf6.tar.lz librejsxul-f3b7630c6f276545696d8abf91f90c03c3bb0cf6.tar.xz librejsxul-f3b7630c6f276545696d8abf91f90c03c3bb0cf6.zip |
Don't call callback if it's not a function
Diffstat (limited to 'lib/html_script_finder')
-rw-r--r-- | lib/html_script_finder/web_labels/script_hash_worker.js | 19 |
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); |