From 6d776a9f56f05e4298577f25f0a54b924cb1f6e6 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 14 Feb 2015 11:12:30 +0000 Subject: Fix(?) issue with browser icon. I'm seeing an intermitent issue whereby the browser icon is showing as disabled, when vimium is in fact enabled. It's intermitent, so difficult to track down. I went back to look at the old code for setting the browser icon, and reset this code to look more like the old code. I suspect the problem may be that we disabling the icon because we're getting no response from one frame (or something like that). --- background_scripts/main.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index cb70db9a..0d33b7f7 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -366,6 +366,9 @@ root.updateActiveState = updateActiveState = (tabId) -> disabledIcon = "icons/browser_action_disabled.png" partialIcon = "icons/browser_action_partial.png" chrome.tabs.get tabId, (tab) -> + # Default to disabled state in case we can't connect to Vimium, primarily for the "New Tab" page. + setBrowserActionIcon(tabId,disabledIcon) + setBadge badge: "" chrome.tabs.sendMessage tabId, { name: "getActiveState" }, (response) -> if response isCurrentlyEnabled = response.enabled @@ -382,10 +385,7 @@ root.updateActiveState = updateActiveState = (tabId) -> # Propagate the new state only if it has changed. if (isCurrentlyEnabled != enabled || currentPasskeys != passKeys) chrome.tabs.sendMessage(tabId, { name: "setState", enabled: enabled, passKeys: passKeys, incognito: tab.incognito }) - else - # We didn't get a response from the front end, so Vimium isn't running. - setBrowserActionIcon(tabId,disabledIcon) - setBadge {badge: ""} + handleUpdateScrollPosition = (request, sender) -> updateScrollPosition(sender.tab, request.scrollX, request.scrollY) -- cgit v1.2.3