aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-03-15 12:32:42 +0000
committerStephen Blott2015-03-15 12:32:42 +0000
commit3876a4f06de77d190fdaecc6cf99eb57134d0372 (patch)
treebdee3ecbb4577e7e155b8488232596035d634d34 /background_scripts
parent94a32b9ddcec58439a05179d9b6aeec135b46fb2 (diff)
downloadvimium-3876a4f06de77d190fdaecc6cf99eb57134d0372.tar.bz2
Populate popup with frame's URL.
Previously, we have been populating the suggested exclusion URL in the page popup with the tab's URL. This uses the active frame's URL instead: - because this is the URL which will affect the current frame (without this, a user can naively add an exclusion rule and it has no effect), and - because, without this, the user has no reasonable way to add exclusion rules for frames such as the hangouts frame on gmail (for which, the URL is not displayed in the address bar).
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee3
1 files changed, 3 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index b390fe1c..ecf18bef 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -26,6 +26,7 @@ validFirstKeys = {}
singleKeyCommands = []
focusedFrame = null
frameIdsForTab = {}
+root.urlForTab = {}
# Keys are either literal characters, or "named" - for example <a-b> (alt+b), <left> (left arrow) or <f12>
# This regular expression captures two groups: the first is a named key, the second is the remainder of
@@ -462,6 +463,7 @@ chrome.tabs.onRemoved.addListener (tabId) ->
tabInfoMap.deletor = -> delete tabInfoMap[tabId]
setTimeout tabInfoMap.deletor, 1000
delete frameIdsForTab[tabId]
+ delete urlForTab[tabId]
chrome.tabs.onActiveChanged.addListener (tabId, selectInfo) -> updateActiveState(tabId)
@@ -647,6 +649,7 @@ unregisterFrame = (request, sender) ->
handleFrameFocused = (request, sender) ->
tabId = sender.tab.id
+ urlForTab[tabId] = request.url
if frameIdsForTab[tabId]?
frameIdsForTab[tabId] =
[request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...]