aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/main.coffee12
-rw-r--r--content_scripts/link_hints.coffee2
-rw-r--r--content_scripts/vimium_frontend.coffee2
3 files changed, 9 insertions, 7 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 8b1e61ce..6dd3906f 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -292,12 +292,6 @@ Frames =
[tabId, frameId] = [sender.tab.id, sender.frameId]
port.postMessage handler: "registerFrameId", chromeFrameId: frameId
- port.onDisconnect.addListener listener = ->
- if tabId of frameIdsForTab
- frameIdsForTab[tabId] = (fId for fId in frameIdsForTab[tabId] when fId != frameId)
- if tabId of portsForTab
- delete portsForTab[tabId][frameId]
-
# Return our onMessage handler for this port.
(request, port) =>
this[request.handler] {request, tabId, frameId, port}
@@ -306,6 +300,12 @@ Frames =
frameIdsForTab[tabId].push frameId unless frameId in frameIdsForTab[tabId] ?= []
(portsForTab[tabId] ?= {})[frameId] = port
+ unregsterFrame: ({tabId, frameId}) ->
+ if tabId of frameIdsForTab
+ frameIdsForTab[tabId] = (fId for fId in frameIdsForTab[tabId] when fId != frameId)
+ if tabId of portsForTab
+ delete portsForTab[tabId][frameId]
+
isEnabledForUrl: ({request, tabId, port}) ->
urlForTab[tabId] = request.url if request.frameIsFocused
enabledState = Exclusions.isEnabledForUrl request.url
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index cef4b480..e650463f 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -72,7 +72,7 @@ HintCoordinator =
# FIXME(smblott) Global link hints is currently insufficiently reliable. If the mode above is left in
# place, then Vimium blocks. As a temporary measure, we install a timer to remove it.
unless @debug
- Utils.setTimeout 1000, => @suppressKeyboardEvents.exit() if @suppressKeyboardEvents.modeIsActive
+ Utils.setTimeout 1000, => @suppressKeyboardEvents.exit() if @suppressKeyboardEvents?.modeIsActive
@onExit = [onExit]
@sendMessage "prepareToActivateMode", modeIndex: availableModes.indexOf mode
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index b73bd2e3..d9fc363e 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -244,6 +244,8 @@ Frame =
isEnabledForUrl = false
window.removeEventListener "focus", onFocus
+ window.addEventListener "unload", => @postMessage "unregsterFrame"
+
setScrollPosition = ({ scrollX, scrollY }) ->
if DomUtils.isTopFrame()
DomUtils.documentReady ->