From 17d06058b8aa5e05a705c5c914fb42bf9f13a307 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 26 Oct 2014 01:54:07 +0000 Subject: Change registerFrameIfSizeAvailable to registerFrame, stop sending size We were never using the area property, and it was causing an infinite setTimeout loop on frames with height == 0 or width == 0 (often caused by AdBlockPlus etc.). --- content_scripts/vimium_frontend.coffee | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 6db0d830..317acd22 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -174,24 +174,19 @@ window.addEventListener "focus", -> # Initialization tasks that must wait for the document to be ready. # initializeOnDomReady = -> - registerFrameIfSizeAvailable(window.top == window.self) + registerFrame(window.top == window.self) enterInsertModeIfElementIsFocused() if isEnabledForUrl # Tell the background page we're in the dom ready state. chrome.runtime.connect({ name: "domReady" }) -# This is a little hacky but sometimes the size wasn't available on domReady? -registerFrameIfSizeAvailable = (is_top) -> - if (innerWidth != undefined && innerWidth != 0 && innerHeight != undefined && innerHeight != 0) - chrome.runtime.sendMessage( - handler: "registerFrame" - frameId: frameId - area: innerWidth * innerHeight - is_top: is_top - total: frames.length + 1) - else - setTimeout((-> registerFrameIfSizeAvailable(is_top)), 100) +registerFrame = (is_top) -> + chrome.runtime.sendMessage( + handler: "registerFrame" + frameId: frameId + is_top: is_top + total: frames.length + 1) # # Enters insert mode if the currently focused element in the DOM is focusable. -- cgit v1.2.3