diff options
| -rw-r--r-- | content_scripts/ui_component.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 10 | 
2 files changed, 12 insertions, 1 deletions
| diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index dadc84b5..b582cb5d 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -36,6 +36,9 @@ class UIComponent      @postMessage message if message?      @iframeElement.classList.remove "vimiumUIComponentHidden"      @iframeElement.classList.add "vimiumUIComponentShowing" +    # The window may not have the focus.  We focus it now so that the focus listener below isn't triggered +    # immediately. +    window.focus()      window.addEventListener "focus", @onFocus = (event) =>        if event.target == window          window.removeEventListener "focus", @onFocus diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 429657fc..0aaee3db 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -241,7 +241,7 @@ initializeOnDomReady = ->    # Tell the background page we're in the dom ready state.    chrome.runtime.connect({ name: "domReady" })    CursorHider.init() -  Vomnibar.init() +  Vomnibar.init() if window.top == window  registerFrame = ->    # Don't register frameset containers; focusing them is no use. @@ -258,6 +258,14 @@ unregisterFrame = ->      tab_is_closing: window.top == window.self  executePageCommand = (request) -> +  # Vomnibar commands are handled in the tab's main frame. +  if request.command.split(".")[0] == "Vomnibar" +    if window.top == window +      Utils.invokeCommandString request.command +      refreshCompletionKeys request +    return + +  # All other commands are handled in their frame.    return unless frameId == request.frameId    if (request.passCountToFunction) | 
