aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-03-15 16:02:40 +0000
committerStephen Blott2016-03-17 11:17:03 +0000
commite19ff7a58ec97de3524a6eb32d5f6e0f57696354 (patch)
tree8003aac41c1da6a3e21a48363ee2ee91fdcc4003
parent309704eba6673360c8b29a103bc2c76244e82b08 (diff)
downloadvimium-e19ff7a58ec97de3524a6eb32d5f6e0f57696354.tar.bz2
Tweaks.
-rw-r--r--background_scripts/main.coffee3
-rw-r--r--content_scripts/vimium_frontend.coffee7
2 files changed, 4 insertions, 6 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 5135a158..6b845ff1 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -367,7 +367,6 @@ Frames =
onConnect: (sender, port) ->
[tabId, frameId] = [sender.tab.id, sender.frameId]
# We always add frameId 0, the top frame, automatically, and never unregister it.
- frameIdsForTab[tabId]?
frameIdsForTab[tabId] ?= [0]
frameIdsForTab[tabId].push frameId unless frameId == 0
port.postMessage handler: "registerFrameId", chromeFrameId: frameId
@@ -376,7 +375,7 @@ Frames =
# Unregister the frame. However, we never unregister the main/top frame. If the tab is navigating to
# another page, then there'll be a new top frame (with the same Id) along soon. If the tab is closing,
# then we'll tidy up in the chrome.tabs.onRemoved listener, below. This approach avoids any dependency
- # on the order in which register and unregister events happens (on navigation, a new top frame
+ # on the order in which register and unregister events happens (e.g. on navigation, a new top frame
# registering before the old one is deregistered).
if tabId of frameIdsForTab and frameId != 0
frameIdsForTab[tabId] = frameIdsForTab[tabId].filter (fId) -> fId != frameId
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index c8a0f2c2..70ff19f5 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -225,12 +225,12 @@ Frame =
registerFrameId: ({chromeFrameId}) -> frameId = window.frameId = chromeFrameId
init: (callback) ->
+ @addEventListener "registerFrameId", Frame.registerFrameId
@port = chrome.runtime.connect name: "frames"
+ @port.onDisconnect.addListener => @port.postMessage = ->
@port.onMessage.addListener (request) =>
handler request for handler in @listeners[request.handler]
- @addEventListener "registerFrameId", Frame.registerFrameId
-
handleShowHUDforDuration = ({ text, duration }) ->
if DomUtils.isTopFrame()
DomUtils.documentReady -> HUD.showForDuration text, duration
@@ -270,7 +270,7 @@ DomUtils.documentReady ->
focusThisFrame = (request) ->
unless request.forceFocusThisFrame
if window.innerWidth < 3 or window.innerHeight < 3 or document.body?.tagName.toLowerCase() == "frameset"
- # This frame is too small to focus or its a frameset. Cancel and tell the background page to focus the
+ # This frame is too small to focus or it's a frameset. Cancel and tell the background page to focus the
# next frame instead. This affects sites like Google Inbox, which have many tiny iframes. See 1317.
chrome.runtime.sendMessage handler: "nextFrame", frameId: frameId
return
@@ -477,7 +477,6 @@ checkIfEnabledForUrl = do ->
checkEnabledAfterURLChange = ->
checkIfEnabledForUrl() if windowIsFocused()
-
window.handleEscapeForFindMode = ->
document.body.classList.remove("vimiumFindMode")
# removing the class does not re-color existing selections. we recreate the current selection so it reverts