diff options
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 14 |
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( |
