aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/main.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-02-14 11:12:30 +0000
committerStephen Blott2015-02-14 11:25:25 +0000
commit6d776a9f56f05e4298577f25f0a54b924cb1f6e6 (patch)
tree88969440cc7565681888650e1d742df2511f6b7d /background_scripts/main.coffee
parentaead8482d7400f4355eb4c339463549a0921ee91 (diff)
downloadvimium-6d776a9f56f05e4298577f25f0a54b924cb1f6e6.tar.bz2
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).
Diffstat (limited to 'background_scripts/main.coffee')
-rw-r--r--background_scripts/main.coffee8
1 files changed, 4 insertions, 4 deletions
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)