From 865fdabaef02f371dac1dbb57a4b6a8b01218d9b Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Wed, 24 Feb 2016 08:03:39 +0100 Subject: [PATCH] Fix issues when updating VimFx After having updated VimFx, trying to use the `f` command on toggle buttons often failed. This was because the frame script message listeners from the old version wasn't shut down properly, which resulted in there being _two_ listeners for the message to simulate a click on an element. The effects of this was especially noticeable on toggle buttons, because clicking a toggle button twice is a no-op. That gave the impression of VimFx failing to simulate a click at all. I think this erraneous shutdown behavior must have been introduced in commit 24b701e9, which switched from a synchronous message passing to an asynchronous one in bootstrap.coffee. Previously, the shutdown message listener for frame scripts had to be added after a timeout. Since mentioned commit, that timeout is added in the response callback for the mentioned asynchronous message, which should make the timeout unnecessary, but the timeout was still kept in that commit. It shouldn't matter, but somehow it does. Removing the timeout fixes the double message listeners problem, and does not seem to re-introduce the problems that were fixed be adding the timeout in the first place (commit ec3a4394). --- extension/bootstrap.coffee | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/extension/bootstrap.coffee b/extension/bootstrap.coffee index dd09d93..6127a7e 100644 --- a/extension/bootstrap.coffee +++ b/extension/bootstrap.coffee @@ -121,10 +121,5 @@ do (global = this) -> global.startup() - # When updating the add-on, the previous version is going to shut down at - # the same time as the new version starts up. Add the shutdown listener in - # the next tick to prevent the previous version from triggering it. - content.setTimeout((-> - messageManager.listenOnce('shutdown', global.shutdown) - ), 0) + messageManager.listenOnce('shutdown', global.shutdown) ) -- 2.39.3