From: Daniel Carl Date: Wed, 21 Jun 2017 20:50:11 +0000 (+0200) Subject: Avoid dbus timeout by timeout function in js #421. X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=d97daa40e29db48a76cb34326fd910171048b3f2;p=vimb.git Avoid dbus timeout by timeout function in js #421. I don't understand why the JavaScript blocks the dbus processing or the return from JavaScript on case of e.click() or on window.location.href = href; the later only cause dbus timeout when the url does not change except of the location hash. --- diff --git a/src/scripts/hints.js b/src/scripts/hints.js index 0bdc71b..2942a77 100644 --- a/src/scripts/hints.js +++ b/src/scripts/hints.js @@ -414,15 +414,17 @@ var hints = Object.freeze((function(){ /* internal used methods */ function open(e) { - var href; - if ((href = e.getAttribute('href')) && href != '#') { - window.location.href = href; - } else { - /* We call click() in async mode to return as fast as possible. If - * we don't return immediately, the EvalJS dbus call will probably - * timeout and cause errors. */ - window.setTimeout(function() {e.click();}, 0); - } + /* We call click() in async mode to return as fast as possible. If + * we don't return immediately, the EvalJS dbus call will probably + * timeout and cause errors. */ + window.setTimeout(function() { + var href; + if ((href = e.getAttribute('href')) && href != '#') { + window.location.href = href; + } else { + e.click(); + } + }, 0); } /* set focus on hint with given index valid hints array */