diff options
| author | Stephen Blott | 2015-04-25 13:11:21 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-04-25 13:11:21 +0100 | 
| commit | acdbe0c8f7ea85684216fec2b6b8ebb206e0d826 (patch) | |
| tree | 1adf0f35c8d810d89d828795d00335c28361bf6a /content_scripts/vimium_frontend.coffee | |
| parent | d5a641600d06561d7f7ca4efb9c59dea6590a57e (diff) | |
| download | vimium-acdbe0c8f7ea85684216fec2b6b8ebb206e0d826.tar.bz2 | |
Track tab URL even if frame's URL changes.
We track the URL of the active frame in each tab so that we can
correctly populate the rules in the page popup.
Previously, we tracked URL changes only on focus events.  This commit
moves that to isEnabledForURL, which is also called when the URL changes
as a result of web navigation.
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 2b90fe95..75b7e58f 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -243,7 +243,7 @@ onFocus = (event) ->    if event.target == window      settings.load()      chrome.runtime.sendMessage handler: "frameFocused", frameId: frameId, url: window.location.toString() -    checkIfEnabledForUrl() +    checkIfEnabledForUrl true  # We install these listeners directly (that is, we don't use installListener) because we still need to receive  # events when Vimium is not enabled. @@ -585,9 +585,11 @@ onKeyup = (event) ->    DomUtils.suppressPropagation(event)    @stopBubblingAndTrue -checkIfEnabledForUrl = -> +# Checks if Vimium should be enabled or not in this frame.  As a side effect, it also informs the background +# page whether this frame has the focus, allowing the background page to track the active frame's URL. +checkIfEnabledForUrl = (frameIsFocused = windowIsFocused()) ->    url = window.location.toString() -  chrome.runtime.sendMessage { handler: "isEnabledForUrl", url: url }, (response) -> +  chrome.runtime.sendMessage { handler: "isEnabledForUrl", url: url, frameIsFocused: frameIsFocused }, (response) ->      { isEnabledForUrl, passKeys } = response      installListeners() # But only if they have not been installed already.      if HUD.isReady() and not isEnabledForUrl | 
