aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-04-25 13:11:21 +0100
committerStephen Blott2015-04-25 13:11:21 +0100
commitacdbe0c8f7ea85684216fec2b6b8ebb206e0d826 (patch)
tree1adf0f35c8d810d89d828795d00335c28361bf6a /background_scripts
parentd5a641600d06561d7f7ca4efb9c59dea6590a57e (diff)
downloadvimium-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 'background_scripts')
-rw-r--r--background_scripts/main.coffee6
1 files changed, 4 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index f11b3b4a..83108b93 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -88,8 +88,11 @@ getCurrentTabUrl = (request, sender) -> sender.tab.url
#
# Checks the user's preferences in local storage to determine if Vimium is enabled for the given URL, and
# whether any keys should be passed through to the underlying page.
+# The source frame also informs us whether or not it has the focus, which allows us to track the URL of the
+# active frame.
#
-root.isEnabledForUrl = isEnabledForUrl = (request) ->
+root.isEnabledForUrl = isEnabledForUrl = (request, sender) ->
+ urlForTab[sender.tab.id] = request.url if request.frameIsFocused
rule = Exclusions.getRule(request.url)
{
isEnabledForUrl: not rule or rule.passKeys
@@ -606,7 +609,6 @@ unregisterFrame = (request, sender) ->
handleFrameFocused = (request, sender) ->
tabId = sender.tab.id
- urlForTab[tabId] = request.url
# Cycle frameIdsForTab to the focused frame. However, also ensure that we don't inadvertently register a
# frame which wasn't previously registered (such as a frameset).
if frameIdsForTab[tabId]? and request.frameId in frameIdsForTab[tabId]