aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
authormrmr19932014-10-20 06:30:17 +0100
committermrmr19932014-11-23 11:57:47 +0000
commit3c24c79b09735536e883dea6a00fb436979bb990 (patch)
tree4a18c773d209d884652742beafe23e96be54c723 /content_scripts/vimium_frontend.coffee
parent99498dec4c41c3602cd306d1356cb9abc300f7e5 (diff)
downloadvimium-3c24c79b09735536e883dea6a00fb436979bb990.tar.bz2
Fix frame switching after frame redirect/creation
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee14
1 files changed, 11 insertions, 3 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 63487440..8b32c98b 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -179,20 +179,27 @@ window.addEventListener "focus", ->
# Initialization tasks that must wait for the document to be ready.
#
initializeOnDomReady = ->
- registerFrame(window.top == window.self)
+ registerFrame()
enterInsertModeIfElementIsFocused() if isEnabledForUrl
# Tell the background page we're in the dom ready state.
chrome.runtime.connect({ name: "domReady" })
-registerFrame = (is_top) ->
+registerFrame = ->
chrome.runtime.sendMessage(
handler: "registerFrame"
frameId: frameId
- is_top: is_top
+ is_top: window.top == window.self
total: frames.length + 1)
+# Unregister the frame if we're going to exit.
+unregisterFrame = ->
+ chrome.runtime.sendMessage(
+ handler: "unregisterFrame"
+ frameId: frameId
+ is_top: window.top == window.self)
+
#
# Enters insert mode if the currently focused element in the DOM is focusable.
#
@@ -1056,6 +1063,7 @@ Tween =
initializePreDomReady()
window.addEventListener("DOMContentLoaded", initializeOnDomReady)
+window.addEventListener("unload", unregisterFrame)
window.onbeforeunload = ->
chrome.runtime.sendMessage(