From cc02483cd0a378b295b0dbadb0b835027f502d01 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Sun, 13 Mar 2016 12:55:49 +0100 Subject: [PATCH] Disallow old version of VimFx to communicate with new version Commit 865fdaba attempted to fix an issue where frame script message listeners from the old version of VimFx wasn't shut down properly when VimFx was updated. Since then, the problem has become very rare, but unfortunately still happens occasionally. I really have no idea why it can still happen. It might even be that there's nothing that can be done due to the way Firefox works. This commit tries to make any leftover frame script message listeners useless, by adding the `BUILD_TIME` in all message names. --- extension/bootstrap.coffee | 3 ++- extension/lib/message-manager.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extension/bootstrap.coffee b/extension/bootstrap.coffee index 0a73a5b..2623b5b 100644 --- a/extension/bootstrap.coffee +++ b/extension/bootstrap.coffee @@ -33,6 +33,7 @@ do (global = this) -> {classes: Cc, interfaces: Ci, utils: Cu} = Components ADDON_PATH = 'chrome://vimfx' IS_FRAME_SCRIPT = (typeof content != 'undefined') + BUILD_TIME = do -> # @echo BUILD_TIME REQUIRE_DATA = do -> # @echo REQUIRE_DATA unless IS_FRAME_SCRIPT @@ -73,7 +74,7 @@ do (global = this) -> require: (path) -> require.call(null, path, moduleRoot, currentDir) module, exports: module.exports Cc, Ci, Cu - ADDON_PATH + ADDON_PATH, BUILD_TIME IS_FRAME_SCRIPT FRAME_SCRIPT_ENVIRONMENT: if IS_FRAME_SCRIPT then global else null } diff --git a/extension/lib/message-manager.coffee b/extension/lib/message-manager.coffee index 3e54aaa..4bec86b 100644 --- a/extension/lib/message-manager.coffee +++ b/extension/lib/message-manager.coffee @@ -22,7 +22,7 @@ # messages between the main process and frame scripts. There is one frame script # per tab, and only them can access web page content. -namespace = (name, prefix) -> "#{ADDON_PATH}/#{prefix}#{name}" +namespace = (name, prefix) -> "#{ADDON_PATH}/#{BUILD_TIME}/#{prefix}#{name}" defaultMessageManager = if IS_FRAME_SCRIPT -- 2.39.3