aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-03-17 12:54:44 +0000
committerStephen Blott2016-03-17 12:54:44 +0000
commite1aee8b4867e3d315d799ba06ba46fa7d7077c0c (patch)
tree52753640d0661985d0ca33d74105d9b480fe71bb /content_scripts/vimium_frontend.coffee
parent16b150c108f72cc7b3e33c6fa46bd5c2d06c71c8 (diff)
downloadvimium-e1aee8b4867e3d315d799ba06ba46fa7d7077c0c.tar.bz2
More tweaks for #2053.
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee7
1 files changed, 3 insertions, 4 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index a538e46e..13d1377d 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -213,16 +213,15 @@ Frame =
port: null
listeners: {}
- addEventListener: (handler, callback) -> (@listeners[handler] ?= []).push callback
+ addEventListener: (handler, callback) -> @listeners[handler] = callback
postMessage: (handler, request = {}) -> @port.postMessage extend request, {handler}
registerFrameId: ({chromeFrameId}) -> frameId = window.frameId = chromeFrameId
init: (callback) ->
- @addEventListener "registerFrameId", Frame.registerFrameId
@port = chrome.runtime.connect name: "frames"
@port.onMessage.addListener (request) =>
- handler request for handler in @listeners[request.handler]
+ (@listeners[request.handler] ? this[request.handler]) request
@port.onDisconnect.addListener ->
# We disable the content scripts when we lose contact with the background page.
@@ -459,7 +458,7 @@ checkIfEnabledForUrl = do ->
HUD.hide()
normalMode?.setPassKeys passKeys
# Update the page icon, if necessary.
- if frameIsFocused
+ if windowIsFocused()
chrome.runtime.sendMessage
handler: "setIcon"
icon: