aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-04-25 09:45:55 +0100
committerStephen Blott2015-04-25 09:45:55 +0100
commitb1c27ca32fd3aa365990b959f22888c1d8d802ca (patch)
tree80cc59c7c41c7ce63e43af13c29adae777f5df4a /background_scripts
parente7ae8e0cc5aa5d4a8c7778c4a2f88b53d7cc4111 (diff)
parent6446cf04c7b44c3d419dc450a73b60bcaf5cdf02 (diff)
downloadvimium-b1c27ca32fd3aa365990b959f22888c1d8d802ca.tar.bz2
Merge branch 'exclusion-rules-pushState-and-hash' of https://github.com/mrmr1993/vimium into mrmr1993-exclusion-rules-pushState-and-hash
Conflicts: content_scripts/vimium_frontend.coffee
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee12
1 files changed, 10 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 642913a5..6fac032c 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -89,14 +89,22 @@ 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.
#
-root.isEnabledForUrl = isEnabledForUrl = (request, sender) ->
+root.isEnabledForUrl = isEnabledForUrl = (request) ->
rule = Exclusions.getRule(request.url)
{
isEnabledForUrl: not rule or rule.passKeys
passKeys: rule?.passKeys or ""
- incognito: sender.tab.incognito
}
+isEnabledForUpdatedUrl = (details) ->
+ message = isEnabledForUrl details
+ message.name = "updateEnabledForUrlState"
+ chrome.tabs.sendMessage details.tabId, message, {frameId: details.frameId}
+
+# Re-check whether Vimium is enabled for a frame when the url changes without a reload.
+chrome.webNavigation.onHistoryStateUpdated.addListener isEnabledForUpdatedUrl # history.pushState.
+chrome.webNavigation.onReferenceFragmentUpdated.addListener isEnabledForUpdatedUrl # Hash changed.
+
# Retrieves the help dialog HTML template from a file, and populates it with the latest keybindings.
# This is called by options.coffee.
root.helpDialogHtml = (showUnboundCommands, showCommandNames, customTitle) ->