aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authormrmr19932015-04-24 12:16:36 +0100
committermrmr19932015-04-24 14:39:40 +0100
commitb3986dcd68a9383b3552ffb99c13c19e94bd08e4 (patch)
tree0145d53ef941c52e53ed654ec552ee21b0041337 /background_scripts
parent8a659af44a8205f39e4c0e04146978447ca3f38e (diff)
downloadvimium-b3986dcd68a9383b3552ffb99c13c19e94bd08e4.tar.bz2
Re-check enabled state after history.pushState/location.hash is changed
This uses the chrome.webRequest API to detect changes to page URL which *do not* cause the content script to refresh.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee9
1 files changed, 9 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 223b0d74..ab92559f 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -96,6 +96,15 @@ root.isEnabledForUrl = isEnabledForUrl = (request) ->
passKeys: rule?.passKeys or ""
}
+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) ->